[MAGNOLIA-2068] SimpleSearchTag does not use jcr:contains properly Created: 20/Feb/08  Updated: 23/Jan/13  Resolved: 14/Jul/08

Status: Closed
Project: Magnolia
Component/s: taglibs
Affects Version/s: 3.5.4
Fix Version/s: 3.6, 3.5.9

Type: Improvement Priority: Critical
Reporter: Magnolia International Assignee: Magnolia International
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)

 Description   

The current implementation from the SimpleSearchTag generates queries which seem unnecessarily complex and underuse the power of the jcr:contains function. As a (rather bad) side effect, they also prevent from doing full phrase searches, as words which are normally not indexed (like "the") are not ignored.

An example: if I search for "i love the fresh strawberries from my garden", the SimpleSearchTag currently generates a query like
//[@jcr:primaryType='mgnl:content']//[jcr:contains(., 'i') and jcr:contains(., 'love')
and jcr:contains(., 'the') and jcr:contains(., 'fresh') and jcr:contains(., 'strawberries')
and jcr:contains(., 'from') and jcr:contains(., 'my') and jcr:contains(., 'garden')]
which returns no results.

If we'd use a query like
//[@jcr:primaryType='mgnl:content']//[jcr:contains(., 'i love the fresh strawberries from my garden')]
... then we get the expected results.

See "6.6.5.2 jcr:contains Function" from the JCR Spec (pages 110-111) for details.



 Comments   
Comment by Magnolia International [ 20/Feb/08 ]

Committed a first patch on svn, pending testing.
The default is to now use the new query style, but if needed, one can revert to the previous query by setting the useSimpleJcrQuery tag attribute to false.

Comment by Magnolia International [ 08/Jul/08 ]

The patch mentioned above as been included in releases since 3.5.5 - should be verified and documented !

Comment by Magnolia International [ 14/Jul/08 ]

Added note to release notes of 3.5.7, 3.5.8 and 3.6

Generated at Mon Feb 12 03:33:05 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.