lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Masurel <paul.masu...@gmail.com>
Subject Re: find out rank of document within a lucene query (with custom sorting)
Date Thu, 07 Jan 2016 09:30:55 GMT
What about the following solution :

Assuming your query is QUERY  and the document you are looking for can be
identified by an
indexed field called doc_id:234234

1) run the query (QUERY AND doc_id:234234). save the score.
2) run the query QUERY, and run the matching document DocSet into a specific
Collector, that takes the score of your document in its constructor, and
just counts the number of docs crossed that have a score lower than your
specific document.

Paul

On Thu, Jan 7, 2016 at 6:17 PM, Anton Telle <anton@teamaton.com> wrote:

> Hi,
>
> it seems that the Explanation only "explains" the score.
> Yet, I am not looking for the score. I am looking for the rank of the
> document within a list of results according to a specific query. That is,
> at what position the document would be in the result list.
> Did I not understand the "explain" functionality correctly?
>
> Anton.
>
> --------------------------
>
> Anton Telle
> Büro: (030) 42025514
> Mobil: 01781473677
> www.teamaton.com
>
> teamaton UG (haftungsbeschränkt)
> Richard-Sorge-Straße 78, 10249 Berlin
> Handelsregister: Amtsgericht Charlottenburg, HRB 130292 B
> Geschäftsführer: Andréj Telle
>
> 2016-01-06 18:12 GMT+01:00 Uwe Schindler <uwe@thetaphi.de>:
>
> > Hi,
> >
> > If you only want to get that information for a single, certain document,
> > you can use the "explain" functionality - but you need the internal
> > document ID for that. Alternatively execute the query once (for whole
> > result set) and an additional time with a filter on your external ID
> > applied. The only result would be the filtered document, but with the
> same
> > score as in first result set.
> >
> > Uwe
> >
> > -----
> > Uwe Schindler
> > H.-H.-Meier-Allee 63, D-28213 Bremen
> > http://www.thetaphi.de
> > eMail: uwe@thetaphi.de
> >
> > > -----Original Message-----
> > > From: Anton [mailto:anton.telle@gmail.com]
> > > Sent: Wednesday, January 06, 2016 10:27 AM
> > > To: general@lucene.apache.org
> > > Subject: find out rank of document within a lucene query (with custom
> > > sorting)
> > >
> > > Hi,
> > >
> > > I am interested to find out what rank a document holds within a search
> > > query among all documents within the index.
> > >
> > > In more detail: I would like to create a query with a sorting. But I am
> > not
> > > interested in getting, for instance, the top 10 search hits for that
> > query
> > > and sorting. I am only interested what rank a certain document from the
> > > index would be in the result of that query and sorting. It could be the
> > > 42nd from 1024 documents in that result. I could identify the document
> > via
> > > an ID field.
> > >
> > > Is there a possibility to do get that rank number efficiently?
> > > (A simple, but probably time consuming, solution would be: Get all
> > > documents according to query and sorting. Loop through the result list
> > and
> > > find the specific document. Return the counter of the loop.)
> > >
> > > Here is a similar question on stackoverflow (without a satisfying
> > answer):
> > > http://stackoverflow.com/questions/7924146/is-there-a-way-for-solr-
> > > lucene-to-return-the-ranks-of-selected-documents-instead
> > >
> > > Have a nice day,
> > > Anton.
> >
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message