Service Packs and Hot Fixes
  1. Service Packs and Hot Fixes
  2. MNT-6814

CLONE - 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: Hot Fix Request Hot Fix Request
    • Status: Closed Closed (View Workflow)
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.4.8, 4.0.2
    • Fix Version/s: 3.4.2 HF
    • Component/s: Installer
    • Labels:
      None
    • Environment:
      any
    • Hot Fix Version:
      Historic
    • ACT Numbers:

      41703 Premier

      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.

        Issue Links

          Activity

          Hide
          Alex Madon added a comment -

          cloned as per Philippe request as this is a HF escalation

          Show
          Alex Madon added a comment - cloned as per Philippe request as this is a HF escalation
          Hide
          Philippe Dubois added a comment -

          OK reviewed

          Show
          Philippe Dubois added a comment - OK reviewed
          Hide
          dward added a comment -

          The new proposed change extends the advanced search back-end so that it can handle optional 'mode' parameters that activate the handling of multiple values. An optional mode parameter in the selectmany control activates the feature and allows selection between OR and AND. For example

          <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-param name="mode">OR</control-param>
          </control>
          </field>
          </appearance>
          </form>
          </forms>
          </config>

          Show
          dward added a comment - The new proposed change extends the advanced search back-end so that it can handle optional 'mode' parameters that activate the handling of multiple values. An optional mode parameter in the selectmany control activates the feature and allows selection between OR and AND. For example <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-param name="mode">OR</control-param> </control> </field> </appearance> </form> </forms> </config>
          Show
          Alfresco QA Team added a comment - Issue https://issues.alfresco.com/jira/browse/ALF-13557 is blocked by issue https://issues.alfresco.com/jira/browse/ALF-13838
          Hide
          Alex Madon added a comment - - edited

          On 3.4.2 there is a missing step to observe the logging:
          you need to follow ALF-10856 that is edit the javascript file:

          <tomcat>\webapps\alfresco\WEB-INF\classes\alfresco\templates\webscripts\org\alfresco\slingshot\search\search.lib.js

          Adding this on line 833:

          if (logger.isLoggingEnabled())
          logger.log("Query:\r\n" + ftsQuery);

          Show
          Alex Madon added a comment - - edited On 3.4.2 there is a missing step to observe the logging: you need to follow ALF-10856 that is edit the javascript file: <tomcat>\webapps\alfresco\WEB-INF\classes\alfresco\templates\webscripts\org\alfresco\slingshot\search\search.lib.js Adding this on line 833: if (logger.isLoggingEnabled()) logger.log("Query:\r\n" + ftsQuery);
          Hide
          dward added a comment -

          ALF-13838: Merged V3.4-BUG-FIX to PATCHES/V3.4.2
          31160: Merged HEAD to V3.4-BUG-FIX
          31156: Various Share search related fixes as spotted by Andy:

          • increased resultset size that is used to retrieve raw results from query before Share specific results are filtered - this means sensible results are now shown from large repository wide and sorted queries, previously results would be "missing" if they dropped out of the resultset prefiltering
          • fix to Share Search component to correctly display if more than N results were found in the repository
          • fix to add default TYPE clause to generated Share search if no other TYPE is specified - this reduces masses of potentially matches results from repository wide searches that would otherwise need to be post-filtered
          Show
          dward added a comment - ALF-13838 : Merged V3.4-BUG-FIX to PATCHES/V3.4.2 31160: Merged HEAD to V3.4-BUG-FIX 31156: Various Share search related fixes as spotted by Andy: increased resultset size that is used to retrieve raw results from query before Share specific results are filtered - this means sensible results are now shown from large repository wide and sorted queries, previously results would be "missing" if they dropped out of the resultset prefiltering fix to Share Search component to correctly display if more than N results were found in the repository fix to add default TYPE clause to generated Share search if no other TYPE is specified - this reduces masses of potentially matches results from repository wide searches that would otherwise need to be post-filtered
          Hide
          Alfresco QA Team added a comment -

          Successfully validated for Alfresco Enterprise v3.4.2 (.7 16).
          Environment: RHEL 5.7 x64 , MySQL, Tomcat 6.0.29

          Test performed:
          1) create a 3.4.2 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-param name="mode">OR</control-param>
          </control>
          </field>
          </appearance>
          </form>
          </forms>
          </config>

          5) 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) Create site and two documents (first with mimetype text/plain and second with mimetype text/xml)
          7) select both MIME types and press the submit search button.

          Actual result:
          were found both documents
          was appeared following message
          DEBUG [org.alfresco.repo.jscript.ScriptLogger] Query:
          (TYPE:"cm:content" AND (((cm:content.mimetype:"text/plain") OR (cm:content.mimetype:"text/xml")))) AND -TYPE:"cm:thumbnail"

          8) for fourth step set “AND” instead “OR” <control-param name="mode">AND</control-param>
          9) Repeat steps 6 and 7
          Actual result:
          Documents weren’t found
          was appeared following message
          DEBUG [org.alfresco.repo.jscript.ScriptLogger] Query:
          (TYPE:"cm:content" AND (((cm:content.mimetype:"text/plain") AND (cm:content.mimetype:"text/xml")))) AND -TYPE:"cm:thumbnail"

          Show
          Alfresco QA Team added a comment - Successfully validated for Alfresco Enterprise v3.4.2 (.7 16). Environment: RHEL 5.7 x64 , MySQL, Tomcat 6.0.29 Test performed: 1) create a 3.4.2 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-param name="mode">OR</control-param> </control> </field> </appearance> </form> </forms> </config> 5) 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) Create site and two documents (first with mimetype text/plain and second with mimetype text/xml) 7) select both MIME types and press the submit search button. Actual result: were found both documents was appeared following message DEBUG [org.alfresco.repo.jscript.ScriptLogger] Query: (TYPE:"cm:content" AND (((cm:content.mimetype:"text/plain") OR (cm:content.mimetype:"text/xml")))) AND -TYPE:"cm:thumbnail" 8) for fourth step set “AND” instead “OR” <control-param name="mode">AND</control-param> 9) Repeat steps 6 and 7 Actual result: Documents weren’t found was appeared following message DEBUG [org.alfresco.repo.jscript.ScriptLogger] Query: (TYPE:"cm:content" AND (((cm:content.mimetype:"text/plain") AND (cm:content.mimetype:"text/xml")))) AND -TYPE:"cm:thumbnail"
          Hide
          Alfresco QA Team added a comment -

          Successfully validated for Alfresco Enterprise v3.4.2 (.7 16).

          Show
          Alfresco QA Team added a comment - Successfully validated for Alfresco Enterprise v3.4.2 (.7 16).

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 7 hours
                1d 7h