Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-25313

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

    XMLWordPrintable

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:

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

      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

          Activity

            People

              Unassigned Unassigned
              andreic Camelia Andrei
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated: