lucene_06_solr域

solr域在家目录下面\solr_home\collection1\conf中的schema.xml里面定义。code

域必需要先在schema.xml下定义后才能使用。xml

solr在操做Field域时须要在schema.xml中定义(根据本身的业务需求自定义)。blog

一、惟一域索引

 <!-- id 域 也叫惟一域 每个文档必须有惟一域 -->   
    <uniqueKey>id</uniqueKey>

二、动态域ip

   <!-- 动态域  *_i:通配符 -->
   <dynamicField name="*_i"  type="int"    indexed="true"  stored="true"/>
   <dynamicField name="*_is" type="int"    indexed="true"  stored="true"  multiValued="true"/>
   <dynamicField name="*_s"  type="string"  indexed="true"  stored="true" />
   <dynamicField name="*_ss" type="string"  indexed="true"  stored="true" multiValued="true"/>

三、复制域 copyField 能够将多个Field复制到一个Field中,一便进行统一检索。例如:将商品名称和商品描述组合在一块儿,在索引的时候直接索引组合内容,防止两次查询。文档

<copyField source="title" dest="text"/>

例如:搜索title标题、description内容 、author做者,咱们能够定义title、description、author的复制域string

a、先建立域it

  <field name="title" type="text_general" indexed="true" stored="true" multiValued="true"/>
   <field name="author" type="text_general" indexed="true" stored="true"/>
   <field name="description" type="text_general" indexed="true" stored="true"/>
   <field name="keywords" type="text_general" indexed="true" stored="false"/>

b、建立copyField 域io

 <!--source:源域   dest:目标域 -->
   <copyField source="title" dest="keywords"/>
   <copyField source="author" dest="keywords"/>
   <copyField source="description" dest="keywords"/>
相关文章
相关标签/搜索