Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solr 4 - missing required field: uuid

I'm having issues generating a UUID using the dataImportHandler in Solr4. Im trying to import from an existing MySQL database.

My schema.xml contains:

<fields>

    <field name="uuid" type="uuid" indexed="true" stored="true" required="true" />

    <field name="id" type="string" indexed="true" stored="true" required="true"/>
    <field name="address" type="text_general" indexed="true" stored="true"/>
    <field name="city" type="text_general" indexed="true" stored="true" />
    <field name="county" type="string" indexed="true" stored="true" />
    <field name="lat" type="text_general" indexed="true" stored="true" />
    <field name="lng" type="text_general" indexed="true" stored="true" termVectors="true" termPositions="true" termOffsets="true" />
    <field name="price"  type="float" indexed="true" stored="true"/>
    <field name="bedrooms" type="float" indexed="true" stored="true" />
    <field name="image" type="string" indexed="true" stored="true"/>

    <field name="region" type="location_rpt" indexed="true" stored="true" />       

    <defaultSearchField>address</defaultSearchField>

    <field name="_version_" type="long" indexed="true" stored="true"/>
    <field name="text" type="text_general" indexed="true" stored="false" multiValued="true"/>

 </fields>

 <uniqueKey>uuid</uniqueKey>

and then in <types>

  <fieldType name="uuid" class="solr.UUIDField" indexed="true" />

My Solrconfig.xml contains:

 <requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">  

  <updateRequestProcessorChain name="uuid">
      <processor class="solr.UUIDUpdateProcessorFactory">
          <str name="fieldName">uuid</str>
      </processor>
      <processor class="solr.RunUpdateProcessorFactory" />
  </updateRequestProcessorChain>

 <lst name="defaults">
    <str name="config">data-config.xml</str>
 </lst>

Whenever I run the update, some docs are inserted ok , buy many return with:

org.apache.solr.common.SolrException: [doc=204] missing required field: uuid
like image 631
Kikimac Avatar asked Jun 04 '13 09:06

Kikimac


1 Answers

Going by the example at link it should be

<requestHandler name="/dataimport"  class="org.apache.solr.handler.dataimport.DataImportHandler">  
    .........
    <lst name="defaults">
        <str name="config">data-config.xml</str>
        <str name="update.chain">uuid</str>
    </lst>
</requestHandler>

<updateRequestProcessorChain name="uuid">
  <processor class="solr.UUIDUpdateProcessorFactory">
      <str name="fieldName">uuid</str>
  </processor>
  <processor class="solr.RunUpdateProcessorFactory" />
</updateRequestProcessorChain>
like image 66
Jayendra Avatar answered Nov 16 '22 11:11

Jayendra