3

I've got a search system where I allow users to set their preferences, then I boost results in a SOLR search according to these preferences. I'd like to give the users some visual feedback when a result has been boosted, but to do this I need to find a way to tell if a particular result has been boosted.

So far, I've thought of using the score value and if the score is above a certain threshold then I know it's been boosted, however the score seems to change quite a bit from query to query so I don't know how to set such a threshold.

If I had access to the pre-boost score somehow in the result, then I could compare this with the final post-boost score and know that the result had been boosted but I don't think the pre-boost score is available (please correct me if I'm wrong).

Does anyone have any other ideas how to achieve this?

sehe
  • 374,641
  • 47
  • 450
  • 633
Kevin Colgan
  • 199
  • 2
  • 6

1 Answers1

2

you add this to your request:

&debugQuery=true

then you will get a debug element in your response. Among other things, in contains explain where you can see (for each doc id returned) how it's score is built. If you parse that info, you can see if it comes from, including boosting info).

explain info is quite convoluted to parse, there is even a page to help you with that.

Persimmonium
  • 15,593
  • 11
  • 47
  • 78
  • I gave adding the debugQuery a go but as well as slowing down the query response quite a lot it really is pretty impenetrable to parse - the explain page couldn't cope with my response. – Kevin Colgan May 06 '15 at 20:55
  • yes, it slower and hard to parse (but doable), I think there is no other way. You could also run the query without the preferences boosting and compare scores, but that means running two queries. – Persimmonium May 07 '15 at 07:13
  • I think I may instead put some logic in the frontend where I can check each result field against the preferences criteria and decide that way if it has been boosted or not. Another approach could be to actual extend the Java class that processes the results and add a field 'orig_score' or something like that. Seems like this might be a good place to start: http://lucene.apache.org/core/3_6_0/api/core/org/apache/lucene/search/Similarity.html – Kevin Colgan May 07 '15 at 07:55