Re: Return all distinct values

2006-03-30 Thread Volodymyr Bychkoviak
There is one little note. If index has deletions then counters could have wrong values... mark harwood wrote: 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.

RE: Return all distinct values

2006-03-30 Thread Paul . Illingworth
To 30/03/2006 10:21 cc Subject Please respond to

RE: Return all distinct values

2006-03-30 Thread mark harwood
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(ter

RE: Return all distinct values

2006-03-30 Thread Ramana Jelda
Hi, Actually lucene does not provide you a straight forward Query to get UNIQUE results. But as far as I know, u can use HitsCollector & BitSet combination to count/get unique results. Regards, Jelda > -Original Message- > From: Java Programmer [mailto:[EMAIL PROTECTED] > Sent: Thursday