工欲善其事,必先利其器,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"/>
本文介绍了Solr的关键配置文件schema.xml的作用及其配置方法。通过实例展示了如何定义数据类型、字段及分词器,确保Solr能正确地为所需字段建立索引。
871

被折叠的 条评论
为什么被折叠?



