---
title: " 开源搜索引擎 solr 实践 （二）配置篇"
author: "songbin0201"
date: "2014-05-08T15:45:04Z"
tags: []
categories: ["开源软件"]
slug: "solr"
draft: false
lastmod: "2014-05-08T18:36:48Z"
id: 2063940
url: "https://dmouse.iteye.com/blog/2063940"
---

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