0

When I try to do import of schooLocationDetails solr core, I get below error . Using Solr 5.3.1

Exception while processing: opportunityDetails document : SolrInputDocument(fields: []):org.apache.solr.handler.dataimport.DataImportHandlerException: org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://:<solr_pwd>@<solr_server>:<solr_port>/solr/locationCore: org.apache.solr.search.SyntaxError: Cannot parse 'locationId:': Encountered "" at line 1, column 22.

Below is my data-config.xml for the solr core schooLocationDetails.

<dataConfig>
<document>
<entity name="school" dataSource="datasource" query="select * from school_table" transformer="RegexTransformer">
<field column="recordKey" name="recordKey" />
<field column="name" name="name" /> 
<field column="location" name="location" /> 
<field column="title" name="title" />   
</entity>
<entity name="locationDetail" processor="SolrEntityProcessor" url="http://<solr-user>:<solr_pwd>@<solr_server>:<solr_port>/solr/locationCore" query="locationId:${school.location}" 
fl="*,old_version:_version_">

<field column="locationId" name="locationId" />
<field column="city" name="city" />
<field column="state" name="state" />
<field column="old_version" name="old_version" />
</entity>       
</document>  
</dataConfig>
user_mes
  • 55
  • 1
  • 5
  • The `school.location` value is empty. Why that's the case is hard to say without your complete file, but I'm guessing since you don't have the lower `` as a child of the other entity, it doesn't have access to the values retrieved in your primary query. – MatsLindh Aug 11 '20 at 14:00
  • Hi just updated the code.. it was not formatted well – user_mes Aug 11 '20 at 14:03
  • The issue I mentioned is still present - I'm not sure you'll be able to access the value from the other entity when your SolrEntityProcessor is not a sub-entity of the one you want to reference. You can add a log transformer to your entity to log what data is available (and it seems you have a unused regextransformer defined). – MatsLindh Aug 12 '20 at 07:57
  • Thanks MatsLindh. This is resolved after I added SolrEntityProcessor as child entity – user_mes Aug 12 '20 at 14:34

1 Answers1

0

You have to add the entity referencing the value inside the other entity. When they're two separate entities, they can't reference each other values (and they'll be imported after each other instead).

<entity name="school" dataSource="datasource" query="select * from school_table" transformer="RegexTransformer">
    <field column="recordKey" name="recordKey" />
    <field column="name" name="name" /> 
    <field column="location" name="location" /> 
    <field column="title" name="title" />   

    <entity name="locationDetail" processor="SolrEntityProcessor" url="" query="locationId:${school.location}" 
  fl="*,old_version:_version_">
        <field column="locationId" name="locationId" />
        <field column="city" name="city" />
        <field column="state" name="state" />
        <field column="old_version" name="old_version" />
    </entity> 
</entity>
MatsLindh
  • 49,529
  • 4
  • 53
  • 84