新字段未显示在搜索中

New FIELDS are not showing in search

我做了一个基本的 solr 设置,配置了 dataImportHandler 并创建了非常简单的包含两个字段的数据配置文件并为其编制了索引。一切正常..但现在我在那里添加新字段并在此之后进行完全导入但由于某种原因新字段没有显示在搜索结果中(使用 solr 界面进行搜索)。我已经尝试重新启动 solr,运行 config-reload 没有效果。

这是我的数据配置文件。不确定这里有什么问题。

<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>

您可以在 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"/>

根据您的需要添加什么类型(fieldType)由您决定。

  • indexed: true 如果这个字段应该被索引(可搜索或 可排序)
  • stored: true if this field should be retrievable

添加以下标签:

<uniqueKey>id</uniqueKey>

这是用来确定和加强文档的唯一性。