Andy,

Are you looking for the number of documents that contain a term, or the
total number of term instances?

To enumerate over all of the terms in an index, use IndexReader.Terms to
get a TermEnum to walk through the terms.  From there you can use
IndexReader.DocFreq to get the number of documents that contain a term.
To find the total number of occurrences of a term use
IndexReader.TermDocs to retrieve the frequency of a term within a
document.

Hope that gets you in the right direction.

Michael

-----Original Message-----
From: Andrew Schuler [mailto:[email protected]] 
Sent: Friday, August 28, 2009 6:38 PM
To: [email protected]
Subject: enumerating all terms in index

This seems pretty straightforward but Google is failing me today.
What is the generally accepted best (fastest) way to enumerate all the
terms
in and index with the number of times they occur? TIA.

-andy

Reply via email to