1. 程式人生 > >Solr中的注意點

Solr中的注意點

注意點1–注意重啟

  • 當修改了配置檔案後,一定要重啟Solr才能生效;
  • 自動補全時,插入新資料後,一定要重新build,即勾選“spellcheck”及下面的“spellcheck.build”並執行即可,此時會對所有資料更新index。

注意點2–注意延遲

有時候執行某些操作(比如新增/刪除資料)後,重新整理介面並不能看到最新資訊,請稍微等待即可。

注意點3–小心覆蓋

若匯入如下的csv檔案,則後一條記錄會覆蓋掉前一條,因為id相同。

id,file_path
908209415,"world1"
908209415,"world2"

注意點4–至少得有_version_欄位

在schema.xml可以將所有不需要的欄位刪除,只保留所需的欄位即可,但會在create collection時報錯

_version_ field must exist in schema, using indexed="true" or docValues="true", stored="true" and multiValued="false" (_version_ does not exist)

解決辦法:增加_version_欄位

<field name="_version_" type="long" indexed="true" stored="true" />

參考