• Resolved Rafael Fischmann

    (@rfischmann)


    Hello!

    I have Relevanssi set to order search results by Relevance, not Post’s Date.

    However, I’ve noticed that, after it orders by relevance, all the posts that are shown in results (with the same relevance, let’s say) are in reverse order by date (from oldest to newest), and I wanted to invert that: https://d.pr/i/pM7I1I — screenshot of a search from inside WordPress’ Admin, by the way.

    Is that possible, please?

    Thanks a lot!

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

    (@msaari)

    Relevanssi supports multilevel orderby parameters:

    add_filter( 'relevanssi_modify_wp_query', function( $query ) {
      $query->set( 'orderby', array( 'relevance' => 'desc', 'post_date' => 'asc' ) );
      return $query;
    } );
    Thread Starter Rafael Fischmann

    (@rfischmann)

    Perfect!! Thank you very much. ??

    Maybe that should be a good thing to be able to configure via the plugin’s settings? Just a suggestion. ??

    Plugin Author Mikko Saari

    (@msaari)

    It’s very unusual to have lots of high-ranking posts with the same relevancy score, so the secondary ranking doesn’t come into play often enough to make it a useful plugin setting.

    Thread Starter Rafael Fischmann

    (@rfischmann)

    Understood. Thank you again!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Reverse order by date?’ is closed to new replies.