search - Solr relevancy & boosting best approach -


scenario boost documents on multiple field values:

i have field "category" containing values - "news", "image", "video", "audio".

now on basis of fields values mentioned above give boosting(priority) them, example "news" gets highest priority, followed "video", "audio" , on.

similar category there few more fields, needed boosted in same manner based on fields values.

ex. boosting rules can be,

category=  news^1000 category=  image^900 premium_contents = true^200 sponsored = true^300 

... on

so have came across solution reference. trying find out best approach calculating search relevancy result-sets.

yes think link reasonable idea. use because want enforce boosts on searches , don't change logic often, example in case:-

<requesthandler name="/select" class="solr.searchhandler">     <lst name="defaults">         <str name="deftype">edismax</str>         <str name="boost">product(                     map(query($type1query),0,0,1,$type1boost),                     map(query($type2query),0,0,1,$type2boost))</str>             <str name="type1query">category:"news"</str>             <double name="type1boost">1000.0</double>             <str name="type2query">category:"image"</str>             <double name="type2boost">900.0</double>     </lst> </requesthandler> 

in case query function returns score specific query. looking match news, image etc in category.

the map function has following signature: map(x,min,max,target,value) maps values of function x fall within min , max inclusive target. min,max,target,value constants. outputs field's value (or "value") if not fall between min , max. in other words if result of query positive value (there match) output boost (1000,900 etc). you'll need play boost values can overwhelm other ranking logic have. may poor matches on news ranking first there better match on video, say.

you create separate request handler these boosts can bypass them other searches. have change solrconfig , restart solr if make changes, may issue.

otherwise @ bq (boost query) parameter.

bq=category:news^1000.0+category:image^900... 

which generates under covers

boost(+*:* (category:news^1000 + category:image^900)) 

this means boosts done in search code nice , flexible. prefer way of working.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -