开发者

Lucene: what are the hits for the query?

开发者 https://www.devze.com 2023-02-13 16:55 出处:网络
I\'ve just seen in 1 totalHits and scoreHits return the top and total number of hits for the query respectively开发者_如何转开发.

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


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 http://lingpipe-blog.com/2009/02/18/lucene-24-in-60-seconds/

0

精彩评论

暂无评论...
验证码 换一张
取 消