solrcore的schema.xml
schema.xml文件在SolrCore的conf目录下,它是Solr数据表配置文件,在此配置文件中定义了域以及域的类型还有其他一些配置,在solr中域必须先定义后使用 <field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
Name:域的名称 <!-- A general text field that has reasonable,generic cross-language defaults: it tokenizes with StandardTokenizer,removes stop words from case-insensitive "stopwords.txt" (empty by default),and down cases. At query time only,it also applies synonyms. -->
<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" />
<!-- in this example,we will only use synonyms at query time <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/> -->
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
name:域类型的名称 <uniqueKey>id</uniqueKey>
相当于主键,每个文档中必须有一个id域。 <copyField source="cat" dest="text" />
可以将多个Field复制到一个Field中,以便进行统一的检索。当创建索引时,solr服务器会自动的将源域的内容复制到目标域中。 <!-- catchall field,containing all other searchable text fields (implemented via copyField further on in this schema -->
<field name="text" type="text_general" indexed="true" stored="false" multiValued="true"/>
<dynamicField name="*_i" type="int" indexed="true" stored="true"/>
Name:动态域的名称,是一个表达式,*匹配任意字符,只要域的名称和表达式的规则能够匹配就可以使用。 例如:搜索时查询条件【product_i:钻石】就可以匹配这个动态域,可以直接使用,不用单独再定义一个product_i域。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |