This issue has been created
 
 
XWiki Platform / cid:jira-generated-image-avatar-d35e8bfd-e5a4-4b4d-be5b-9c11416de35d XWIKI-24692 Open

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

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-89e043aa-b081-4ab4-9560-e070963812d6 Marius Dumitru Florea created this issue on 13/Aug/26 11:07
 
Summary: Creating a link to a page by pasting its full reference in the link modal is not always possible (anymore)
Issue Type: cid:jira-generated-image-avatar-d35e8bfd-e5a4-4b4d-be5b-9c11416de35d Bug
Affects Versions: 18.2.0-rc-1
Assignee: Unassigned
Components: CKEditor, WYSIWYG Editor
Created: 13/Aug/26 11:07
Labels: regression
Priority: cid:jira-generated-image-static-major-e7a53354-8c33-4517-a38f-fb678c9291fd Major
Reporter: Marius Dumitru Florea
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.