0

I've installed apachesolr,search api solr and views. I have only indexed article and basic page content type.

Then i've added new field "internal use only" as checkbox for article content type. I want to add filter "internal use only" only in article content type. I want to show except those articles.

How to alter apache query?

0

Check apachesolr.api >> hook_apachesolr_query_alter

function hook_apachesolr_query_alter(DrupalSolrQueryInterface $query) {
  // I only want to see articles by the admin.
  //
  // NOTE: this "is_uid" filter does NOT refer to the English word "is"
  // It is a combination of flags representing Integer-Single, which is
  // abbreviated with the letters i and s.
  //
  // @see the <dynamicField> definitions in schema.xml or schema-solr3.xml
  $query->addFilter("is_uid", 1);

  // Only search titles.
  $query->replaceParam('qf', 'label');
}

More details about solr query DrupalSolrQueryInterface

  • How to do this? – Guru Oct 5 '15 at 9:52

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.