Maybe you can use the [very new] feature committed under this issue: https://issues.apache.org/jira/browse/LUCENE-2590
This lets you see which doc matched which terms from the query. But, it hasn't be released yet (it'll be in 3.1 and 4.0). Mike On Mon, Nov 8, 2010 at 7:14 AM, starz10de <farag_ah...@yahoo.com> wrote: > > Extract the high frequent terms in the search result set. > > > I need to know how to extract the most frequent terms in the search result > set after submitting the query. > > Here the class where you can use to extract the most frequent terms from the > index: > > int j=0; > int numTerms=5; > TermEnum terms = r.terms(); > > TermDocs dok = r.termDocs(); > > > TermInfoQueue tiq = new TermInfoQueue(numTerms); > > while (terms.next()) { > tiq.insert(new TermInfo(terms.term(), terms.docFreq())); > } > > while (tiq.size() > 0) { > > TermInfo termInfo = (TermInfo) tiq.pop(); > > if(termInfo.docFreq>=70) > { > > System.out.println(termInfo.term.text() + " " + > termInfo.docFreq); > > > j++; > > } > > > } > > Is there a way to apply this class only in the result of the search? > > Thanks in advance > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/high-frequent-terms-in-the-search-result-set-tp1862280p1862280.html > Sent from the Lucene - Java Users mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org