lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Lu <>
Subject Re: High frequency term for the searched query
Date Thu, 04 Nov 2010 17:22:43 GMT
After you get the query object, you can use IndexSearcher's function 
docFreq(), like this

final Set<Term> terms = new HashSet<Term>();
query = searcher.rewrite(query);
for(Term t : terms){
    int frequency = searcher.docFreq(t);

Chris Lu
Instant Scalable Full-Text Search On Any Database/Application
Lucene Database Search in 3 minutes:

On 11/4/2010 12:53 AM, starz10de wrote:

> I need to find the most frequent terms that are appeared with a query.
> can be used only to obtain the high frequency terms in
> the whole index.
> I need just to find the high frequency terms to the submitted query.
> What I do now is:
> I search the index with the query and retrieve the relevant documents then
> save those documents in a new folder then index them. At the end I use
> in the new index so I can find the most frequent terms to
> the query. However, this is very slow and need long time to run.
> Any idea how I can do this task efficiently
> Thanks in advance

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message