lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <>
Subject Re: Word co-occurrences counts
Date Fri, 24 Dec 2004 00:38:05 GMT
Andrew Cunningham wrote:
> "computer dog"~50 looks like what I'm after - now is there someway I can 
> call this and pull
> out the number of total occurances, not just the number of documents 
> hits? (say if computer
> and dog occur near each other several times in the same document).

You could use a custom Similarity implementation for this query, where 
tf() is the identity function, idf() returns 1.0, etc., so that the 
final score is the occurance count.  You'll need to divide by 
Similarity.decodeNorm(indexReader.norms("field")[doc]) at the end to get 
rid of the lengthNorm() and field boost (if any).


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message