• Resolved treeflips

    (@treeflips)


    Hi, I’m a legacy lifetime user.

    How do I limit the number of times a post item can show up in the search? For some reason, the recent update is making one post show up 20 times ahead of other relevant posts.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Relevanssi by itself never returns a post more than once per search. If you’re seeing the same post many times in the search, something else is interfering with the search.

    What kind of custom filters are you using?

    Thread Starter treeflips

    (@treeflips)

    Where can I check these?

    Plugin Author Mikko Saari

    (@msaari)

    They’re in your theme functions.php most likely, but if you don’t know about them, you probably haven’t added any.

    Have you tried disabling other plugins? Perhaps some plugin is confusing Relevanssi somehow.

    Anything special about the post that gets repeated?

    Plugin Author Mikko Saari

    (@msaari)

    Ah, it’s not the same post repeated: it’s different posts, but the title from the first post is repeated for every post.

    So what’s in your search results template? Sounds like this might be a problem with the template.

    Thread Starter treeflips

    (@treeflips)

    This look correct to you?

    /**
    * Modify entry title text.
    *
    * Use Relevanssi function.
    *
    * @since 0.1.6
    * @access public
    * @param string $title The existing entry title.
    * @return string $title The modified entry title.
    */
    add_filter( ‘genesis_post_title_text’, function( $title ) {
    if ( is_search() && function_exists( ‘relevanssi_get_the_title’ ) ) {
    $title = relevanssi_get_the_title( $post_id );
    }
    return $title;
    });

    /**
    * Modify entry content output.
    *
    * @since 0.1.6
    * @access public
    * @return string.
    */
    add_filter( ‘genesis_pre_get_option_content_archive’, function() {
    if ( is_search() && function_exists( ‘relevanssi_get_the_title’ ) ) {
    return ‘excerpts’;
    }
    });

    Plugin Author Mikko Saari

    (@msaari)

    No, it’s not correct: you’re using $title = relevanssi_get_the_title( $post_id );, but $post_id is not defined anywhere. Instead of $title = relevanssi_get_the_title( $post_id );, do this:

    global $post;
    $title = relevanssi_get_the_title( $post->ID );
    Thread Starter treeflips

    (@treeflips)

    That did it! Thanks again, Mikko. Incredibly efficient help!

    Hope all is well with you. I’ve been on Relevanssi for nearly 10 years now, I think.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘reduce # of search instances’ is closed to new replies.