应用场景:
比如我们要同时检索留言的标题和内容,就可以将标题和内容的文字一起进行索引。
如果在[url]http://localhost:8080/solr/admin/[/url]中检索的话, 就要写入
msg_title:程序 msg_content:内容。
在solr中可以通过copyField来实现。
1. 在${solr_home}/conf/schema.xml加入留言的field.
2. 加入copyField
比如我们要同时检索留言的标题和内容,就可以将标题和内容的文字一起进行索引。
如果在[url]http://localhost:8080/solr/admin/[/url]中检索的话, 就要写入
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"/>
本文介绍如何使用Apache Solr进行全文检索配置,通过实例演示了如何设置字段并将多个字段的内容合并到一个字段中以实现同时搜索标题和内容的功能。

7350

被折叠的 条评论
为什么被折叠?



