簡體   English   中英

SOLR 4.10.2 - 添加具有默認值的字段

[英]SOLR 4.10.2 - Add field with default value

我有一個 SOLR Core 4.10.2

我想為核心中的所有行添加一個帶有索引 IDX_VehicalType 的字段 VehicalType,其默認值為“car”。 - 我希望這個字段填充“汽車”

我已經能夠使用 schema.xml 中的以下內容成功添加字段和索引,並從 Core Admin 重新加載核心:

<field name="IDX_VehicleType" type="text_Exact" indexed="true" stored="false" multiValued="true"/>
<field name="VehicleType" type="string" indexed="true" stored="true"/>
<copyField source="VehicleType" dest="IDX_VehicleType"/>

當我嘗試使用默認屬性為該字段提供默認值並重新加載並從 Core Admin 優化核心時,該字段未填充。

<field name="IDX_VehicleType" type="text_Exact" indexed="true" stored="false" multiValued="true" default="car"/>
<field name="VehicleType" type="string" indexed="true" stored="true" default="car"/>
<copyField source="VehicleType" dest="IDX_VehicleType"/>

我在架構瀏覽器中看到了該字段,但它沒有顯示在結果中。

此更改屬於需要在 SOLR 中重新索引以反映字段中的值的更改類別。 重復一遍,如果我們想用索引中現有文檔的默認值填充該字段,我們需要重新索引索引中的所有文檔。

對於未來對索引的任何添加/更新,默認字段值將由 SOLR 根據新架構自動設置。

更多相關信息: https : //solr.apache.org/guide/8_0/reindexing.html#changed-field-and-field-type-properties https://solr.apache.org/guide/8_0/defining-fields .html#field-properties

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM