You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by "Michael J. Prichard" <mi...@mac.com> on 2006/06/18 18:39:47 UTC
Unique indexes?
Is there anything like a unique key for lucene indexes? For example,
say I want to have unique ItemID's in my index...do I need to check for
that before insert or can I lock it down with Lucene's API?
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Unique indexes?
Posted by Erick Erickson <er...@gmail.com>.
Every document insertion generates a new doc id (doc.id()). It just bumps by
one for each entry. But that ID changes upon re-indexing, and if you submit
the same doc twice, it gets indexed twice and have to documents in your
index that are indistinguishable except for Lucene's ID.
Otherwise, you have to make your own if what you want is a unique key
associated with a particular document. It sounds like you already have a
unique key, and will have to check for it before adding a document.
There is no equivalent that I know of to a DBs UNIQUE_KEY constraint on a
table.
Best
Erick