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
In finder search results i expected links with SEF:
/pages/article-alias?0=highlight&1=WyJcdTA0MzdcdTA0MzBcdTA0MzJcdTA0MzVcdTA0MzRcdTA0MzVcdTA0M2RcdTA0MzhcdTA0NGYiXQ==#anchor
/pages/article-alias#anchor&highlight=WyJcdTA0MzdcdTA0MzBcdTA0MzJcdTA0MzVcdTA0MzRcdTA0MzVcdTA0M2RcdTA0MzhcdTA0NGYiXQ==
Query with highlight is simply added to the end of the link
Joomla! 5.1.0
PHP 8.2
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']);
Labels |
Added:
No Code Attached Yet
|
Labels |
Added:
bug
|
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-05-06 16:15:57 |
Closed_By | ⇒ | Hackwar |
Thanks for reporting! Would you like to make PR by Yourself?