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 Dotan Cohen <do...@gmail.com> on 2012/09/12 16:06:49 UTC

Solr unique key can't be blank

Consider this simple schema:

<?xml version="1.0" encoding="UTF-8"?>
<schema name="uuidTest" version="0.1">
	<types>
		<fieldType name="uuid" class="solr.UUIDField" indexed="true" />
	</types>
	<fields>
		<field name="id" type="uuid" indexed="true" stored="true" required="true"/>
	</fields>
</schema>

When trying to upload it to Websolr I am getting this error:
Solr unique key can't be blank

I also tried adding this element to the XML, after </fields>:
<uniqueKey>id</uniqueKey>

However this did not help. What could be the issue? I The code is
taken verbatim from this page:
http://wiki.apache.org/solr/UniqueKey

Note that this is on a Solr 4 Alpha index. Thanks.

-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

Re: Solr unique key can't be blank

Posted by Jack Krupansky <ja...@basetechnology.com>.
The UniqueKey wiki was recently updated to indicate this new Solr 4.0 
requirement:

http://wiki.apache.org/solr/UniqueKey

"in Solr 4, this field must be populated via 
solr.UUIDUpdateProcessorFactory"

The changes you were given are contained on that updated wiki page.

-- Jack Krupansky

-----Original Message----- 
From: Dotan Cohen
Sent: Wednesday, September 12, 2012 10:43 AM
To: solr-user@lucene.apache.org
Subject: Re: Solr unique key can't be blank

On Wed, Sep 12, 2012 at 5:27 PM, Ahmet Arslan <io...@yahoo.com> wrote:
> Hi Dotan,
>
> Did you define the following update processor chain in solrconfig.xml ?
> And did you reference it in an update handler?
>
> <updateRequestProcessorChain name="uuid">
>     <processor class="solr.UUIDUpdateProcessorFactory">
>       <str name="fieldName">id</str>
>     </processor>
>     <processor class="solr.RunUpdateProcessorFactory" />
> </updateRequestProcessorChain>
>

Thank you Ahmet! In fact, I did not know that the
updateRequestProcessorChain needed to be defined in solrconfig.xml and
I had tried to define it in schema.xml. I don't have access to
solrconfig.xml (I am using Websolr) but I will contact them about
adding it.

Thank you.

-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com 


Re: Solr unique key can't be blank

Posted by Ahmet Arslan <io...@yahoo.com>.
> Thank you Ahmet! In fact, I did not know that the
> updateRequestProcessorChain needed to be defined in
> solrconfig.xml and
> I had tried to define it in schema.xml. I don't have access
> to
> solrconfig.xml (I am using Websolr) but I will contact them
> about
> adding it.

Please not that you need to reference it to UpdateRequestHander that you are using. (this can be extracting, dataimport etc)

  <requestHandler name="/update" class="solr.UpdateRequestHandler">
    <!-- See below for information on defining 
         updateRequestProcessorChains that can be used by name 
         on each Update Request
      -->
    
       <lst name="defaults">
         <str name="update.chain">uuid</str>
       </lst>       
  </requestHandler>


Re: Solr unique key can't be blank

Posted by Dotan Cohen <do...@gmail.com>.
On Wed, Sep 12, 2012 at 5:27 PM, Ahmet Arslan <io...@yahoo.com> wrote:
> Hi Dotan,
>
> Did you define the following update processor chain in solrconfig.xml ?
> And did you reference it in an update handler?
>
> <updateRequestProcessorChain name="uuid">
>     <processor class="solr.UUIDUpdateProcessorFactory">
>       <str name="fieldName">id</str>
>     </processor>
>     <processor class="solr.RunUpdateProcessorFactory" />
> </updateRequestProcessorChain>
>

Thank you Ahmet! In fact, I did not know that the
updateRequestProcessorChain needed to be defined in solrconfig.xml and
I had tried to define it in schema.xml. I don't have access to
solrconfig.xml (I am using Websolr) but I will contact them about
adding it.

Thank you.

-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

Re: Solr unique key can't be blank

Posted by Ahmet Arslan <io...@yahoo.com>.

--- On Wed, 9/12/12, Dotan Cohen <do...@gmail.com> wrote:

> From: Dotan Cohen <do...@gmail.com>
> Subject: Solr unique key can't be blank
> To: solr-user@lucene.apache.org
> Date: Wednesday, September 12, 2012, 5:06 PM
> Consider this simple schema:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <schema name="uuidTest" version="0.1">
>     <types>
>         <fieldType
> name="uuid" class="solr.UUIDField" indexed="true" />
>     </types>
>     <fields>
>         <field name="id"
> type="uuid" indexed="true" stored="true"
> required="true"/>
>     </fields>
> </schema>
> 
> When trying to upload it to Websolr I am getting this
> error:
> Solr unique key can't be blank
> 
> I also tried adding this element to the XML, after
> </fields>:
> <uniqueKey>id</uniqueKey>
> 
> However this did not help. What could be the issue? I The
> code is
> taken verbatim from this page:
> http://wiki.apache.org/solr/UniqueKey
> 
> Note that this is on a Solr 4 Alpha index. Thanks.

Hi Dotan,

Did you define the following update processor chain in solrconfig.xml ?
And did you reference it in an update handler?
 
<updateRequestProcessorChain name="uuid">
    <processor class="solr.UUIDUpdateProcessorFactory">
      <str name="fieldName">id</str>
    </processor>
    <processor class="solr.RunUpdateProcessorFactory" />
</updateRequestProcessorChain>