That's a good point. What is the query sorting on?

Shayan, can you give an example of a query with sorting/etc shown.

Regards,
   Alex.
----
Solr Analyzers, Tokenizers, Filters, URPs and even a newsletter:
http://www.solr-start.com/


On 3 September 2015 at 16:24, Chris Hostetter <hossman_luc...@fucit.org> wrote:
>
> : Write a PostFilter which takes in a document id. It lets through all
> : documents until it sees that document id. Once it sees it, it stops
> : letting them through.
> :
> : Thus, the total count of documents would be the position of your queried
> : car.
>
> Sorry guys, that won't work.
>
> PostFilter's can be used to collect & filter the documents returned as the
> result of a query, after the main query logic (so you can delay expensive
> filter checks) but they still happen before any sorting -- they have to in
> order to in order for the sorting logic to know *whic* documents
> should be added to the priority queue.
>
>         - - -
>
> I can only think of two appraoches to this general problem:
>
> 1) 2 queries with frange filter on score.
>
> this solution is only applicable in situations where:
>   a) you are only sorting on scores
>   b) the position information can be aproximate as far as other docs with
> identical scores (ie: you can say "X documents have a higher score"
> instead of "exactly X documents come before this one")
>
> The key is to first do a query on whever where you filter (fq) on the doc
> id(s) you are interested in so you can get them back along with the
> scores, then you do another query where you do something like...
>
> ?rows=0&q=whatever&fq={!frange incl=false l=THE_SCORE v=$q}
>
> ...so that you post filter and ignore any doc that doesn't have a higher
> score and look at hte total numFound.
>
> if there are multiple docs you need to get info about at one time, instead
> of filtering you can use facet.query the same way
>
>   rows=0
>   q=whatever
>   facet=true
>   facet.query={!frange key=doc1 incl=false l=DOC1_SCORE v=$q}
>   facet.query={!frange key=doc2 incl=false l=DOC2_SCORE v=$q}
>   facet.query={!frange key=doc3 incl=false l=DOC3_SCORE v=$q}
>   ...etc...
>
> https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-FunctionRangeQueryParser
>
> 2) cursor deep paging
>
> this solution will work regardless of the number of docs you are
> interested in, and regardless of how complex your sort options are -- just
> use the cursorMark param to iterate over all the results in your client
> until you've found all the unqiueKeys you are looking for, counting the
> docs found as you go.
>
> The various docs on deep paging and using cursors go into some background
> hwich may help you understand why what you are asking for in general is a
> hard problem, and why suggestion #1 only works with a simple sort on
> score, and for anything more complex you really have to go the cursor
> route...
>
> https://cwiki.apache.org/confluence/display/solr/Pagination+of+Results
> https://lucidworks.com/blog/coming-soon-to-solr-efficient-cursor-based-iteration-of-large-result-sets/
>
> -Hoss
> http://www.lucidworks.com/

Reply via email to