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

    (@msaari)

    If you don’t use relevance sorting, don’t use Relevanssi Light. That’s literally the only reason you would use Relevanssi Light. There’s no benefit of using Relevanssi Light if you sort the results by post date. If you want both, unhook Relevanssi Light from the search if the results are sorted by something else than relevancy.

    Thread Starter Kresimir Pendic

    (@gorostas)

    Hi @msaari – thank you for fast reply.. sorry for me not sharing it initially – but I enabled Relevanssi plugin because when I did tests with it – I got much better and faster results back then with native WP search.. I think that was like year ago – not sure.. so I did keep plugin activated becase I think it did made database changes also or way it index articles (my client site has masive number of articles so that speed comparison was really huge) .. So now – I’m not sure when you say to remove it.. do you think that I will not loose speed with it? Thanks, Kresimir

    Plugin Author Mikko Saari

    (@msaari)

    Yes, you’ll likely lose speed. Relevanssi Light is much faster than the default WP search and the difference is more pronounced the bigger the site is. So yes, you’ll lose the speed.

    But still, what Relevanssi Light does is to enable the better relevancy sorting feature in your database, nothing else. That’s why you can’t use it to order posts by date. It’s a one-trick pony, but the trick is really good.

    Thread Starter Kresimir Pendic

    (@gorostas)

    Hey Mikko – thanks for reply .. I was hoping that would not be the case – so I could use both – to keep the plugin for speed gains plus fit orders by date for my client..

    But what do you think, I’ve tried to add simple orderby hook and it looks to me that this works now on quick testing .. do you think that is ok usecase or you think there could be some issues maybe.. thank you, Kres

    /*
    hook into the Relevassi light plugin and order after 10 priority
    */
    add_filter( 'posts_search_orderby', function( $orderby, $query ){
    if ( isset( $query->query['s'] ) ) {
    $orderby = 'post_date DESC';
    }
    return $orderby;
    }, 11, 2 );
    Plugin Author Mikko Saari

    (@msaari)

    I checked the same, but the MySQL query still said “ORDER BY relevance DESC, post_date DESC”, so that suggests it’s first sorting by relevance and then by post date. But if it works, that’s great!

    Thread Starter Kresimir Pendic

    (@gorostas)

    Dear @msaari, thank you for support and help – great plugin!

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.