'Drupal 7 Apachesolr: hook_apachesolr_query_prepare() not being called?
I've been struggling with this for a few hours now. I've tried everything I can think of but can't seem to get the hook hook_apachesolr_query_prepare() to fire. Here is the code I'm calling in my template.php file:
/**
* Implements hook_apachesolr_query_prepare().
*/
function pz_apachesolr_query_prepare(DrupalSolrQueryInterface $query) {
echo "Query Prepare Test";
$query->setAvailableSort('entity_id', array(
'title' => t('Node ID'),
'default' => 'asc',
));
$query->setAvailableSort('ds_changed', array(
'title' => t('Changed Date'),
'default' => 'asc',
));
}
hook_apachesolr_query_alter() works fine, but I don't think I can add sort options (which is my ultimate goal here).
I've tried:
- Completely clearing and reindexing the site
- Flushing all caches multiple times
- Commenting out cache in the solrconfig.xml files
- Disabling and re-enabling search modules
I'm on Drupal 7 using Apachesolr 7.x-1.7.
I'm sure it's something simple I'm missing
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|