This issue has been created
There is 1 update.
 
 
XWiki Platform / cid:jira-generated-image-avatar-1a948765-2aa1-4542-a5b1-cae7e9a4ace9 XWIKI-25313 Open

The search parameter of the REST wiki children resource does not match page titles

 
View issue   ·   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-4356f86c-f240-4690-8934-0a0924ed69e6 Camelia Andrei created this issue on 16/Oct/26 11:11
 
Summary: The search parameter of the REST wiki children resource does not match page titles
Issue Type: cid:jira-generated-image-avatar-1a948765-2aa1-4542-a5b1-cae7e9a4ace9 Bug
Affects Versions: 17.10.9
Assignee: Unassigned
Created: 16/Oct/26 11:11
Priority: cid:jira-generated-image-static-major-aabcc918-b884-49c4-92d6-ba195f096023 Major
Reporter: Camelia Andrei
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:

    • 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.

 
 

1 update

 
cid:jira-generated-image-avatar-4356f86c-f240-4690-8934-0a0924ed69e6 Changes by Camelia Andrei on 16/Oct/26 11:12
 
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.

h2. Steps to reproduce
h1. Create a top-level page with the following details:

#
* * Space name: {{PSDTP}}
# * * Page: {{PSDTP.WebHome}}
# * * Title: {{Platform: Software Development Tools & Practices}}
h1. Call the following URLs:

#

* * {{{}GET /rest/wikis/xwiki/children?search=PS{}}}D
# * * {{{}GET /rest/wikis/xwiki/children?search={}}}Platform
# * * {{GET /rest/wikis/xwiki/children?search=software}}

h2. Expected results

{{PSDTP.WebHome}} is returned for each request because the search term appears in the space name or page title.

h2. Actual results
* {{{}search=PS{}}}D returns {{{}PSDTP.WebHome{}}}.

* {{{}search={}}}Platform and {{search=software}} return no result.

h2. 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{}}}:

{code :java }
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 ))";
}
{code}

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.