lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chuck Williams <>
Subject Re: categorized search
Date Sun, 24 Apr 2005 17:06:01 GMT
Pablo Gomes Ludermir wrote:

>Hi all,
>I have indexed a field that describes the "category" of the document.
>Thus, I want to know how many categories have a specific term. Could
>someone help me to get this with good performance?
If you want a complete count of all documents in the index for each 
category term, you should keep these counts in your own data structure 
as you index.  If you want to determine a global count for a specific 
category term on demand, I'd suggest using IndexReader.termDocs().  If 
you want to determine counts relative to the results of a particular 
search query, then you need to either iterate the results of the query 
and count occurrences of the category term(s), or perform queries that 
AND the additional category term of interest (the former will be much 
faster if you are computing this for many category terms simultaneously).


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

View raw message