lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Lu <chris...@gmail.com>
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);
query.extractTerms(terms);
for(Term t : terms){
    int frequency = searcher.docFreq(t);
}

-- 
--
Chris Lu
-------------------------
Instant Scalable Full-Text Search On Any Database/Application
site: http://www.dbsight.net
demo: http://search.dbsight.com
Lucene Database Search in 3 minutes: http://wiki.dbsight.com/index.php?title=Create_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.
>
> HighFreqTerms.java 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
> HighFreqTerms.java 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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message