Solr Dismax Config for Boost Scoring

2019-06-14 12:33发布

问题:

I've seen many of this topics here but still confusing to implement it. In my case i need to do these:

  1. Search certain phrases in title & text and give title^3, text^1
  2. based on result in #1, i need to boost the results by modified time

i've tried these with different results:

/solr/select
?q={!boost b=$dateboost v=$qq defType=dismax}
&dateboost=recip(ms(NOW/HOUR,modified),86400000,1,1)
&qq=video
&qf=title^3+text
&pf=title^3+text
&debugQuery=true

And Normal Query with different setting in solrconfig.xml

<str name="qf">title^3 text</str>
<str name="pf">title^3 text</str>
<str name="bf">recip(ms(NOW/HOUR,modified),86400000,1,1)</str>

I prefer to have the boost set by default in solrconfig, thanks in advanced.

回答1:

Finally i used the first option, since when using !boost the dismax handler config in solrconfig.xml is being ignored.