From: Mark N. <mn...@tu...> - 2010-06-26 19:22:11
|
Thanks for the help Till. That suggestion also helped me to get fix another problem I was having. I was having trouble getting multiple boosts to work without having the boost query filter the results. However, combining them with an or statement seems to work. I think I have this working now although there is probably a better way of doing this. Here is what I'm adding to the query in the search method: //Apply automatic boosting (only to biblio queries) if (preg_match('/.*biblio.*/', $this->host)){ if (isset($options['qt']) && $options['qt'] == 'dismax'){ //Boost by number of holdings $options['bq'] = '_val_:"scale(num_holdings,1,200)"^4'; //Boost english items $options['bq'] = $options['bq'] . ' OR language:"English"^300'; //Boost books and DVDS $options['bq'] = $options['bq'] . ' OR format:"DVD"^200'; $options['bq'] = $options['bq'] . ' OR format:"Book"^200'; }else{ $options['q'] = $options['q'] . ' || _val_:"scale(num_holdings,1,200)"^2'; $options['q'] = $options['q'] . ' || language:"English"^300'; $options['q'] = $options['q'] . ' || language:"DVD"^200'; $options['q'] = $options['q'] . ' || language:"Book"^200'; } } That does seem to be working and I can definitely see that the correct records are moving to the top of the results. If there is a better way to handle this let me know. I would also like to be able to combine the format boosting into a single query, but I haven't gotten that to work correctly yet. Thanks for your help! - Mark Noble On 6/26/2010 5:07 AM, Till Kinstler wrote: > First: bf abd bq are only available in the DisMax handler. To boost > search results depending on (static) fields values with the standard > handler we add additional ORed clauses (though that doesn't work for bf > type queries, you can use a FunctionQuery for that: > http://wiki.apache.org/solr/FunctionQuery)... > If the DisMax is not defined as your default query handler (it is not in > VuFind's standard Solr config), try adding the parameter qt=dismax to > the query URL. > num_holdings contains a numeric value and is defined as some kind of > numeric field type (though I'm not sure, if the latter is necessary)? > > Till > > Am 26.06.2010 02:58, schrieb Mark Noble: > >> We have added the total number of holdings to our Solr index and now I'm >> trying to boost records with higher numbers of holdings in the result. >> >> The documentation that I have found online states that you can add the >> bf or bq parameters to the query to boost fields at runtime. To test >> this, I'm just calling solr via a URL with a URL similar to the following: >> http://localhost:8080/solr/biblio/select/?q=*:*&bf=num_holdings^1000&fl=title,num_holdings,score&debugQuery=on >> >> When I do this, my scores all come back as 1.0 and the titles seem to be >> in random order. Can anyone point me in the right direction to have the >> boost apply correctly? >> >> If I can get this to work properly, I would also like to boost titles >> which are owned by the local library when I have a preferred branch or >> when I'm in the library. >> >> Thanks for your help! >> >> - Mark Noble >> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by Sprint >> What will you do first with EVO, the first 4G phone? >> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first >> _______________________________________________ >> Vufind-tech mailing list >> Vuf...@li... >> https://lists.sourceforge.net/lists/listinfo/vufind-tech >> > > |