简体   繁体   中英

Solr: boosting by date not returning in right order, is something wrong with my boost?

I'm using Solr to search for events, and I need events to be boosted by date so that the closer and event is to the current date, the higher its score will be compared to an event with say the same name but a later date. So, "Alumni Reunion" in January 2015 should show up higher on the list of results than "Alumni Reunion" in October 2015.

I read the Solr Relevancy FAQ, and this is the query I'm using in solr:

?q={!boost%20b=recip(abs(ms(NOW,dt_startdate)),3.16e-11,1,1)}searchterms&sort=score desc

It definitely changes the order of the results, but the order is wrong. For example, one of my searches that gives me back four results is returning them as 2012, 2013, 2014, 2015 when it should be the opposite (April 2015 vs. April 2014, 2015 should show up first). I tried simply changing it to

sort=score asc

but rather than returning in the opposite order as I'd expect, the order was totally different; it went 2014, 2015, 2012, 2013

What is wrong with my boost? I believe that without the boost, the relevancy should be the same for all of them, because the field that contains the terms I'm searching for is exactly the same for each. The order was actually better before I put the boost in; while it wasn't correct, it went 2014, 2015, 2013, 2012 which was closer than it is now.

EDIT: I realize that the boost won't necessarily put it in date order, which is fine, but something from 9 months ago should certainly show up before something from 2012, especially since without the boost, the 2014 event was at the top of the list. Right now 2012 is showing up first.

EDIT 2 (important) : Ok, so I decided to check what the scores were on my four events, with and without the boost.

2012: 0.37118697 boost: 0.005060354

2013: 0.4639837 boost: 0.005060354

2014: 0.55678046 boost: 0.0044278097

2015: 0.4639837 boost: 0.0044278097

So you can see that the boost is actually making the newer onces worse than the older ones. Why is it doing this? I don't really understand the equation that the boost is doing, so I don't know why it's making the scores worse.

Sounds like you just want to order the search based on date, and not use a boost - a boost is meant to trend newer documents higher, not have them in a descending / ascending order.

The example given for boosts will apply a varying boost for documents newer than one year (iirc), while older documents will not receive any boost at all from that clause. Remember that the other search terms will apply boosts as well, and the score for these clauses might be higher / more relevant than the boost applied from the age.

Date boosting is not an exact science, and will have to be applied with boost values according to your other boosts as well (by either changing the values in the recip call, or by prioritising them with ^weight).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM