WordPress.org

Ready to get started?Download WordPress

Forums

Relevanssi - A Better Search
Bug with highlighting (6 posts)

  1. justin_k
    Member
    Posted 1 year ago #

    Hey Mikko,

    Just wanted to mention I think I found a bug with highlighting; not exactly sure the cause, but it's very easy to reproduce if you'd like to have a look:

    ->visit my site (http://www.justin-klein.com)
    ->search for "justin-klein.com 2.0" (the search box is at the upper right)
    ->view the first result (the post is called "Justin-Klein.com 2.0").

    You'll notice that it's highlighting a bunch of "2"'s in the content, that aren't actually there; I'm thinking it has something to do with htmlentities or the like. For instance, wherever there should be an apostrophe, it shows "217;", with the "2" highlighted.

    Just an FYI :)

    http://wordpress.org/extend/plugins/relevanssi/

  2. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

    Yeah, I know... There's a bit of a bug with this, and there's actually a solution for it in the code, commented out, because when somebody else tried it, the solution was worse than the problem.

    If you want to try it, go to lib/excerpts-highlights.php and uncomment these blocks of code:

    $highlight = get_option('relevanssi_highlight');
    	if ("none" != $highlight) {
    		if (!is_admin()) {
    			$content = html_entity_decode($content, ENT_QUOTES, 'UTF-8');
    			// html_entity_decode to avoid highlighting from breaking HTML entities
    		}
    	}

    (line 115, in relevanssi_create_excerpt())

    $excerpt = htmlentities($excerpt, ENT_QUOTES, 'UTF-8');
    	// return the HTML entities that were stripped before

    (line 359, in relevanssi_highlight_terms())

    Does that help?

  3. justin_k
    Member
    Posted 1 year ago #

    Whoa - that TOTALLY messed up the content :P Now the content is just html.

  4. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

    Well, yeah, that's what the other guy said as well =) It did work on my site...

    Since that's my best attempt so far to solve this problem, there's little else I can do right now. This is something that needs to be fixed at some point, but at the moment I don't have a solution.

  5. justin_k
    Member
    Posted 1 year ago #

    OK...not critical for me either, but I just thought you'd like to know about it as it can be *very* visible in some cases.

    Until you can come up with a permanent solution, perhaps you might just not allow numbers to be searched for, or maybe if it's a number & strlen(numberAsStr) < someThreshold...

  6. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

    Well, if I do that, somebody is going to complain about it... But maybe I can add that limitation to highlighting. I'll have to see.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.