joeln
joeln

Reputation: 3643

Is there a way for Solr/Lucene to return the ranks of selected documents instead of full results?

I am interested in querying Solr with query q and charting its recall of a set of documents D when {10, 20, 30, ...} documents are returned.

Currently, I am having the full results, i.e. a list of docids returned (through solrpy), and iterate through it to find the ranks of D, i.e. a mapping from D to their indices in the search results. I do not strictly require the mapping, only mapped ranks.

Is there a way to have Solr/Lucene return ranks for a set of IDs instead of the full results?

Other ways of approaching this problem:

Upvotes: 8

Views: 1947

Answers (2)

Hugo Zaragoza
Hugo Zaragoza

Reputation: 601

No I cannot think of a SOLR or Lucene way to do this. I think the simplest solution here is to program this yourself with a simple HashSet...

Upvotes: 1

Matej
Matej

Reputation: 7627

You can retrieve rank by score field.

Append &fl=KeyFieldName,score to retrieve document id and score to your query. If you need all fields append &fl=*,score to your query.

See http://wiki.apache.org/solr/SolrRelevancyFAQ#How_can_I_see_the_relevancy_scores_for_search_results for details.

Upvotes: 5

Related Questions