User tests: Successful: Unsuccessful:
This PR tries to fix #20252.
This PR introduces a new event, "onFinderResult", which takes a single result object and the search query object. This allows plugins to modify the results (for example changing MIME types, link types, adding additional data, etc.) and in this case it allows the highlight plugin to modify the URL of the link of the search result to add the highlight parameter. This decouples the highlight system plugin from com_finder.
The downside in this case is, that the URL, that is displayed below the search result, now also contains the highlight parameter. I would say that we should rework the output of the results anyway, but that would be the topic of another PR.
The FinderIndexerResult
object has both an url
and route
attribute and we are now using url
for display purposes and route
for the links href.
I also tried to change a few of the calls to the new namespaced versions.
[UPDATE]
In further reviews, I also found out the issue why searchwords with utf8 characters are not properly highlighted. It turns out that OutputFilter::stringJSSafe() is not utf8 aware and I had to rewrite it. Now it properly encodes this into a utf8 escaped string.
[UPDATE]
Yet another update regarding the url
and route
: url is actually the ID of the item and thus can not be used. Instead I added cleanurl
instead.
Status | New | ⇒ | Pending |
Category | ⇒ | Front End com_finder Plugins |
Labels |
Added:
?
|
I test now without this PR, and give the same error. So, is not this PR. And yes, the branch is up to the current state
Got this:
Warning: Invalid argument supplied for foreach() in .....components\com_finder\tmpl\search\default_results.php on line 49
All work ok. Waiting for the fix of the error
I have tested this item
I've updated the PR and fixed some things. It would be nice if you could test this again and if we could get one more tester for this.
The URLs don't match where the only difference should be the highlight query string.
http://localhost/joomla-cms-j4finder_highlighter/index.php/blog/5-your-modules?highlight=WyJqb29tbGEiXQ==
http://localhost/joomla-cms-j4finder_highlighter/index.php/component/content/article/5-your-modules
The issue here is, that FinderIndexerAdapter::getURL()
returns the wrong URL. That method should actually be deprecated... We have to fix the finder plugins for that.
I've changed the way the URLs are produced, which should fix the issue that you had and also cleaned up the result layout. Please test again.
Please delay that. I made a mistake. I will report back when I fixed the issue.
Category | Front End com_finder Plugins | ⇒ | Administration com_finder Front End Plugins |
Ok, I got this right now. I removed the FinderIndexerHelper::getContentPath() method, since we don't need that with the new router anymore. I also cleaned up the finder plugins and improved the comments there. Last but not least, I added a cleanURL
attribute after unserialising the object in the model, where I simply copy the route
attribute to this. That allows us to render the clean URL in the result layout and at the same time allow the highlighter plugin to add to the URL.
So please test and have a go.
Category | Front End com_finder Plugins Administration | ⇒ | Administration com_finder Front End Libraries Plugins |
Since @infograf768 requested this, I also reviewed the highlighting of search words with utf8 chars in the search results page. It turns out that \Joomla\CMS\Filter\OutputFilter::stringJSSafe() is not utf8 aware and mangles all characters that are not ASCII. I rewrote that and now it should work fine for utf8. Looking for your test, @infograf768
@Hackwar
Indeed, the issue was whether in js or the method ( #20562 (comment) ).
You solved it here and utf8 is now correctly highlighted.
Remains an issue here with terms surrounded by doublequotes or singlequotes. If one does not search WITH the quotes, i.e. for example 'frontale
(term in text is 'frontale'
) then we have no suggestion. If I enter frontale
no suggestion and no result but I am proposed to search for 'frontale'
.
(That issue does not exist in com_search although highlighting is broken for com_search in 4.0. Works on 3.x)
The suggestions have nothing to do with highlighting. I hope no one now gets confused and delays this PR because you are bringing up unrelated bugs here.
I sincereley hope not. As usual I test a few things when I test any of your PRs. Just consider it as a note about something to remember if it can be solved or not.
As I only tested the highlighting and not the hardcoupling issue, I can't set the my test as OK on issues.joomla.org
I have tested this item
I have tested this item
@laoneo @mbabker
This PR is fine concerning the highlighting of terms. But I have no idea about the decoupling.
Can you have a look at that aspect and set RTC/Merge if OK?
Since this is more or less broken code and potentially creates wrong URLs, this code will not work in 4.0 anymore. Plugins from 3.x can't use it anymore and shouldn't use it now already.Am 29.06.2018 07:56 schrieb Allon Moritz notifications@github.com:@laoneo commented on this pull request.
In plugins/finder/categories/categories.php:
@@ -304,8 +306,6 @@ protected function index(FinderIndexerResult $item, $format = 'html')
$item->route = ContentHelperRoute::getCategoryRoute($item->id, $item->language);
}
$item->path = FinderIndexerHelper::getContentPath($item->route);
Is this removal necessary then or can J3 plugins still work with that code in place?
—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread.
Is it then deprecated in J3?
I'm going to create a depreciation PR soon.Am 29.06.2018 09:26 schrieb Allon Moritz notifications@github.com:Is it then deprecated in J3?
—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread.
I have tested this item
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC. Thanks
Thank you!
Labels |
Added:
?
|
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-07-06 14:24:13 |
Closed_By | ⇒ | laoneo |
I got this. This PR depend of other?