Search code examples
luceneindexingsearch-engineinformation-retrieval

Lucene 4.0 - HighFreqTerms class how to get actual string of Term


i want to get the highest frequency Terms of a Lucene Index.

i use:

HighFreqTerms.getHighFreqTerms(reader, noOfTerms, field);

The Problem is, the function has a return Type of "TermStats[]". The class TermStats has a field called "termText" but the type of that field is not String but "ByteRef" - How can i get a String representation of my high frequency Terms?

Thanks.


Solution

  • Simply call the method termText.utf8ToString().