Support » Plugin: Relevanssi - A Better Search » Specifying Weight For Individual Pages?

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


    Using relevanssi_hits_filter filter is the best way – the filter has two parameters: the results and the query. If the query is ‘toast’, you can make sure the post 1002 is first in the results.

    Hi Mikko,

    I’m a bit surprised. I thought I’d want to use something like this:

    add_filter('relevanssi_match', 'custom_tag_weights');
    // force a given post ID to top
    if($match->doc == 3246)
      $match->weight = $match->weight * 10;

    …what’s the difference? Or rather, why is relevanssi_hits_filter a better solution?



    Plugin Author Mikko Saari


    That is a good way, too, but adjusting the weights is just a suggestion, while relevanssi_hits_filter lets you modify the order exactly. Of course, if you give enough extra weight, the post will come on top, but with relevanssi_hits_filter, you can place it first, period.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Specifying Weight For Individual Pages?’ is closed to new replies.