Drupal 7 apache solr custom query [apache_solr_drupal_query()]

 * custom SOLR search function.
function search_SOLR($keyword) {
  $solr = apachesolr_get_solr();
  $query = apachesolr_drupal_query("custom", array('q' => $keyword));
  $query->addParam('rows', '1000'); // How many rows of result to display default it is 10.
  $query->addFilter('bundle', (event OR city OR company));
  $query->addParam('fq', "bundle:(event OR city OR company)");
  $resp = $query->search();
   // Only search in title
  $query->replaceParam('qf', 'label');
  $resp_ = $query->search();


  1. I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in TECHNOLOGY , kindly Contact MaxMunus
    MaxMunus Offer World Class Virtual Instructor led training on TECHNOLOGY. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 1,00,000 + trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
    For Demo Contact us.
    Saurabh srivastava
    E-mail: saurabh@maxmunus.com
    Skype id: saurabhmaxmunus


Post a Comment

Popular Posts