Skip to main contentSkip to footer

Relevanssi stores the relevance score it uses to sort results in the $post variable. Just add something like

<?php echo "Score: $post->relevance_score"; ?>

to your search results template to display the relevance score.

Your account

Not logged in. Log in to see your license details.

Search

Popular Resources

WP Download Manager

MIME type. These all need to be changed, because the WP Download Manager posts have the post type wpdmpro, status of publish and no MIME type. The necessary filter function looks like this: add_filter( ‘relevanssi_get_attachment_posts_query’, ‘rlv_wpdmpro_query’ ); function rlv_wpdmpro_query( $query ) { return str_replace( “post_type = ‘attachment’ AND post_status =…

Blocking pre and code tags
If your posts have lots of programming code examples in <pre> and <code> tags, those might look pretty bad in…
Index only short numbers
Relevanssi has a minimum word length setting that is set to three characters. Any one- or two-letter words are not…

Related Posts:

Comment Section:

4 Comments. Leave new

  • We’re testing this plugin for use on our site and seems to be working great. HOWEVER. we’ve tested the results and it seems that if the search term is matched in the content 1 or 1000 times it still ranks it with the same weight?

    if this is the case how can we change this so that it would rank a page higher if it has 5 hits for that term over 1?

    We’re only really searching on page title and content, we’re not using tags or categories, so we really need to use the number of times the search term is in the content to help pull more relevant results up the results page.

    thanks in advance.

    Reply
  • What if $post->relevance_score is blank or does not exist?
    var_dump($post) does not show that field

    any ideas?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed