1. apachesolr
    1. 7
7 hook_apachesolr_query_prepare($query)

Prepare the query by adding parameters, sorts, etc.

This hook is invoked before the query is cached. The cached query is used after the search such as for building facet and sort blocks, so parameters added during this hook may be visible to end users.

This is otherwise the same as HOOK_apachesolr_query_alter(), but runs before it.


$query An object implementing DrupalSolrQueryInterface. No need for &.


./apachesolr.api.php, line 19

function hook_apachesolr_query_prepare($query) {
  // Add a sort on the node ID.
  $query->setAvailableSort('entity_id', array(
    'title' => t('Node ID'), 
    'default' => 'asc',