Get search word Hits ( number of occurences) per document in Lucene

后端 未结 2 927
执笔经年
执笔经年 2021-01-23 23:18

Can any one suggest me the best way to get Hits( no of occurrences ) of a word per document in Lucene?..

2条回答
  •  深忆病人
    2021-01-24 00:03

    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.

提交回复
热议问题