New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[4.0] Decoupling highlighter plugin from com_finder #20571
Conversation
@@ -112,19 +116,19 @@ class HtmlView extends BaseHtmlView | |||
*/ | |||
public function display($tpl = null) | |||
{ | |||
$app = \JFactory::getApplication(); | |||
$params = $app->getParams(); | |||
$app = Factory::getApplication(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove extra spaces before =
or align with =
.
* | ||
* @return void | ||
* | ||
* @since 4.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change to __DEPLOY_VERSION__
No, but there is another bug that is fixed in #20185. Looks like this strict query handling was disabled again in a later version of 4.0-dev. Idk. Maybe update your 4.0-dev branch to the current state? It works there... |
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 |
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
public function onFinderResult($item, $query) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is afterFinderResults
. For consistency, make it onFinderResults
with a s
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there is a afterFinderResults
, but that is only the name of a mark in the logging, not a plugin event. Since I want to run the event on each result separately, I don't really would want to add the s
to the event name...
…4finder_highlighter # Conflicts: # components/com_finder/View/Search/HtmlView.php
#20185 has been merged in here. Happy testing. 😄 |
Got this: |
$this->state = $this->get('State'); | ||
$this->query = $this->get('Query'); | ||
\JDEBUG ? Profiler::getInstance('Application')->mark('afterFinderQuery') : null; | ||
$this->results = $this->get('Results'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert this one, is $this->get('Items')
All work ok. Waiting for the fix of the error |
I have tested this item ✅ successfully on a52bd58 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20571. |
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.
|
The issue here is, that |
$route .= '&highlight=' . base64_encode(json_encode($this->query->highlight)); | ||
} | ||
|
||
$url = JRoute::_($this->result->route); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a blank line above. Or not assign it to a variable and leave it where it was before.
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. |
0a5631b
to
acc8529
Compare
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 So please test and have a go. 😄 |
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 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 |
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 ✅ successfully on 9834dd9 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20571. |
I have tested this item ✅ successfully on 9834dd9 Can you have a look at that aspect and set RTC/Merge if OK? This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20571. |
@@ -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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this removal necessary then or can J3 plugins still work with that code in place?
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.
|
PR for deprecation: #20934 |
I have tested this item ✅ successfully on 55057f2 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20571. |
1 similar comment
I have tested this item ✅ successfully on 55057f2 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20571. |
RTC. Thanks This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20571. |
Thank you! |
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.