SOLR search filter by relevance

Thus, each SOLR search result has its own relevance score:

https://wiki.apache.org/solr/SolrRelevancyFAQ

"How can I see relevance scores for search results

Request that a pseudo-field named "score" be returned by appending it to the fl (list of fields) parameter. Then a "score" appears with the fields saved in the returned documents. q = Justice League & fl = *, score "

My question is ... is it possible to filter SOLR results by this relevance score?

Eg. execute the query in the form of the following

Search for keyword "LOL" and only fetch documents whose relevancy score > 50

      

If possible, how would you syntactically define this query?

+3


source to share


2 answers


You can specify the maximum number of results to return. The results will be displayed in descending order by count, so you can stop processing at a specific point in the result set.

solr/search/select?q=LOL&&start=0&rows=10&fl=*%2Cscore

      



See the following article for a discussion of setting a minimum score: Is it possible to set the Solr score threshold to "reasonable", regardless of the results returned? (i.e. standard Solr score)

+1


source


I've spent hours trying to filter values ​​with a relevance factor of 0. I couldn't find a direct way to do this. I ended it up with a workaround that assigns the request function to a local parameter. I call this local parameter in both the query ("q =") and the filter query ("fq =").

Example

Let's say you have a query like:

q={!func}sum(*your arguments*)

      



First, make the function component your own parameter:

q={!func}$localParam
&localParam={!func}sum(*your arguments*)

      

Now, to return results with scores between 1 and 10, just add a filter query to this local pair:

q={!func}$localParam
&localParam={!func}sum(*your arguments*)
&fq={!frange l=1 u=10 inclusive=true}$localParam

      

+2


source







All Articles