Uploaded image for project: 'Service Packs and Hot Fixes'
  1. Service Packs and Hot Fixes
  2. MNT-2797

Share forms selectmany.ftl template does not work with Share search query parser; should do a logical OR or AND but does a concatenation


    • Type: Service Pack Request
    • Status: Closed (View Workflow)
    • Resolution: Fixed
    • Affects Version/s: 3.4.2
    • Fix Version/s: 3.4.10
    • Component/s: ZZ_Archive
    • Labels:
    • Environment:
    • Bug Priority:
      Category 2
    • ACT Numbers:



      How to reproduce?
      1) create a 3.4.8 plain vanilla alfresco (mysql, tomcat, linux)
      2) check the Advanced Search URL http://localhost:8080/share/page/advsearch (see screen shot 1)
      3) in Share web-extension folder copy the share-config-custom.xml.sample into share-config-custom.xml
      4) in share-config-custom.xml add the following section:

      <config evaluator="model-type" condition="cm:content">
      <form id="search">
      <field id="mimetype">
      <control template="/org/alfresco/components/form/controls/selectmany.ftl">
      <control-param name="options">text/plain,text/xml</control-param>

      5) as documented in ALF-10856 set in alfresco log4j:


      this will log in the logs the lucene query generated by the query parser.

      6) restart tomcat and check that you now have a HTML <select> tag that allows you to select text/plain AND text/xml at the same time (see screen shot 2)
      7) select both MIME types and press the submit search button.

      No documents are found and the logs show that this is because the lucene query created is:

      16:15:40,175 DEBUG [repo.jscript.ScriptLogger] Query:
      ((TYPE:"cm:content" AND (cm:content.mimetype:"text/plain,text/xml")) AND -TYPE:"cm:thumbnail") AND NOT ASPECT:"sys:hidden"
      16:15:40,461 DEBUG [repo.jscript.ScriptLogger] Processing resultset of length: 0
      16:15:40,461 DEBUG [repo.jscript.ScriptLogger] Filtered resultset to length: 0. Discarded item count: 0

      Expected result:
      a) If the coma separating the mime types sent at form submission time is interpreted as a logical AND, then yes we would expect 0 documents returned, but the Lucene query should be:

      ((TYPE:"cm:content" AND ((cm:content.mimetype:"text/plain") AND (cm:content.mimetype:"text/xml")))

      and not:

      ((TYPE:"cm:content" AND (cm:content.mimetype:"text/plain,text/xml"))

      b) if we expect a logical OR, then we should expect all the xml and text documents with a lucene query:

      ((TYPE:"cm:content" AND ((cm:content.mimetype:"text/plain") OR (cm:content.mimetype:"text/xml")))

      1) Fixing that bug requires implementing the logical keywords OR and AND.
      This could be called using a new selectmany.ftl parameter besides those listed at http://wiki.alfresco.com/wiki/Forms#selectmany.ftl
      (namely options, size, styleClass, style, forceEditable)

      2) The 'how to reproduce' section is the simplest way I found to reproduce the issue, but that Jira would apply to any content model form, in particular to automatic forms generated by parsing a content model that has a LIST constraint.


        1. shot1.png
          46 kB
        2. shot2.png
          49 kB

          Issue Links




                • Assignee:
                  closedbugs Closed Bugs
                  amadon Alex Madon [X] (Inactive)
                • Votes:
                  0 Vote for this issue
                  5 Start watching this issue


                  • Created:

                    Structure Helper Panel