我需要在Solr集合中识别潜在的停止语。有可能在我的收藏中(或者至少在给定的碎片中)找到文档频率最高的术语吗?
是的,使用HighFreqTerms,如:
TermStats[] stats = HighFreqTerms.gethighFreqTerms(reader, 10, "myContentField", new HighFreqTerms.DocFreqComparator());
for (TermStats stat : stats) {
System.out.println(stat.termtext.utf8ToString() + ", docfreq:" + stat.docFreq);
//Or whatever else you want to do with them...
}
卢克还突出地展示了最常见的术语。
由于您已经设置了Solr,请使用TermsComponent获取任何给定字段的术语频率:
http://wiki.apache.org/solr/TermsComponent
如果您有一个默认的搜索字段(即复制字段的目的地),它应该会为您提供所有字段的频率。