Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #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

    #1266482

    Hey 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,
    Rikard

    #1266608

    It 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.
    #1266849

    Hi,

    Thanks for the update. Please try this in Quick CSS:

    span.hilite {
      background: yellow;
    }

    Best regards,
    Rikard

    #1266870

    thanks, 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, jelle

    #1267095

    Hi,

    It’s working on my end, both in the search result pages, and when clicking into a page from the search result.

    Best regards,
    Rikard

    #1267926

    Hello 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/33ec569990af7007f527de73f73a99b50791f14d

    best regards, jelle
    This ticket can be closed now.

    #1267933

    on your first post on this topic you are talking about a plugin – but the fix is for something different ?

    #1268045

    Hello 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.
    #1268346

    Hi jelle,

    Thanks for sharing, it’s much appreciated.

    Best regards,
    Rikard

    #1269682

    yes – 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.

    #1288591

    thank you all, best regards jelle and you can close this ticket

    #1288824

    Hi,

    If you need additioanal help please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘highligt search terms’ is closed to new replies.