Solr search results and getting a document position

I have a solr index available using SolrNet, and I would like to get the index (position) of a specific document in the results without returning the entire set of results.

In more detail ... the query returns ~ 30,000 documents and is sorted by integer field. The unique key field contains Guid, and I would like to find where in the results a specific document based on a unique key, only returning the first 10 results.

This index was originally implemented in plain old Lucene, and this task was achieved with two queries: one to get the document identifier lucene of the document that I want to know about, and then the second, which returns the entire result set. Then I can use the doc identifier to find where the document appears in the full set of results, but then only list the documents for the first 10.

Is there a way to achieve what I get after Solr without returning all 30,000 results (even limiting this to Guid only seems too slow)?

thanks

+2
source share
2 answers

I think what you can do with the range request, including your custom item as a lower level, you can get the number of users higher. You can either make an explicit request or retrieve this information using the facet range approach.

therefore, if you know that your user point is 10.000, you can make a request: game: tetris points [MaxInt TO 10000], and if the result is 375, you would know that your user is in rank 375.

+5
source

The only reliable way I can think of is to build a rating in an index-time, i.e. have an integer field "rank" and fill it when creating the index. The disadvantage of this is that each update requires the restoration of the entire index.

Lucene doc identifiers are unstable, I would not recommend using them for this (see this , this , this ), and Solr does not open them anyway.

0
source

Source: https://habr.com/ru/post/1211264/


All Articles