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

Creating a link to a page by pasting its full reference in the link modal is not always possible (anymore)

    XMLWordPrintable

Details

    • Integration
    • Unknown
    • N/A
    • N/A

    Description

      Regression of XWIKI-23229 caused by XWIKI-24119.

      This doesn't happen for any document reference. To understand when it happens, we need to understand how the page suggester from the Link modal works:

      • you paste some text (e.g. the full document reference)
      • the suggester makes a request to SuggestSolrService to find pages that match the pasted text
      • the suggester passes this search parameter qf=title^2 name forcing Solr to match only the page title and name
      • the suggester looks at the results to see if there is an exact match (full page reference) and if not then it shows a custom suggestion to create a link to a page with the pasted reference; so the suggestion to use the paste reference is shown only if there is no exact match; the suggester basically assumes that if there is an exact match in the search results then the user can select that option
      • the suggester uses TomSelect to show the suggestions
      • TomSelect performs its own results filtering, client-side, based on the configuration provided by resourcePicker.js, which says:
        // Use a dedicated search field to avoid matching 'WebHome' for document resources.
        searchField: ['searchValue', 'label', 'hint'],
        
      • TomSelect ends up filtering the provided results my matching the query (e.g. full page reference) against the configured search fields, none of which contains the full reference

      So the problem occurs when:

      • the results from SuggestSolrService include an exact match (for the full page reference), so the custom suggestion to use the pasted text as link target is not shown
      • the full page reference doesn't match TomSelect's search fields (client-side), so no results are shown

      An easy way to reproduce this is to create a page with a name that includes multiple words separated by space. This means the page reference will contain spaces and thus will lead to multiple free terms when performing a Solr search, one of them matching the page name or title. This will make SuggestSolrService return an exact match, thus disabling the custom suggestion to use the pasted text as is.

      Attachments

        Issue Links

          Activity

            People

              mflorea Marius Dumitru Florea
              mflorea Marius Dumitru Florea
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: