aneuryzm
aneuryzm

Reputation: 64834

Lucene: what are the hits for the query?

I've just seen in 1 totalHits and scoreHits return the top and total number of hits for the query respectively.

What does "hit" mean exactly ? Is it the position of the searched term in a document, or the documents in which the term is included... or what ?

thanks

Upvotes: 4

Views: 1227

Answers (1)

Paul
Paul

Reputation: 2581

The totalHits is the number of documents that matched the query. A hit is essentially a match for the query you entered. However a hit may be a partial match or a full match

e.g. If we use Lucene to index over a set of 3 texts: { “hello world”, “hello sailor”, “goodnight moon” }, then searching for: hello world

total hits: 2

1.078 hello world

0.181 hello sailor

The float value indicates the score for the hit, which is the relevance to the query string.

The following post gives more details https://web.archive.org/web/20110228/http://lingpipe-blog.com/2009/02/18/lucene-24-in-60-seconds/

Upvotes: 3

Related Questions