Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 66190 invoked from network); 2 Nov 2006 17:16:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Nov 2006 17:16:13 -0000 Received: (qmail 88322 invoked by uid 500); 2 Nov 2006 17:15:48 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 88254 invoked by uid 500); 2 Nov 2006 17:15:47 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 88200 invoked by uid 99); 2 Nov 2006 17:15:47 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from [208.97.132.62] (HELO spunkymail-a18.dreamhost.com) (208.97.132.62) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Nov 2006 09:15:43 -0800 Received: from [192.168.0.2] (adsl-074-229-189-244.sip.rmo.bellsouth.net [74.229.189.244]) by spunkymail-a18.dreamhost.com (Postfix) with ESMTP id 65C205B533 for ; Thu, 2 Nov 2006 09:14:26 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v752.2) In-Reply-To: <359a92830611020809u1ce5806encc4890676417f8cd@mail.gmail.com> References: <71caf8b50611020636l505eddb7rf16fd556abbc289c@mail.gmail.com> <359a92830611020809u1ce5806encc4890676417f8cd@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-Id: <178DFFC0-C757-4E14-B823-1CD17882C687@apache.org> Content-Transfer-Encoding: quoted-printable From: Grant Ingersoll Subject: Re: simple (?) question about scoring Date: Thu, 2 Nov 2006 12:14:23 -0500 To: java-user@lucene.apache.org X-Mailer: Apple Mail (2.752.2) X-Virus-Checked: Checked by ClamAV on apache.org Also, from the javadocs, check out the explain method on Searcher: =20 http://lucene.apache.org/java/docs/api/org/apache/lucene/search/=20 Searcher.html#explain(org.apache.lucene.search.Query,%20int) As for the state of the documentation, If you have concerns about the =20= javadocs, please write up an issue in JIRA and, even better, submit a =20= patch with your improvements. We are always looking for help, =20 especially in the documentation department. Lucene will only get =20 better by having people make quality contributions based on their =20 knowledge of Lucene and IR. -Grant On Nov 2, 2006, at 11:09 AM, Erick Erickson wrote: > Well, the simplest way is to look at the HITS object returned from =20 > a search. > Something like > > Hits hits =3D searcher.search(new TermQuery(new Term("field", =20 > "value"))); > for (int idx =3D 0; idx < hits.length(); ++idx) > float score =3D hits.score(idx); > > > Look at the warnings in the javadoc for why using the Hits object =20 > rather > than a HitCollector is not optimal if you intend to look at more =20 > than 100 or > so documents... > > Best > Erick > > On 11/2/06, Michele Amoretti wrote: >> >> Hello, I am completely new at Lucene. I browsed the web site and the >> source code, searching for an example which illustrates the following >> operation: >> >> given a Query and a Document, return the score >> >> To me, this is a very basic operation, but I cannot find a class =20 >> which >> easily provide this functionality. >> >> E.g. the Similarity class provides methods which return the =20 >> factors of >> the scoring formula, but I would like a method which returns the =20 >> score >> directly. >> >> Is this possible? >> >> Is the Scorer class the solution? Javadoc is too poor to understand >> how to use it. Btw, I do not have an index, I have 1 Document, and 1 >> Query. >> >> Thanks >> >> -- >> Michele Amoretti, Ph.D. >> Distributed Systems Group >> Dipartimento di Ingegneria dell'Informazione >> Universit=E0 degli Studi di Parma >> http://www.ce.unipr.it/people/amoretti >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org >> For additional commands, e-mail: java-user-help@lucene.apache.org >> >> --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org