| The search query parameter of the /rest/wikis/{wikiName}/children REST resource is documented as filtering child pages by name or title. In practice, searching for a term that appears only in a page title returns no result. Steps to reproduce Create a top-level page with the following details:
-
- Space name: PSDTP
- Page: PSDTP.WebHome
- Title: Platform: Software Development Tools & Practices
Call the following URLs:
-
- GET /rest/wikis/xwiki/children?search=PSD
- GET /rest/wikis/xwiki/children?search=Platform
- GET /rest/wikis/xwiki/children?search=software
Expected results PSDTP.WebHome is returned for each request because the search term appears in the space name or page title. Actual results
- search=PSD returns PSDTP.WebHome.
- search=Platform and search=software return no result.
Analysis WikiChildrenResourceImpl delegates the search to NestedPagesPageHierarchy. The ChildrenQuery#matching(String) documentation says that matching filters child pages by name or title. In XWiki 17.10.9, the generated HQL for wiki-level children filters on space.name:
if (this.parentReference.getType() == EntityType.WIKI) {
statement += " AND LOWER(space.name) LIKE ";
} else {
statement += " AND ((doc.name <> 'WebHome' AND LOWER(doc.name) LIKE ) OR"
+ " (doc.name = 'WebHome' AND LOWER(space.name) LIKE ))";
}
The query does not match against doc.title. The same title matching limitation applies to the page-level children resource when hierarchy=nestedpages is used, because it uses the same PageHierarchy implementation. The endpoint was introduced in 16.4.0RC1 as part of XWIKI-14422. The issue is still present in XWiki 17.10.9. |