solr配置copyField来实现检索
应用场景:比如我们要同时检索留言的标题和内容,就可以将标题和内容的文字一起进行索引。
如果在http://localhost:8080/solr/admin/中检索的话, 就要写入
msg_title:程序 msg_content:内容。
在solr中可以通过copyField来实现。
1. 在${solr_home}/conf/schema.xml加入留言的field.
<field name="msg_title" type="textComplex" indexed="true" stored="true" multiValued="true"/>
<field name="msg_content" type="textComplex"indexed="true" store="false"/>
<field name="msg_all" type="textComplext" indexed="true" store="false" multiValued="true"/>
2. 加入copyField
<copyField source="msg_title" dest="msg_all"/>
<copyField source="msg_content" dest="msg_all"/>
页:
[1]