You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Kishore Veleti CoreObject <ki...@coreobjects.com> on 2008/12/13 18:10:06 UTC

unique so that if that combination exists in index it will return an error

In Lucene is there a way (like in databases) to define a combination of 3
fields as unique so that if that combination exists in index it will return
an error and not add another document with that combination again?


-- 
View this message in context: http://www.nabble.com/unique-so-that-if-that-combination-exists-in-index-it-will-return-an-error-tp20992242p20992242.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: unique so that if that combination exists in index it will return an error

Posted by KishoreVeleti CoreObjects <ki...@coreobjects.com>.
Thanks Erik for your reply. 

But I have another question. Supose say I already have my database primary
key as uniqueId in SOLR. Besides uniqueKey "Id" field I have 3 more fields
say field1, field2, field3. I want to make sure that in SOLR I will have
only one document where field1, field2, field3 values - all togethere should
be only one.

If I try to add another document with same combination then SOLR should not
add the new document and return an error. Is it possible?



Erik Hatcher wrote:
> 
> 
> On Dec 13, 2008, at 12:10 PM, Kishore Veleti CoreObject wrote:
>> In Lucene is there a way (like in databases) to define a combination  
>> of 3
>> fields as unique so that if that combination exists in index it will  
>> return
>> an error and not add another document with that combination again?
> 
> No, you'll have to merge those three fields into a single field as  
> Solr only uses one field for uniqueKey.
> 
> 	Erik
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/unique-so-that-if-that-combination-exists-in-index-it-will-return-an-error-tp20992242p20993410.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: unique so that if that combination exists in index it will return an error

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Dec 13, 2008, at 12:10 PM, Kishore Veleti CoreObject wrote:
> In Lucene is there a way (like in databases) to define a combination  
> of 3
> fields as unique so that if that combination exists in index it will  
> return
> an error and not add another document with that combination again?

No, you'll have to merge those three fields into a single field as  
Solr only uses one field for uniqueKey.

	Erik