-->

Solr date boost and sort by relevant results NOT w

2019-06-03 14:35发布

问题:

I am implementing Solr dismax search and also using this function recip(ms(NOW,PubDate),3.16e-11,1000,1000) for date boost. Everthing is working fine but only got one problem.

if search keywords are repeated in the Title, they get more score than recent results.

e.g. 1) Title = solr lucene

Date = 1 day old

2) Title = solr lucene is best, love solr lucene

Date = 15 days old

If user searched for 'solr lucene', then #2 comes at first position only because keywords are repeated in the Title.

I have got too many records which are1,2 or 3 days old and they have even the exact same title "SOLR LUCENE" but those records doesn't come on first page only because old records have keywords repeated in the Title.

I don't want to sort the results entirely by date. Currently i am sorting it like this. sort= score desc, date asc

回答1:

You shouldn't use an order clause, if you are using boost. If you like to give the date more relevance, so pimp your boost function. It's up to you, who big is the date influence for the order of the search result is.

It also depends on the dismax-handler you are using:

{!edismax boost=recip(pow(ms(NOW,PubDate),<val>),3.16e-11,1,1)}

Put an value instead of the <val> placeholder between 0 and 2, where 0 is nearly "order by date" and 2 is order by relevance.

Not sure, if this works for dismax, but it works for standard solr search handler (with other syntax than the example above) and edismax.