Also, from the javadocs, check out the explain method on Searcher: http://lucene.apache.org/java/docs/api/org/apache/lucene/search/ Searcher.html#explain(org.apache.lucene.search.Query,%20int)

As for the state of the documentation, If you have concerns about the javadocs, please write up an issue in JIRA and, even better, submit a patch with your improvements. We are always looking for help, especially in the documentation department. Lucene will only get better by having people make quality contributions based on their 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 a search.
Something like

Hits hits = searcher.search(new TermQuery(new Term("field", "value")));
for (int idx = 0; idx < hits.length(); ++idx)
   float score = hits.score(idx);


Look at the warnings in the javadoc for why using the Hits object rather than a HitCollector is not optimal if you intend to look at more than 100 or
so documents...

Best
Erick

On 11/2/06, Michele Amoretti <[EMAIL PROTECTED]> 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 which
easily provide this functionality.

E.g. the Similarity class provides methods which return the factors of the scoring formula, but I would like a method which returns the 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à degli Studi di Parma
http://www.ce.unipr.it/people/amoretti

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to