Solr 4 - missing required field: uuid
Asked Answered
C

1

6

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
Cilla answered 4/6, 2013 at 9:32 Comment(0)
T
8

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>
Tapping answered 4/6, 2013 at 9:43 Comment(2)
Perfect. Is it only me that struggles with the Solr docs formatting and where each example should be placed? :)Cilla
@Tapping I tried to incorporated changes suggested by you but still it gives me an exception like: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Error initializing QueryElevationComponent. Please try to help me out.Fado

© 2022 - 2024 — McMap. All rights reserved.