开源搜索引擎 solr 实践 (二)配置篇

     工欲善其事,必先利其器,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"/>

猜你喜欢

转载自dmouse.iteye.com/blog/2063940