[MTE-42] Searching below root path '/' will result in no results Created: 27/Aug/15 Updated: 08/Jun/20 Resolved: 08/Jun/20 |
|
| Status: | Closed |
| Project: | Magnolia Templating Essentials |
| Component/s: | None |
| Affects Version/s: | 0.5 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Jordie Diepeveen | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 2 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| 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)
|
||||||||
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
||||||||
| Date of First Response: | |||||||||
| Description |
|
When using SearchTemplatingFunctions#searchContent(String, String, String, String) The query which is internally used by the searchContent method is: The problem is the "like '//%' " part. When changing it to "like '/%' ", it's working. E.g. SELECT rep:excerpt() from mgnl:education WHERE jcr:path like '/%' AND contains(., 'antropologie') ORDER BY jcr:score() DESC |
| Comments |
| Comment by reto odermatt [ 01/Sep/16 ] |
|
I was able to search below the root path using the following workaround: Instead of "/" as startPath parameter use "%" which would result in the following search query for your example: SELECT rep:excerpt() from mgnl:education WHERE jcr:path like '%/%' AND contains(., 'antropologie') ORDER BY jcr:score() DESC This also finds results for the root path. I am currently facing the following problem which relates to this issue: I have a multi site setup with root nodes /site1 and /site2 for the two sites. I want the search to only return results from one of the sites. When using /site1 as a start path, the resulting query is: SELECT rep:excerpt() from mgnl:page WHERE jcr:path like '/site1/%' AND contains(., 'search string') ORDER BY jcr:score() DESC This includes subpages of /site1 in the search results, but /site1 is excluded. In my opinion, SearchTemplatingFunctions.SEARCH_QUERY_PATTERN should be: SELECT rep:excerpt() from %s WHERE jcr:path like '%s%%' AND contains(., '%s') ORDER BY jcr:score() DESC |