Solrnet boost by popularity AND "freshness"

113 views
Skip to first unread message

Pascal Schwaller

unread,
Feb 24, 2021, 8:42:54 AM2/24/21
to SolrNet
Hi all,
I'm trying to set a general boost to a field ("sortScore") but when there's a tie, I also want the newer document appearing before the older one.

basically what I tried to achieve is:
q={!boost b=sortScore}{!boost b=recip(ms(NOW/HOUR,dateNewRelevant),3.16e-11,1,1)}*:*

However, even Solr does not quite give me the correct result. I tried to do this with Solrnet but it's not possible because I would need to add LocalParams and this does not allow duplicated keys (in my case "boost b" would be the key for both prefixes). 

I tried all kinds of things using standard query parser but never got to the result I want.

Instead, I tried using edismax query parser (using LocalParams in setting type = edismax) and then using extra params ("bf" for recip(ms(NOW/HOUR,dateNewRelevant),3.16e-11,1,1) and "boost" for my field "sortScore") which looks better but not quite right either.

Is there a way to tell Solr, that sortScore is more important than my "dateNewRelevant" field?

I was just wondering if edismax is the right way to go? Why does LocalParams not allow me to add the same key twice in Solrnet, when I can do it using the Solr Admin UI?

Any help is really appreciated.

Kind Regards,
Pascal

Mauricio Scheffer

unread,
Feb 24, 2021, 4:48:14 PM2/24/21
to SolrNet
Hi Pascal, I'd try combining the two fields sortScore and dateNewRelevant into a single field (ideally at index time), then boost on that.
In any case, you have to first figure out how to solve this in Solr, and only then express that in SolrNet. Your best bet for that is asking on the Solr mailing list: https://lucene.apache.org/solr/community.html#mailing-lists-irc

Cheers,
Mauricio

Pascal Schwaller

unread,
Mar 4, 2021, 7:07:54 AM3/4/21
to SolrNet

Hi Maricio

Thanks for helping out, that's actually a good idea. I have however opted for something else. I now use LocalParams to boost my field sortScore only (producing "q={!boost=sortScore}"), then sort by score (relevance of solr) and then sort by my date field dateNewRelevant. This actually gives me exactly what I need.

I'll keep the combination of boosting a combined field of a combination of two fields in mind for another use case.

Kind Regards,
Pascal
Reply all
Reply to author
Forward
0 new messages