请你提供一份solr8.7.0的schema.xml模板
时间: 2023-12-07 20:06:06 浏览: 142
xml schema实例
4星 · 用户满意度95%
以下是Solr 8.7.0版本的schema.xml模板,你可以根据自己的需求进行相应的修改。
```
<?xml version="1.0" encoding="UTF-8"?>
<schema name="example" version="1.6">
<types>
<fieldType name="string" class="solr.StrField" sortMissingLast="true" />
<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory" />
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
<filter class="solr.LowerCaseFilterFactory" />
<filter class="solr.EnglishMinimalStemFilterFactory" />
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory" />
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
<filter class="solr.SynonymGraphFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true" />
<filter class="solr.LowerCaseFilterFactory" />
<filter class="solr.EnglishMinimalStemFilterFactory" />
</analyzer>
</fieldType>
<fieldType name="date" class="solr.DatePointField" />
<fieldType name="int" class="solr.IntPointField" />
<fieldType name="long" class="solr.LongPointField" />
<fieldType name="float" class="solr.FloatPointField" />
<fieldType name="double" class="solr.DoublePointField" />
<fieldType name="boolean" class="solr.BoolField" />
</types>
<fields>
<field name="id" type="string" indexed="true" stored="true" multiValued="false" required="true" />
<field name="title" type="text_general" indexed="true" stored="true" multiValued="false" />
<field name="content" type="text_general" indexed="true" stored="true" multiValued="false" />
<field name="date" type="date" indexed="true" stored="true" multiValued="false" />
<field name="price" type="double" indexed="true" stored="true" multiValued="false" />
<field name="location" type="string" indexed="true" stored="true" multiValued="false" />
<field name="category" type="string" indexed="true" stored="true" multiValued="false" />
<field name="is_new" type="boolean" indexed="true" stored="true" multiValued="false" />
<dynamicField name="*_i" type="int" indexed="true" stored="true" multiValued="false" />
<dynamicField name="*_l" type="long" indexed="true" stored="true" multiValued="false" />
<dynamicField name="*_f" type="float" indexed="true" stored="true" multiValued="false" />
<dynamicField name="*_d" type="double" indexed="true" stored="true" multiValued="false" />
<dynamicField name="*_dt" type="date" indexed="true" stored="true" multiValued="false" />
</fields>
<uniqueKey>id</uniqueKey>
<defaultSearchField>content</defaultSearchField>
<solrQueryParser defaultOperator="OR" />
</schema>
```
其中,该模板定义了一些常用的字段类型,如string、text_general、date、int、long、float、double和boolean等。同时,该模板还定义了一些常用的字段,如id、title、content、date、price、location、category和is_new等,以及动态字段。你可以根据自己的需求进行相应的添加和修改。
阅读全文