I try to create a custom search link like this :

l(t('See our Job Ads'), 'search', array('query' => array('f[0]' => 'is_recruiter_nid:' . $nid )));

when i click on the link nothing get filtered. P.S : i have added the filter 'is_recruiter_nid' in code using the hook_search_api_solr_documents_alter() Something like:

function MYMODULE_search_api_solr_documents_alter(array &$documents, SearchApiIndex $index, array $items) {
  foreach ($documents as $document) {
     $document->setField('is_recruiter_nid', $recruiter->nid);    

How I can do this? Is there any example ?

Thanks for your help.

1 Answer 1


f[0] param doesn't work directly. To allow ApacheSolr to filter results based on custom fields you will need to define them as facet (checkout FacetAPI module) or you can implement hook_apachesolr_query_alter and add your own filters in it.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.