天天看點

開源搜尋引擎 solr 實踐 (二)配置篇1、schema.xml

     工欲善其事,必先利其器,solr安裝好了,但是投入使用前,還需要了解幾個關鍵的配置檔案

1、schema.xml

 schemal.xml 位于conf/目錄下,schema.xml中定義了solr的資料類型,需要建立索引的字段及分詞器

假設我們有一個對象A:{"name":"xxxxx","age":12,"title":"xxxxx"}

需要在schemal中定義該對象的字段,這樣才能保證solr對這些字段建立索引,示例如下:

<field name="name" type="string" indexed="true" stored="true"/>
<field name="age" type="string" indexed="true" stored="true"/>
<field name="title" type="string" indexed="true" stored="true"/>      

繼續閱讀