Is it possible to boost boolean fields in Solr so that they receive a higher score?
We\'ve got an index which looks a bit like this:
Here is the solution for those who're using Drupal CMS.
First, find your field name in Schema Browser at /solr/admin/schema.jsp
Then, depending on the module which you use, try the following examples:
Code example:
/**
* Implements hook_apachesolr_query_alter().
*/
function hook_apachesolr_query_alter(DrupalSolrQueryInterface $query) {
$query->addParam('bq', array('is_review' =>
'(is_review:true^100 OR is_review:false^0)'
));
}
Code example:
/**
* Implements hook_search_api_solr_query_alter().
*/
function hook_search_api_solr_query_alter(&$call_args, SearchApiQueryInterface $query) {
$call_args['params']['bq'][] = '(is_review:true^100 OR is_review:false^0)';
}