Search results in title show search keyword tag #16979
Comments
The way that highlighter.js works is by wrapping the keyword with a By the way where are you getting this? In core highlighter is used only for the search results AFAIK |
@vladav thanks for reporting. Related to #16484? This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/16979. |
Removing line 270 from components/com_search/views/search/view.html.php solved the issue. (Still, now the keyword in title is not highlighted, but it does not show html span tags). |
Same issue here using a Shaper_helix3 template. Removing line 270 has provided a temporary fix. |
@vladav I remove line 270 and problem is gone, tnx :) |
I have same issue Yootheme template. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/16979. |
Set to "closed" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/16979 |
closed as having PR ##16484 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/16979. |
@franz-wohlkoenig isn't #16484 the source of the bug, rather than a fix for the bug? |
سلام دوستان ایرانی به ادرس زیر بروید public_html/components/com_search/views/search/view.html.php و کد زیر را پیدا . غیر فعال نمایید با // $result->title = StringHelper::str_ireplace($needle, $hl1 . $needle . $hl2, htmlspecialchars($result->title, ENT_COMPAT, 'UTF-8')); موفق باشید |
@mahsite Plese use English in this repo. |
I have two websites. |
@nicksavov should ths Issue be reopened? |
No, I think the problem is in the Warp framework. |
@franz-wohlkoenig Yes, I think so. The two sites I experienced this on had a custom template and a Helix 3 framework template. |
Set to "open" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/16979 |
reopened as stated above. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/16979. |
I saw this on a few websites with templates that override com_search. Yootheme seem to have updated their templates to fix this. |
Both templates here have an override for com_search. I could implement the fix in the overrides (wouldn't be an issue). Is there a way to fix this in core for all users, including those that have template overrides? I'm guessing the answer is going to be no, but thought I'd ask |
If the issue is in the override then nothing changed in the core will effect the override. Thats the whole point of an override. Closing as it is not a core issue |
We also had this issue as described above. We found that we needed to fix our template override, as described under 35752ef. After fixing our template override, highlighting of the keyword in the title line worked allright. But still, the highlighted keyword is not displayed correctly. For example, if you enter a search like "joomla", and "Joomla" would be the correct writing in the title line, instead you see "joomla" highlighted in the title line. In the content snippet below the title line, though, you see the keyword in correct writing, e. g., "Joomla". Apparently, in the search result not the complete original string from the title line is displayed but the string from the search input is integrated here. |
Try this to fix the case issue: |
Thanks for taking the time to reply and trying to provide a fix. Sadly there are two problems though. First, the fix only works around case differences of the first character and more importantly second, isn’t the “view.html.php” part of the core and cannot simply be overridden contrary to e.g. the “default_results.php”? |
Not exactly. Many things can change in the core and affect an override. The only thing that can change in core that for sure won't affect an override is the file that's being overridden. In this particular case, the core change in components/com_search/views/search/view.html.php (which isn't getting overridden) affected the override (for components/com_search/views/search/tmpl/default_results.php). |
Thanks! |
Can this issue be reopened please? |
Set to "open" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/16979 |
reopened as stated above. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/16979. |
why is this re-opened |
Thanks! It shouldn't have been closed. See #16979 (comment) for more info. |
I'm missing something then. What is left for us to do to address this issue? Introducing a new property does not fix overrides because overrides will be unaware of it, reverting to the old way restores a bug. At this point it is unclear what the issue to be resolved is. |
Good question! This part needs to be addressed:
As to the old way, I wouldn't call it bug per se. It's a design choice of whether to highlight the search word in the title or not. That design choice has likely been there since the plugin was first added to core. For that reason, some would consider highlighting the title as a nice new feature, rather than a bug fix. |
If we are highlighting matching search terms and we are searching for those terms in the title then it was a bug that they were not highlighted before. That bug has been fixed. There is nothing that can be changed in the core to make your override with a bug work correctly |
Then the answer is no. If you change something in a layout, that is specific to that layout. If you change something in the data objects being fed into a layout, it is a global change affecting anything using that data object. |
In the core, the Title of an article is not put through any html-encoding. Therefore the handling of the title string is left to the template or override. Now the title string is changed in the core and overrides or templates do not expect this. |
@mbabker thanks! |
So can we close it now? |
You have to remove the escape thing from your template overrides NOT because the title has been htmlspecialchared in core but because parts of the title are surrounded sometimes by HTML-SPAN-tags to highlight search hits. I think removing the highlightning of titles is not an option at all. So, yes, please close this issue. |
Set to "closed" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/16979 |
closed as stated above. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/16979. |
Due to https://github.com/joomla/joomla-cms/pull/16484/files , search results titles that have a search keyword now display as: <span class="highlight">Sample</span> title... Instead of: Same Title This fixes it. If needed, more about this issue is found at joomla/joomla-cms#16979
Hi, Please open the file default_results.php And find out the code
And replace with this code
-Thanks |
Resolved with the ittoufiq method. Translate to french : Résolu avec la méthode de ittoufiq. |
My fix in /components/com_search/views/search/view.html.php on line 162 insert code "break;" |
I have this issue in Joomla v3.8.10 I know that previous discussion has explained how to fix this but without the context of surrounding code fragments for a "before" and "after" it is difficult working out what I need to do. Some authors have refered to modifying two files, and others in different places. Where exactly - line 19, 20, 162 or 270? For example my file (v3.8.10) com_search/views/search/view.html.php line 162... For example my file (v3.8.10) com_search/views/search/view.html.php line 270... I would appreciate it someone could provide clear guidance of what is being changed and perhaps make it future proof by showing several of the existing lines of code before and after, to help us locate it. Thank you. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/16979. |
@QuotesUK please open a new Issue (and link to this Issue) as Comments on closed Issues didn't get much Notice, thanks. |
I'm having this issue in Joomla 3.9.2. What ultimately fix's the showing up as header in search results? This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/16979. |
You need to update the template override of the template you're using |
Do you have the info/instructions on how to do the override? This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/16979. |
It depends on the template you are using. You can read more about template overrides here https://docs.joomla.org/How_to_override_the_output_from_the_Joomla!_core |
Steps to reproduce the issue
Use search box to find keyword in title
Expected result
yellow highlighted keyword
Actual result
" span class="highlight" keyword /span " (I had to remove <> to be able to show text)
System information (as much as possible)
Joomla updated to 3.7.3
Additional comments
On every Joomla instalation, after upgrade
The text was updated successfully, but these errors were encountered: