문제

I need to identify potential stopwords in my Solr collection. Is it possible to find those terms which have the highest document frequency in my collection (or at least in a given shard)?

도움이 되었습니까?

해결책

Yes, use HighFreqTerms, like:

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...
}

Luke also prominently displays the most common terms.

다른 팁

As you already set up Solr, use TermsComponent to get the term frequencies for any given field:

http://wiki.apache.org/solr/TermsComponent

If you have a default search field, (which is the destination of your copied field), it should give you the frequencies across all fields.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top