Details
-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
17.10.9
-
None
-
None
-
Unknown
-
Description
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:
-
- 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.
This appears related to XWIKI-23819, which reports that the Children view’s document-title filter matches the document reference instead of the title. The REST resource has a separate implementation.
Attachments
Issue Links
- is caused by
-
XWIKI-14422 Organize navigation menu items manually and visually
-
- Closed
-
- is related to
-
XWIKI-23819 Filtering by document title in children view filters by document reference instead of title
-
- Open
-