patb23
patb23

Reputation: 397

solr - Getting xyz present in DataConfig does not have a counterpart

I am using Solr 5.2. I did the following:

  1. solr create -c demo
  2. copied and placed the schema.xml in demo/conf folder. I added a field called load_date as follow:
<field name="load_date" type="string" indexed="true" stored="true" omitNorms="true"/>
  1. the data config looks like this
<document name="xyz">
  <entity name="input" query="select * from test" logLevel="debug" datasource="mbdev">
    <field column="LOAD_DATE" name="load_date" />
  </entity>
</document>

Only the id field is getting populated and is complaining that the field load_date present in DataConfig does not have a counterpart in Solr Schema. I checked my changes against example-DIH and could not see any difference.

I also noticed that the Schema Browser lists only the following fields:

I do not know which schema.xml it is referring to. How can I find this out?

Upvotes: 0

Views: 1042

Answers (2)

Guy Sh
Guy Sh

Reputation: 1

You only need to follow the type format ie add _s for string etc

See below the name and description fields, using that you don't need to touch schema file, it will map the fields types using this convention.

  <document name="Reports">
<entity name="Report" dataSource="ds1" pk="id"
  query = "select * from dbo.Roles">
    <field column="RoleID" name="id"/>
<field column="RoleName" name="name_s"/>
<field column="Description" name="description_t"/>
</entity>      

Upvotes: 0

patb23
patb23

Reputation: 397

Found out that the solrconfig was using 'managed-schema.xml'.

Here is the wiki documentation that explains the Managed Schema. I got it working after updating the managed-schema with field names.

If you want to work with Schema.xml ('ClassicIndexSchemaFactory') instead of managed-schema.xml then the following fieldtypes need to be added to the schema.xml

<fieldType name="booleans" class="solr.BoolField" sortMissingLast="true" multiValued="true"/>
<fieldType name="tdates" class="solr.TrieDateField" precisionStep="6" positionIncrementGap="0" multiValued="true"/>
<fieldType name="tlongs" class="solr.TrieLongField" precisionStep="8" positionIncrementGap="0" multiValued="true"/>
<fieldType name="tdoubles" class="solr.TrieDoubleField" precisionStep="8" positionIncrementGap="0" multiValued="true"/>

Upvotes: 0

Related Questions