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

    Details

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

      41703

      Description

      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">
      <forms>
      <form id="search">
      <appearance>
      <field id="mimetype">
      <control template="/org/alfresco/components/form/controls/selectmany.ftl">
      <control-param name="options">text/plain,text/xml</control-param>
      </control>
      </field>
      </appearance>
      </form>
      </forms>
      </config>

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

      log4j.logger.org.alfresco.repo.jscript.ScriptLogger=debug

      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.

      Result:
      ======
      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"
      Sortby:
      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")))

      Notes:
      ======
      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.

        Attachments

          Issue Links

            Activity

            Hide
            ahunt Andrew Hunt added a comment -

            Selectmany.ftl is not part of the official api (whereas, for example, selectone.ftl is).
            Changed to Improvement jira

            Show
            ahunt Andrew Hunt added a comment - Selectmany.ftl is not part of the official api (whereas, for example, selectone.ftl is). Changed to Improvement jira
            Hide
            hdann Helen Dann (Inactive) added a comment -

            Added to the official docs. Re-classifying as a Bug.

            Show
            hdann Helen Dann (Inactive) added a comment - Added to the official docs. Re-classifying as a Bug.
            Hide
            alfrescoqa Alfresco QA Team added a comment -

            The issue is not reproduced on Alfresco Enterprise v3.4.10 build 676, Tomcat, PostgreSQL, Java (all installer deployed), Win7x64, FF12.0 with the steps described in ALF-13557
            TatianaK

            Show
            alfrescoqa Alfresco QA Team added a comment - The issue is not reproduced on Alfresco Enterprise v3.4.10 build 676, Tomcat, PostgreSQL, Java (all installer deployed), Win7x64, FF12.0 with the steps described in ALF-13557 TatianaK
            Hide
            dhulley Derek Hulley added a comment -

            The component originally used was not a supported, recognisable system component with an associated component owner. Either the component never existed (it was fictional) or it has reached end-of-life.
            The issues will be closed. Reopen and assign to an existing system component if necessary. Use labels appropriately.

            Show
            dhulley Derek Hulley added a comment - The component originally used was not a supported, recognisable system component with an associated component owner. Either the component never existed (it was fictional) or it has reached end-of-life. The issues will be closed. Reopen and assign to an existing system component if necessary. Use labels appropriately.

              People

              • Assignee:
                closedbugs Closed Bugs
                Reporter:
                amadon Alex Madon
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: