What's the problem with a hit list iteration ( it should be very fast ) ?
I am not sure about equivalent of SQL "distinct" in Lucene.
You didn't describe whether you index ( and plus store ) all fields.
Effectively you may just store a primary key ( let's say incremental
int id for the sake of example , though you table doesn't look
normalised , it doesn't really matter in our case ) which will be
stored not indexed , the rest may be indexed as ( Name + Address +
Class ...) or as separate fields if you need to and either stored or
Having applied search "Name:Menaria" ( and having written all this I
realised that you still need to iterate a hit list but let me finish
:) ) you may form a string with coma delimited IDs and then
"select distinct class from mytable where where id in "(" +
formedstring + ") "
Surely if you store everything in Lucene index , there is no need to
query database and you may use collections for picking up distinct
"Class" values , but my understanding you still need to iterate
On 5/30/07, Laxmilal Menaria wrote:
I have created a Lucene Index of Students Database, this database have 5
fields i.e. Name, Address, Class, PhoneNo and ScholarNo.
Now I have opened Searcher and query "Name:Menaria" , Its return 100
results. Now I wants the All unique "Class" names which is return in Hits
objects, How can I get unique Class list without using Loop.
Please suggest me..