Which release of Solr?
Is this a single node Solr or distributed or cloud?
Is is possible that you added documents with the "overwrite="false""
attribute? That would suppress the uniqueness test.
Is it possible that you added those documents before adding the uniqueKey
element to your schema, or added uniqueKey but did not restart Solr before
adding those documents?
One minor difference from the Solr example schema is that your id field does
not have "required="true"". I don't think that should matter (Solr will
force the uniqueKey field to be required in documents), but I am curious how
you managed to get an id field different from the Solr example.
-- Jack Krupansky
-----Original Message-----
From: Robert Krüger
Sent: Monday, October 22, 2012 5:56 AM
To: solr-user@lucene.apache.org
Subject: uniqueKey not enforced
Hi,
I noticed a duplicate entry in my index and I am wondering how that
can be, because I have a uniqueKey defined.
I have the following defined in my schema.xml:
<?xml version="1.0" ?>
<schema name="main core" version="1.1">
<types>
<fieldtype name="string" class="solr.StrField"
sortMissingLast="true" omitNorms="true"/>
.... other field types omitted here ...
</fieldType>
</types>
<fields>
<!-- general -->
<!-- id computed as a combination of media id and path -->
<field name="id" type="string" indexed="true" stored="true"
multiValued="false" />
.... other fields omitted here ...
</fields>
<!-- field to use to determine and enforce document uniqueness. -->
<uniqueKey>id</uniqueKey>
<!-- field for the QueryParser to use when an explicit fieldname is
absent -->
<defaultSearchField>name</defaultSearchField>
<!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->
<solrQueryParser defaultOperator="OR"/>
</schema>
And now I have two records which both have the value
"4b34b883-a9d9-428a-92c3-ba1a69d96a70:/Düsendrögl" in its id field. Is
it the Non-ASCII chars that cause the uniqueness enforcement to fail?
I am using Solr 3.6.1.
Any ideas what's going on?
Thanks,
Robert