I am working on Apache solr search. I want to implement boolean search in apache solr search.

On google i found following article and many more articles.

I have also seen the hook_apachesolr_query_alter but i have no idea how to implement the apache solr alter function.

If any one have prior information how to implement it, please guide me to achieve it


Here is a basic example of adding an extra parameter to the search query using the hook_apachesolr_query_alter()

 * Implements hook_altersolr_apachesolr_query_alter().
function mymodule_altersolr_apachesolr_query_alter($query) {
  $query->addParam('fq', 'my_field:(value)');

Check this page for more possibilities on altering the search query: http://drupalcontrib.org/api/drupal/contributions%21apachesolr%21apachesolr.interface.inc/interface/DrupalSolrQueryInterface/7

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.