You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My finder plugin indexes paragraphs of content and links to headings with the specified anchors. But if you enable the highlight_terms parameter in the finder settings, then the links will not lead to a fragment of the article.
In finder search results i expected links with SEF: /pages/article-alias?0=highlight&1=WyJcdTA0MzdcdTA0MzBcdTA0MzJcdTA0MzVcdTA0MzRcdTA0MzVcdTA0M2RcdTA0MzhcdTA0NGYiXQ==#anchor
Steps to reproduce the issue
My finder plugin indexes paragraphs of content and links to headings with the specified anchors. But if you enable the highlight_terms parameter in the finder settings, then the links will not lead to a fragment of the article.
Indexed links look like:
index.php?option=com_content&view=article&id=56#anchor
Expected result
In finder search results i expected links with SEF:
/pages/article-alias?0=highlight&1=WyJcdTA0MzdcdTA0MzBcdTA0MzJcdTA0MzVcdTA0MzRcdTA0MzVcdTA0M2RcdTA0MzhcdTA0NGYiXQ==#anchor
Actual result
/pages/article-alias#anchor&highlight=WyJcdTA0MzdcdTA0MzBcdTA0MzJcdTA0MzVcdTA0MzRcdTA0MzVcdTA0M2RcdTA0MzhcdTA0NGYiXQ==
Query with highlight is simply added to the end of the link
System information (as much as possible)
Joomla! 5.1.0
PHP 8.2
Additional comments
Fix this with code in file plugins/system/highlight/src/Extension/Highlight.php
Old code
$item->route .= '&highlight=' . base64_encode(json_encode(\array_slice($query->highlight, 0, 10)));
New code
$uri = new Uri($item->route); $uri->setQuery(array_merge($uri->getQuery(true), ['highlight' => base64_encode(json_encode(\array_slice($query->highlight, 0, 10)))])); $item->route = $uri->toString(['path', 'query', 'fragment']);
The text was updated successfully, but these errors were encountered: