Unique id field support in Solr

2006-04-09 Thread Ken Krugler

Hi all,

Is there any way to explicitly add a record using Solr, such that the 
add will fail if a record already exists with the same value in the 
unique ID field (as specified by the schema's uniqueKey field)?


I can of course do a pre-flight query to see if a record with the 
same unique id exists, but in a multi-client environment (one Solr, 
multiple users) this isn't reliable.


Thanks,

-- Ken
--
Ken Krugler
Krugle, Inc.
+1 530-210-6378
"Find Code, Find Answers"


Re: Unique id field support in Solr

2006-04-09 Thread Chris Hostetter

: Is there any way to explicitly add a record using Solr, such that the
: add will fail if a record already exists with the same value in the
: unique ID field (as specified by the schema's uniqueKey field)?

I was going to say  should do what you want,


http://wiki.apache.org/solr/UpdateXmlMessages#head-3dfbf90fbc69f168ab6f3389daf68571ad614bef

...but that combination of options doesn't seem to be supported -- when i
tried to write a test case for it, it failed with this exception...

SEVERE: org.apache.solr.core.SolrException: unsupported param 
combo:add:,allowDups=false,overwritePending=false,overwriteCommitted=false
at 
org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:197)

...i'm not sure how hard it would be to add that, the UpdateHandler is
already checking for the dumplicate, i'm not sure why it can't just throw
the new doc away when it finds one instead of deleting the old (that error
message shows some definite forethought, so i'm guessing Yonik had a
reason for it).




-Hoss