lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: raw hit count
Date Sun, 30 Nov 2003 01:20:01 GMT
I enjoy at least attempting to answer questions here, even if I'm half  
wrong, so by all means correct me if I misspeak....

On Saturday, November 29, 2003, at 06:37  PM, Kent Gibson wrote:
> All I would like to know is how many times a query was
> found in a particular document. I have no problems
> getting the score from hits.score(). hits.length is
> the number of times in total that the query was found,
> however I want the the number of times the query was
> found on a document by document basis. is this
> possible?

The 'coord' factor used in computing the score is exactly this.  See  
the javadoc for it:

	http://jakarta.apache.org/lucene/docs/api/org/apache/lucene/search/ 
Similarity.html#coord(int,%20int)

You could implement a custom Similarity to capture the "overlap" or  
adjust the the factor depending on what you're trying to accomplish.

>  The only idea I have is to rerun the search,
> but I can't even see how to run a search on only one
> document!

You could always rerun a search with a Filter with only one bit enabled  
and see if zero or one document is returned - that would be quite  
trivial and fast.

	Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Mime
View raw message