lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <>
Subject Re: is there any way to find unique records ?
Date Tue, 21 Nov 2006 13:31:21 GMT
 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

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


On 11/21/06, Bhavin Pandya <> 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

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message