WordPress.org

Forums

Relevanssi - A Better Search
[resolved] Inconsistent Search Result Highlighting (9 posts)

  1. Jackson
    Member
    Posted 2 years ago #

    Using search result highlighting, I am getting inconsistent results.

    Some posts return a modified excerpt, without any highlighting. Some posts return simply ellipses.

    Example, a search for 'downtown' returns this excerpt,

    by PCJ Editor Wayne Senville, reporting from Niles, Michigan Part of Main Street in Niles, Michigan (click on photo to view at larger size). Lisa Croteau It was raining hard when…

    For this article, http://plannersweb.com/2009/06/a-main-street-succeeds-in-tough-times/ which has the word 'downtown' in it's content 36 times.

    Then some articles have an excerpt of nothing more than

    ...

    Example, this article - http://plannersweb.com/2005/04/sizing-up-downtown/ with the word 'downtown' in it's content 17 times.

    And important to note, on the same results page, this article: http://plannersweb.com/2012/10/human-squirrels/

    Shows a properly highlighted excerpt:

    Fort Andross in Brunswick, Maine. All photos in this post by Wayne Senville unless otherwise noted. Brunswick, Maine (population just over 20,000) has a wonderful downtown — stretching about ten blocks between…

    Any ideas?

    Thanks Mikko!

    PS - I've turned the highlighting off on the live site until I can resolve this.

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

  2. Mikko Saari
    Member
    Plugin Author

    Posted 2 years ago #

    There's a bug in the current version. If you want a quick fix, check lib/excerpts-highligths.php, find the two occurrances of usort() and change both to uasort(), with the same parameters. That should fix at least part of this.

    Do that, and tell me how much that fixes and we can continue from there.

  3. Jackson
    Member
    Posted 2 years ago #

    Worked for me. Many thanks!

  4. AJ
    Member
    Posted 2 years ago #

    Ahh thank you! This fixed my issue as well. Relevanssi was not creating custom excerpts & snippets around the search terms. It created the right length of excerpt, identified the matches, and highlighted them, if they were in the visible part of the excerpt, but did not create custom excerpts using the search terms until I implemented your quick fix. I have my template set like this:

    <?php /* Start the Loop */ ?>
       <?php while ( have_posts() ) : the_post(); ?>
       <h3><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" rel="bookmark"><?php the_title(); ?></a>
       </h3>
       <?php if (function_exists('relevanssi_the_excerpt')) { relevanssi_the_excerpt(); }; ?>
        <a href="<?php echo get_permalink(); ?>"> View the full page.</a>
        <?php endwhile; ?>

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

    Great plugin by the way. Thanks for the help.

  5. ps3hero
    Member
    Posted 2 years ago #

    this doesn't fix it for me. v. 3.1.6

  6. Mikko Saari
    Member
    Plugin Author

    Posted 2 years ago #

    Ps3hero, based on the other thread, your problem is different and the solution is here.

  7. ps3hero
    Member
    Posted 2 years ago #

    @mikko: take a look at this: http://www.commwork.de/kunden/wigy/gremien/kollegium/

    and now search (top right) for the word "Schumacher" (this is a name). now you have this:

    http://www.commwork.de/kunden/wigy/?s=Schumacher

    with 4 results. the top result doesn't show the word because it's in a custom field and at the nearly bottom of the page. is it possible to show the word "Schumacher" in the search result excerpt?

  8. Mikko Saari
    Member
    Plugin Author

    Posted 2 years ago #

    Yes, and the answer is still in the other thread.

  9. ps3hero
    Member
    Posted 2 years ago #

    got it working now, thank you very much!!!!!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Relevanssi - A Better Search
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags