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 Salman Ansari <sa...@gmail.com> on 2015/12/23 09:32:36 UTC

Multiple Unique Keys

Hi,

I am wondering if I can specify multiple unique keys in the same document
in Solr. My scenario is that I want to integrate with another system that
has an ID and our system has a reference number (auto-generated for each
document on the fly) as well that is unique.

What I am trying to achieve is to have uniqueness applied on both "ID" and
"Reference Number" so if I get a duplicate document from the source (which
will have the same ID) I want to override my existing document. What I am
not sure about is

1) Does Solr support multiple unique keys for a document?
2) What if the "ID" was the same but we generated a different "Reference
Number", will that override the existing document? (I mean one field among
the unique field is the same but the other is not)

Appreciate your feedback and comments.

Regards,
Salman

Re: Multiple Unique Keys

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
No.

Whichever one triggers the document override should be your primary key.
The rest is application logic.

You can make the field required, but that's about it.

Regards,
   Alex
On 23 Dec 2015 3:32 pm, "Salman Ansari" <sa...@gmail.com> wrote:

> Hi,
>
> I am wondering if I can specify multiple unique keys in the same document
> in Solr. My scenario is that I want to integrate with another system that
> has an ID and our system has a reference number (auto-generated for each
> document on the fly) as well that is unique.
>
> What I am trying to achieve is to have uniqueness applied on both "ID" and
> "Reference Number" so if I get a duplicate document from the source (which
> will have the same ID) I want to override my existing document. What I am
> not sure about is
>
> 1) Does Solr support multiple unique keys for a document?
> 2) What if the "ID" was the same but we generated a different "Reference
> Number", will that override the existing document? (I mean one field among
> the unique field is the same but the other is not)
>
> Appreciate your feedback and comments.
>
> Regards,
> Salman
>