• Resolved mongobongo

    (@nima1981)


    I’m using WP 6.0 and the latest version of Relevanssi. My PHP version is 8.1.2

    When I search for the phrase “supreme court” ordered by date descending at the moment not a single one of today’s article’s (June 23 2022) containing that phrase shows up:

    https://dissentwatch.com/find/supreme+court?orderby=post_date&order=desc

    However when I search for the term “scotus” ordered by date descending a few posts from today are showing up, including posts that contain the exact phrase “supreme court”. See for example https://dissentwatch.com/find/scotus?orderby=post_date&order=desc, the 6th result down with the title “In Historic Win For Gun Rights, SCOTUS Rules NY Draconian Restrictions Are Unconstitutional” which begins as follows:

    “In Historic Win For Gun Rights, SCOTUS Rules NY Draconian Restrictions Are Unconstitutional The U.S. Supreme Court on Thursday morning struck down a New York state gun law that made…” written by ZeroHedge – Jun 23rd 2022 10:49am EDT

    Why does that article not show up under the first search link?

    Here’s the search.php code: https://pastebin.com/Az6h5gDX

    The page I need help with: [log in to see the link]

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

    (@msaari)

    The Relevanssi throttle cuts it off. Searching for “supreme court” finds over 500 results, and Relevanssi keeps the most relevant posts. Unfortunately, the most recent post gets cut off. The throttle is designed for showing the most relevant posts first and doesn’t have a separate setting for showing the most recent results.

    Add this to your theme functions.php:

    add_filter( 'relevanssi_query_filter', function( $query ) {
        global $wp_query;
        if ( isset( $wp_query->query_vars['orderby'] ) && 'post_date' === $wp_query->query_vars['orderby'] ) {
            $query = str_replace( 'ORDER BY tf', 'ORDER BY relevanssi.doc', $query );
        }
        return $query;
    }, 11 );

    This should get you the most recent posts first.

    Thread Starter mongobongo

    (@nima1981)

    That fixed it, thank you so much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Post with exact match is completely omitted’ is closed to new replies.