-
Improvement
-
Resolution: Fixed
-
Critical
-
3.5.4
-
None
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.