Return-Path: X-Original-To: apmail-lucene-general-archive@www.apache.org Delivered-To: apmail-lucene-general-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F3EA518326 for ; Thu, 7 Jan 2016 09:31:11 +0000 (UTC) Received: (qmail 40026 invoked by uid 500); 7 Jan 2016 09:31:11 -0000 Delivered-To: apmail-lucene-general-archive@lucene.apache.org Received: (qmail 39969 invoked by uid 500); 7 Jan 2016 09:31:11 -0000 Mailing-List: contact general-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: general@lucene.apache.org Delivered-To: mailing list general@lucene.apache.org Received: (qmail 39957 invoked by uid 99); 7 Jan 2016 09:31:11 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jan 2016 09:31:11 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id A63C118058B for ; Thu, 7 Jan 2016 09:31:10 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.901 X-Spam-Level: ** X-Spam-Status: No, score=2.901 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id guU--DBuJrb6 for ; Thu, 7 Jan 2016 09:30:57 +0000 (UTC) Received: from mail-qk0-f180.google.com (mail-qk0-f180.google.com [209.85.220.180]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id 5A94523033 for ; Thu, 7 Jan 2016 09:30:57 +0000 (UTC) Received: by mail-qk0-f180.google.com with SMTP id h11so31736910qke.1 for ; Thu, 07 Jan 2016 01:30:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=MQH6IXFE+RXV07hp8aQQVwlib0BTSXjwp9HQC638W6M=; b=tDJFYzGio7I5bYuOdH3MEvYlc2hUfc1TDDWz8wluU1n4gD8OQQg4jZesbmIC2ju/Xj UgIcnw9YbXjPqj523eBIaDWHFjVQsOR99/l1Y5o3UZD4/D9pG4SYgzMr1fp2j1mvEBun vq/vSHQg88hFNEB0Q9OL4EGfTMeI/sRpfDWiX6e7xX4Eq4dx6Z3GNpzlEuh8hPhw77+Q OUJ/YBcpl0SAMGnU/d3ttSi6cQuRVkWpp9zEEAFmsxINZpQeGLs3unUQZpJSPs+GTq/8 xJ/9ATYcRqClQSh3sPVb3ZcCnAdhR8M6jqHbroupSgg9Hquo2watRAoIAppU4ca6IWc2 qF0Q== MIME-Version: 1.0 X-Received: by 10.55.72.146 with SMTP id v140mr135218502qka.63.1452159055639; Thu, 07 Jan 2016 01:30:55 -0800 (PST) Received: by 10.140.18.227 with HTTP; Thu, 7 Jan 2016 01:30:55 -0800 (PST) In-Reply-To: References: <005801d148a5$7ab2d8c0$70188a40$@thetaphi.de> Date: Thu, 7 Jan 2016 18:30:55 +0900 Message-ID: Subject: Re: find out rank of document within a lucene query (with custom sorting) From: Paul Masurel To: general@lucene.apache.org Content-Type: multipart/alternative; boundary=001a114a8110ab39d10528bb20a5 --001a114a8110ab39d10528bb20a5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 specifi= c 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 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=C3=BCro: (030) 42025514 > Mobil: 01781473677 > www.teamaton.com > > teamaton UG (haftungsbeschr=C3=A4nkt) > Richard-Sorge-Stra=C3=9Fe 78, 10249 Berlin > Handelsregister: Amtsgericht Charlottenburg, HRB 130292 B > Gesch=C3=A4ftsf=C3=BChrer: Andr=C3=A9j Telle > > 2016-01-06 18:12 GMT+01:00 Uwe Schindler : > > > 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 searc= h > > > 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 t= he > > > index would be in the result of that query and sorting. It could be t= he > > > 42nd from 1024 documents in that result. I could identify the documen= t > > 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 lis= t > > 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. > > > > > > > --001a114a8110ab39d10528bb20a5--