Exact Single Word Search not showing first
-
We have a list of part numbers as a custom post type set by Toolset, “Parts” the title of the posts are the part numbers. If someone is searching for part number “210” the actual post titled “210” shows up at number 20 in the results.
We have tried adjusted the keyword matching options, exact matching, as well as implementing this code below:
add_filter( ‘relevanssi_match’, ‘rlv_prefer_whole_words’, 10, 3 );
function rlv_prefer_whole_words( $match, $idf, $term ) {
if ( $match->term === $term ) {
$match->weight *= 1000;
}
return $match;
}
We still can’t get the actual post titled “210” to show up first. Here is what all posts are showing as their relevance score:
MXP-210-00 part (Edit part)
Smoke Goggles
Score: 2402.1338-108-210-0 part (Edit part)
BLADE
Score: 2402.1Then here is the post we are wanting to show first followed by all the others:
210 part (Edit part)
CONNECTOR SMA, PLUG
Score: 2402.1Same score.
Any thoughts or help on how we can get exact matches first followed by those with it in the title or body content?
Thanks!
- The topic ‘Exact Single Word Search not showing first’ is closed to new replies.