' . t('About') . ''; $output .= '
' . t('Search Api Materio module') . '
'; return $output; default: } } /** * Implements hook_search_api_solr_query_alter(); */ function materio_sapi_search_api_solr_query_alter(Query $solarium_query, QueryInterface $query) { if ($termid = (int)$query->getOption('termid')) { // get solarium fileds name $index = $query->getIndex(); $solrFields = $index->getServerInstance() ->getBackend() ->getSolrFieldNames($index); // tag_tid"itm_tag_tid" // thesaurus_tid"itm_thesaurus_tid" $tag_fname = $solrFields['tag_tid']; $thes_fname = $solrFields['thesaurus_tid']; // $solarium_query->addParam('bf', "recip(abs(ms(NOW,{$solrField})),3.16e-11,10,0.1)"); // $bfparam = "if(or(gt(termfreq({$tag_fname},{$termid}),0),gt(termfreq({$thes_fname},{$termid}),0)),^21,0)"; $bfparam = "if(or(exists(query({$tag_fname}:{$termid})),exists(query({$thes_fname}:{$termid}))),^21,0)"; // boost=if(or(exists(query(itm_tag_tid:396)),exists(query(itm_thesaurus_tid:396))),^21,0 ) $solarium_query->addParam('boost', $bfparam); // $solarium_query->addParam('debugQuery', 'on'); } }