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).
Chuck
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]