: Is there a simple way to list all terms in a field?
: The only approach that I see is to use the IndexReader.terms() method
: and then iterate over all the results and build my list by manually
: filtering. This seems inefficient and there must be a better way that
: my newbie eyes don't see.
Mark, Here's a small piece of code that outputs a list of all terms
for a given field, in order of decreasing term frequency:
--- Requires Java 1.5 for PriorityQueue, or you can use Doug Lea's version ---
String field = "myfield".intern(); // intern
required for != below
In