Plugin Author
Ajay
(@ajay)
The easiest way to do this is to add a function to your themes functions.php
function bsearch_by_date( $orderby ) {
return ' post_date DESC ';
}
add_filter( 'bsearch_posts_orderby', 'bsearch_by_date' );
This will find the relevant posts but instead of matching by score it will match by date
Thread Starter
Mike H
(@mtnweekly)
thanks for that. However I am still having some major issues with the results. For instance a search for “Never Summer Evo” brings up nothing relevant? Not even the article titled as such:
http://mtnweekly.com/reviews/snowboards/never-summer-evo-review
Plugin Author
Ajay
(@ajay)
It’s likely because Never and Evo won’t be picked up by the fulltext index. Former is a stop word and Evo is 3 char.
Have you tried turning on the Boolean mode?
Thread Starter
Mike H
(@mtnweekly)
Boolean is on. I just turned it off to see if that will help. As for Never – is there a way to add positive words. As “Never Summer” is one of the snowboards brands we review the most through this site.
Plugin Author
Ajay
(@ajay)
Hi, just relooked at the results. There is a bit of an issue in terms of the sorting. If you see the results at http://mtnweekly.com/?s=%22never+summer+review%22 and the relevance specifically, you’ll see the 2017 Never Summer review has 99% relevance
But, it’s currently sorted by date as per the code I gave you above which messes the results up.
Thread Starter
Mike H
(@mtnweekly)
Hmm, any idea how we can make these better? I really would like to use your plugin. My site has over 2k pages. So I have found in the past I needed to use search with weights..
Plugin Author
Ajay
(@ajay)
To be frank, I’m not really sure how to achieve both considering you’re trying to prioritise the best match (i.e. relevance) and the date as well.
One thing worth trying is sorting by score and date:
function bsearch_by_date( $orderby ) {
return ' score DESC, post_date DESC ';
}
add_filter( 'bsearch_posts_orderby', 'bsearch_by_date' );