Ankit
Ankit

Reputation: 1887

New FIELDS are not showing in search

I did a basic solr setup, Configured dataImportHandler and create very simple data config file with two fields and indexed it. It all worked fine.. But now I am adding new fields there and doing full import after that but for some reason new fields are just not showing in search result ( using solr interface for search). I have tried restarting solr, running config-reload to no effect.

this is my data config file. Not sure what's wrong here.

<dataConfig>
    <dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/msl4" user="root" password=""/>
    <document>
        <entity name="hub_contents" query="select * from hub_contents" deltaQuery="select * from hub_contents where last_modified > '${dataimporter.last_index_time}'">

            <field column="id_original" name="id" />
            <field column="title" name="title" />
            <field column="parent_id" name="parent_id" />
            <field column="item_type" name="item_type" />
            <field column="status" name="status" />
            <field column="updated_at" name="updated_at" />


        </entity>
    </document>
</dataConfig>

Upvotes: 0

Views: 117

Answers (1)

Abhijit Bashetti
Abhijit Bashetti

Reputation: 8678

You can add the below fields in your schema.xml

<field name="id" type="long" indexed="true" stored="true"/>
<field name="title" type="text_general" indexed="true" stored="true"/>
<field name="parent_id" type="long" indexed="true" stored="true"/>
<field name="item_type" type="text_general" indexed="true" stored="true"/>
<field name="status" type="text_general" indexed="true" stored="true" />
<field name="updated_at" type="date" indexed="true" stored="true"/>

It is left to you what type(fieldType) you want to add depending on your requirement.

  • indexed: true if this field should be indexed (searchable or sortable)
  • stored: true if this field should be retrievable

Add the below tag:

<uniqueKey>id</uniqueKey>

This is to use to determine and enforce document uniqueness.

Upvotes: 1

Related Questions