4

I am using search api with the solr backend to index thousands of nodes. All of them have votes (vote api). Now I am wondering how to boost the relevance of these notes by their vote. I don't want to sort the result completely by votes (this would be easy), but that the votes boost the node's relevance for a certain percentage. Is that possible? How to do this?

1

Do you have the voting api results in your apache solr index? If you do and they are stored under a name ss_votingapi, here is what you need to do:

/*
 * Implements hook_apachesolr_query_alter().
 */
function MYMODULE_apachesolr_query_alter($query) {
  $query->addParam('fl', 'ss_votingapi');
  $query->addParam('bf', "recip(rord(ss_votingapi),1, 1000, 1000)");
}

More here, here and here

1
  • My problem is, that I do not use Apachesolr module but Search API with Solr extension. Does anybody know what would be the equivalent of $query->addParam for Search API? Can't find it.
    – user5950
    Feb 17 '13 at 17:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.