-
AuthorPosts
-
December 10, 2020 at 3:33 pm #1266312
hello, is there a way to highlight search terms on the page?
ive seen this plugin ( https://nl.wordpress.org/plugins/highlight-search-terms/ )
but ive also read this:
When search engine referrer is using SSL (notice the https:// in the URL) then the search terms cannot be determined. Most search engines are always over SSL nowadays. There is no way to get around that issue.
so, its out of the question, i guess…?best regards, jelle
December 11, 2020 at 9:24 am #1266482Hey jelle,
I’m not sure if that would be possible or not, but there’s nothing like that in the theme by default, and creating it would be out of scope of theme support. The plugin you linked to might work though.
Best regards,
RikardDecember 11, 2020 at 6:23 pm #1266608It works now Rikard, but like half.
in the excperts there is no problem, but in the content there is.as an example im using the word “tuin” to search on.
sometimes it highlights, sometimes it doesnt. The same for a search term like
“klik hier”.
But another term like “zaden” is highlighting everywhere.the maker of the plugin said:
Like it says in the setting: Relevanssi should add the highlight parameter automatically. No changes should be necessary in your templates.
Something else is adding a hilite parameter in your search results; whatever that is may be overriding Relevanssi.could be something is overwriting it, but why only every now and then.
quite peculiar…isnt it?- This reply was modified 3 years, 11 months ago by yampieters.
December 13, 2020 at 4:28 am #1266849Hi,
Thanks for the update. Please try this in Quick CSS:
span.hilite { background: yellow; }
Best regards,
RikardDecember 13, 2020 at 6:12 am #1266870thanks, rikard,
ive tried it, but it makes not so much difference.
see image, it even might have something to do with loose words.
(once in a sentence the word IS highlighted).
anyway, ill leave it for now; you can close this ticket.
best regards, jelleDecember 14, 2020 at 12:22 pm #1267095Hi,
It’s working on my end, both in the search result pages, and when clicking into a page from the search result.
Best regards,
RikardDecember 16, 2020 at 8:00 pm #1267926Hello Rikard, yes, it was working, but sometimes loose search words were not highlightened. Like “tuin tuin tuin”, none was highlightened.
i had contact with the maker and he wrote:
I tried reproducing this problem on my test site, and I can indeed reproduce it – when I recreate your test posts, they behave the same way on my site. I’ll investigate this next week and will get back to you.In general I don’t recommend using the highlight in documents feature in the first place; it’s prone to problems, for various reasons, and it may cause conflicts with other plugins. I haven’t really figured out a really good way to do it.
and later:
Ok, I figured this out. The problem here is that the highlighting does not work for words that come after a HTML tag.
That wasn’t noticed before, because I’ve only tested this on strings that don’t have any HTML tags in them (because that’s usually how excerpts are). That’s why the highlighting sometimes works and sometimes doesn’t, even with the same words.I’ve fixed this, and in the next version this will work. Meanwhile you can keep using the feature if it’s necessary (I still think it’s an overrated feature, browser in-page search is pretty much always better) and if it doesn’t cause problems with other plugins you’re using, it just won’t always highlight everything. In the next version it will be more reliable, but even then it probably won’t always work 100 %.
just in case, here is the fix:
https://github.com/msaari/relevanssi/commit/33ec569990af7007f527de73f73a99b50791f14dbest regards, jelle
This ticket can be closed now.December 16, 2020 at 8:27 pm #1267933on your first post on this topic you are talking about a plugin – but the fix is for something different ?
December 17, 2020 at 9:34 am #1268045Hello Guenni007, well, im not a programmer, but as far i know its a fix for the plugin.
In fact, ive just made, via filezilla, the necessary changes in the document he told me, and it works.
There is this file: lib/excerpts-highlights.php
which contained:/** * The method here leaves extra spaces inside the highlighting. That * is cleaned away here. */ $replace_regex = '/(.)(' . preg_quote( $start_emp_token, '/' ) . ')(\s)/iu'; $content = preg_replace( $replace_regex, '\1\3\2', $content );
which i ve replaced by
/** $replace_regex = '/(.)(' . preg_quote( $start_emp_token, '/' ) . ')(\s)/iu'; $replace_regex = '/(.)(' . preg_quote( $start_emp_token, '/' ) . ')(>|\s)/iu'; $content = preg_replace( $replace_regex, '\1\3\2', $content );
best regards, jelle
ps: this is the plugin: Relevanssi – A Better Search- This reply was modified 3 years, 11 months ago by yampieters.
December 18, 2020 at 7:31 am #1268346December 23, 2020 at 11:16 pm #1269682yes – but on top you are talking about “highlite search terms” – the fix is not for that plugin.
You are now talking about Relevansi. – and I just wanted to clarify that with my comment.
the excerpts-highlights.php is not existent on first plugin.March 16, 2021 at 6:31 pm #1288591thank you all, best regards jelle and you can close this ticket
March 18, 2021 at 2:13 am #1288824Hi,
If you need additioanal help please let us know here in the forums.
Best regards,
Jordan Shannon -
AuthorPosts
- The topic ‘highligt search terms’ is closed to new replies.