This example code gets the unique terms for a field and a total num docs for each...
String fieldName="myfield"; valueCounts=new ArrayList(); TermEnum termEnum; termEnum = indexReader.terms(new Term(fieldName,"")); Term term = termEnum.term(); while (term!=null) { if (!fieldName.equals(term.field())) { break; } valueCounts.add(new ValueCount(term.text(), termEnum.docFreq())); if(!termEnum.next()) { break; } term=termEnum.term(); } class ValueCount implements Serializable { String value; int docCount; public ValueCount(String value,int docCount) { this.value=value; this.docCount=docCount; } } ___________________________________________________________ Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]