Uploaded image for project: '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
    • Status: Closed (View Workflow)
    • Priority: 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

          amadon Alex Madon created issue -
          amadon Alex Madon made changes -
          Field Original Value New Value
          Link This issue is cloned by ALF-13475 [ ALF-13475 ]
          Hide
          amadon Alex Madon added a comment -

          cloned as per Philippe request as this is a HF escalation

          Show
          amadon Alex Madon added a comment - cloned as per Philippe request as this is a HF escalation
          amadon Alex Madon made changes -
          Fix Version/s 3.4.2 HF [ 10778 ]
          Fix Version/s 3.4.10 [ 11711 ]
          amadon Alex Madon made changes -
          Assignee Services Team Unassigned [ svcteam ] Sustaining Support Team [ alf_sustaining ]
          Hide
          pdubois Philippe Dubois added a comment -

          OK reviewed

          Show
          pdubois Philippe Dubois added a comment - OK reviewed
          pdubois Philippe Dubois made changes -
          Assignee Sustaining Support Team [ alf_sustaining ] Services Team Unassigned [ svcteam ]
          dward Dave Ward [X] (Inactive) made changes -
          Assignee Services Team Unassigned [ svcteam ] Sustaining Support Team [ alf_sustaining ]
          Component/s Sustaining [ 10760 ]
          Component/s Forms [ 10586 ]
          dward Dave Ward [X] (Inactive) made changes -
          Status New [ 10001 ] Open [ 1 ]
          Assignee Sustaining Support Team [ alf_sustaining ] David Ward [ dward ]
          Priority Major [ 3 ] Blocker [ 1 ]
          Escalation level Reviewed [ 10171 ] Hot Fix [ 10081 ]
          dward Dave Ward [X] (Inactive) made changes -
          Resource External [ 10060 ]
          Assignee David Ward [ dward ] Investigation Queue [ investigation ]
          Status Open [ 1 ] Investigate [ 10004 ]
          dward Dave Ward [X] (Inactive) made changes -
          Comment [ A comment with security level 'Alfresco' was removed. ]
          akovalchuk akovalchuk made changes -
          Status Investigate [ 10004 ] Investigating [ 10006 ]
          Assignee Investigation Queue [ investigation ] Pavel Yurkevich [ pyurkevich ]
          pyurkevich Pavel Yurkevich made changes -
          Remaining Estimate 0 minutes [ 0 ]
          Time Spent 1 day [ 28800 ]
          Worklog Id 23429 [ 23429 ]
          pyurkevich Pavel Yurkevich made changes -
          Attachment ALF-13557.diff [ 30521 ]
          pyurkevich Pavel Yurkevich made changes -
          Date_Investigated 4/Apr/12 [ 2012-04-04 ]
          Status Investigating [ 10006 ] Investigated [ 10008 ]
          Assignee Sustaining Support Team [ alf_sustaining ] David Ward [ dward ]
          dward Dave Ward [X] (Inactive) made changes -
          Assignee David Ward [ dward ] UI Team Unassigned [ uiteam ]
          dward Dave Ward [X] (Inactive) made changes -
          Assignee UI Team Unassigned [ uiteam ] Investigation Queue [ investigation ]
          Status Investigated [ 10008 ] Implement [ 10005 ]
          pyurkevich Pavel Yurkevich made changes -
          Assignee Investigation Queue [ investigation ] Pavel Yurkevich [ pyurkevich ]
          pyurkevich Pavel Yurkevich made changes -
          Status Implement [ 10005 ] Implementing [ 10007 ]
          pyurkevich Pavel Yurkevich made changes -
          Time Spent 1 day [ 28800 ] 2 days [ 57600 ]
          Worklog Id 23519 [ 23519 ]
          pyurkevich Pavel Yurkevich made changes -
          Remaining Estimate 0 minutes [ 0 ] 1 hour [ 3600 ]
          Time Spent 2 days [ 57600 ] 1 day, 7 hours [ 54000 ]
          Worklog Id 23519 [ 23519 ]
          pyurkevich Pavel Yurkevich made changes -
          Remaining Estimate 1 hour [ 3600 ] 0 minutes [ 0 ]
          Worklog Id 23519 [ 23519 ]
          pyurkevich Pavel Yurkevich made changes -
          Date_Investigated 4/Apr/12 [ 2012-04-04 ] 6/Apr/12 [ 2012-04-06 ]
          Status Implementing [ 10007 ] Implemented [ 10009 ]
          Assignee Sustaining Support Team [ alf_sustaining ] UI Team Unassigned [ uiteam ]
          dward Dave Ward [X] (Inactive) made changes -
          Assignee UI Team Unassigned [ uiteam ] David Ward [ dward ]
          amadon Alex Madon made changes -
          Original Estimate 0 minutes [ 0 ]
          ACT Numbers 41703 41703 Premier
          hdann Helen Dann (Inactive) made changes -
          Comment [ customer asks when they will get a HotFix build, thanks ]
          Hide
          dward Dave Ward [X] (Inactive) 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 Dave Ward [X] (Inactive) 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>
          dward Dave Ward [X] (Inactive) made changes -
          Attachment ALF-13557.diff [ 30521 ]
          dward Dave Ward [X] (Inactive) made changes -
          Attachment ALF-13557.patch [ 31031 ]
          dward Dave Ward [X] (Inactive) made changes -
          Assignee David Ward [ dward ] UI Team Unassigned [ uiteam ]
          kroast Kevin Roast made changes -
          Assignee UI Team Unassigned [ uiteam ] Kevin Roast [ kroast ]
          kroast Kevin Roast made changes -
          Assignee Kevin Roast [ kroast ] David Ward [ dward ]
          dward Dave Ward [X] (Inactive) made changes -
          Status Implemented [ 10009 ] Resolved [ 5 ]
          Assignee David Ward [ dward ] QA Backlog Unassigned [ qabacklog ]
          Fix Version/s 3.4.10 [ 11711 ]
          Fix Version/s 3.4.2 HF [ 10778 ]
          Resolution Fixed [ 1 ]
          dward Dave Ward [X] (Inactive) made changes -
          Fix Version/s 3.4.2 HF [ 10778 ]
          Fix Version/s 3.4.10 [ 11711 ]
          dward Dave Ward [X] (Inactive) made changes -
          Link This issue is related to by ALF-13771 [ ALF-13771 ]
          Show
          alfrescoqa 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
          alfrescoqa Alfresco QA Team made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Assignee QA Backlog Unassigned [ qabacklog ] Sustaining Support Team [ alf_sustaining ]
          Hide
          amadon 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
          amadon 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 Dave Ward [X] (Inactive) 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 Dave Ward [X] (Inactive) 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
          dward Dave Ward [X] (Inactive) made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Assignee Sustaining Support Team [ alf_sustaining ] QA Backlog Unassigned [ qabacklog ]
          Resolution Fixed [ 1 ]
          Hide
          alfrescoqa 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
          alfrescoqa 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
          alfrescoqa Alfresco QA Team added a comment -

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

          Show
          alfrescoqa Alfresco QA Team added a comment - Successfully validated for Alfresco Enterprise v3.4.2 (.7 16).
          alfrescoqa Alfresco QA Team made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Assignee QA Backlog Unassigned [ qabacklog ] Closed Issues [ closedissues ]
          adavis Alan Davis made changes -
          Status Closed [ 6 ] Editable Closed [ 10061 ]
          adavis Alan Davis made changes -
          Assignee Closed Issues [ closedissues ] Closed Bugs [ closedbugs ]
          adavis Alan Davis made changes -
          Component/s ZZ Do not use [ 12819 ]
          Component/s Sustaining [ 10760 ]
          adavis Alan Davis made changes -
          Project Alfresco [ 10281 ] Service Packs and Hot Fixes [ 11350 ]
          Key ALF-13557 MNT-6814
          Workflow Alfjira_II_PM [ 141543 ] Service Packs and Hot Fixes [ 178608 ]
          Issue Type Bug [ 1 ] Hot Fix Request [ 40 ]
          Resource External [ 10060 ]
          Fix Version/s 3.4.2 HF [ 13347 ]
          Fix Version/s 3.4.2 HF [ 10778 ]
          Hot Fix Version Historic
          Rank (Obsolete) 39900000000
          Date_Investigated 6/Apr/12 [ 2012-04-06 ]
          Status Transition Date 27/Apr/12 5:01 PM [ 2012-04-27T17:01+0100 ]
          Affects Version/s 3.4.8 [ 12744 ]
          Affects Version/s 4.0.2 [ 12750 ]
          Affects Version/s 3.4.8 [ 10794 ]
          Affects Version/s 4.0.2 [ 11322 ]
          Escalation level Hot Fix [ 10081 ]
          Component/s ZZ Do not use [ 12815 ]
          Component/s ZZ Do not use [ 12819 ]
          adavis Alan Davis made changes -
          Status Editable Closed [ 10061 ] Closed [ 6 ]
          adavis Alan Davis made changes -
          Workflow Service Packs and Hot Fixes [ 178608 ] Service Packs and Hot Fixes - rm EC [ 184905 ]
          adavis Alan Davis made changes -
          Workflow Service Packs and Hot Fixes - rm EC [ 184905 ] Service Packs and Hot Fixes [ 192196 ]
          adavis Alan Davis made changes -
          Component/s Installation [ 12296 ]
          Component/s ZZ Do not use [ 12815 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          New New Open Open
          1d 6h 19m 1 Dave Ward [X] (Inactive) 03-Apr-12 04:47 PM
          Open Open Investigate Investigate
          32s 1 Dave Ward [X] (Inactive) 03-Apr-12 04:48 PM
          Investigate Investigate Investigating Investigating
          16h 31m 1 akovalchuk 04-Apr-12 09:19 AM
          Investigating Investigating Investigated Investigated
          10h 58m 1 Pavel Yurkevich 04-Apr-12 08:18 PM
          Investigated Investigated Implement Implement
          16h 3m 1 Dave Ward [X] (Inactive) 05-Apr-12 12:21 PM
          Implement Implement Implementing Implementing
          3h 49m 1 Pavel Yurkevich 05-Apr-12 04:10 PM
          Implementing Implementing Implemented Implemented
          23h 46m 1 Pavel Yurkevich 06-Apr-12 03:57 PM
          Implemented Implemented Resolved Resolved
          13d 18h 32m 1 Dave Ward [X] (Inactive) 20-Apr-12 10:29 AM
          Resolved Resolved Reopened Reopened
          6d 3h 38m 1 Alfresco QA Team 26-Apr-12 02:08 PM
          Reopened Reopened Resolved Resolved
          1h 25m 1 Dave Ward [X] (Inactive) 26-Apr-12 03:34 PM
          Resolved Resolved Closed Closed
          1d 1h 26m 1 Alfresco QA Team 27-Apr-12 05:01 PM
          Closed Closed Removed Status Removed Status
          324d 23h 25m 1 Alan Davis 18-Mar-13 03:26 PM
          Removed Status Removed Status Closed Closed
          20h 57m 1 Alan Davis 19-Mar-13 12:24 PM

            People

            • Assignee:
              closedbugs Closed Bugs
              Reporter:
              amadon 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