Multiple unique field?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple unique field?

Vinci
Hi,

I want to set 2 field that are unique for different kind of searching. Does it possible?

Thank you,
Vinci
Reply | Threaded
Open this post in threaded view
|

Re: Multiple unique field?

hossman

: I want to set 2 field that are unique for different kind of searching. Does
: it possible?

not unless you enforce it yourself -- there isn't anything built in to
Solr to do this with the exception of the uniqueKey field.

There is an UpdateRequestProcessorFactory hook that you can implement to
do arbitrary logic for each update command (regardless of wether the
update comes from XML, CSV, or something else) ... you could add whatever
uniqueness logic you want there.



-Hoss

Reply | Threaded
Open this post in threaded view
|

Re: Multiple unique field?

Vinci
Hi,

Thank you for your reply
In other word, can I set 2 unique key field?

Thank you,
Vinci

hossman wrote
: I want to set 2 field that are unique for different kind of searching. Does
: it possible?

not unless you enforce it yourself -- there isn't anything built in to
Solr to do this with the exception of the uniqueKey field.

There is an UpdateRequestProcessorFactory hook that you can implement to
do arbitrary logic for each update command (regardless of wether the
update comes from XML, CSV, or something else) ... you could add whatever
uniqueness logic you want there.



-Hoss
Reply | Threaded
Open this post in threaded view
|

Re: Multiple unique field?

Ryan McKinley
>
> Thank you for your reply
> In other word, can I set 2 unique key field?

directly in solr: no

In your own code, yes -- either in the client or in custom plugin.

ryan
Reply | Threaded
Open this post in threaded view
|

Re: Multiple unique field?

Vinci
Hi,

Thank you for your reply.
When I set 2 unique key field, it looks like Solr only accept the first definition in schema.xml...question: so once the unique Key defined, it can't be overrided?

Thank you,
Vinci

ryantxu wrote
>
> Thank you for your reply
> In other word, can I set 2 unique key field?

directly in solr: no

In your own code, yes -- either in the client or in custom plugin.

ryan
Reply | Threaded
Open this post in threaded view
|

Re: Multiple unique field?

hossman

: When I set 2 unique key field, it looks like Solr only accept the first
: definition in schema.xml...question: so once the unique Key defined, it
: can't be overrided?

there is one and only one uniqueKey field ... trying to declare two should
probably be an error 9anyone wnat to submit a patch?), but you definitley
can't "override" the uniqueKey field ... declare it once, and that's what
it is for your whole index.


-Hoss