You are here

function nodequeue_apachesolr_query_alter in Nodequeue 7.3

Same name and namespace in other branches
  1. 7.2 nodequeue.module \nodequeue_apachesolr_query_alter()

Implements hook_apachesolr_query_alter().

File

./nodequeue.module, line 413
Maintains queues of nodes in arbitrary order.

Code

function nodequeue_apachesolr_query_alter(DrupalSolrQueryInterface $query) {
  $queues = nodequeue_load_subqueues_by_queue(array_keys(nodequeue_get_all_queues()));
  $added = FALSE;
  foreach ($queues as $sqid => $queue) {
    $boost = variable_get("nodequeue_apachesolr_boost_{$sqid}", 0);
    if (!empty($boost)) {
      $query->params['bq'][] = _nodequeue_solr_name_key() . ":{$sqid}^{$boost}";
      if (!$added) {

        // Only want to add the facet.field once. no need to repeat it.
        $query->params['facet.field'][] = _nodequeue_solr_name_key();
        $added = TRUE;
      }
    }
  }
}