I don't think I understand what "only unique records from a single field"
means. If it's a unique value in a filed, there'll only be one document in
the hits object and there's no cost to iterating, so I doubt that's what you
mean.
If your asking for a list of all the unique values for a particular field,
see TermDocs and/or TermEnum which will allow you to look at, say, all the
values stored for some field. A trick here is to seek (new Term("field",
""));. By putting nothing in the value, you effectively enumerate them all,
something that I didn't find obvious.
If neither of these are close to the mark, perhaps you could provide more
detail.
Best
Erick
On 11/21/06, Bhavin Pandya <bhavinp@rediff.co.in> wrote:
>
> Hi,
> In lucene, is there any way to find only unique records from a single
> field ..?
>
> otherwise unnecessary i have to itereate through Hits and find out
> unique...
>
> plz help..
>
> - Bhavin pandya
>
|