Hi,
Can any one suggest me the best way to get Hits( no of occurrences ) of a word per document in Lucene?..
Hi,
Can any one suggest me the best way to get Hits( no of occurrences ) of a word per document in Lucene?..
SpanTermQuery.getSpans will give an enumeration of docs and where the terms appears. The docs are sorted, so you can just count the number of times each doc appears, ignoring the position info.
Lucene uses a field-based, rather than document-based, index. In order to get term counts per document: