在工程中找到“solrindex-mapping.xml”修改如下:
<fields>
<field dest="content" source="content"/>
<b><field dest="cache_content" source="cache_content"/></b>
<b> </b>
<field dest="site" source="site"/>
<field dest="title" source="title"/>
<field dest="host" source="host"/>
<field dest="segment" source="segment"/>
<field dest="boost" source="boost"/>
<field dest="digest" source="digest"/>
<field dest="tstamp" source="tstamp"/>
<field dest="id" source="url"/>
<copyField source="url" dest="url"/>
</fields>
在Solr应用中修改“schema.xml”添加对应的Field,如下:
<field name="url" type="string" indexed="true" stored="true"/>
<field name="content" type="textMaxWord" indexed="true" stored="true"/>
<b><field name="cache_content" type="binary" indexed="false" stored="true"/></b>
<field name="segment" type="string" indexed="false" stored="true"/>
<field name="boost" type="float" indexed="true" stored="true"/>
<field name="digest" type="string" indexed="false" stored="true"/>
<field name="host" type="string" indexed="true" stored="false"/>
<field name="cache" type="string" indexed="true" stored="false"/>
<field name="site" type="string" indexed="true" stored="false"/>
<field name="anchor" type="string" indexed="true" stored="false" multiValued="true"/>
<field name="tstamp" type="string" indexed="false" stored="true"/>
重启服务,大功告成,solr查询返回结果如下所示:
<a href="http://blog.51cto.com/attachment/201111/134800137.png" target="_blank"></a>
本文转自william_xu 51CTO博客,原文链接:http://blog.51cto.com/williamx/722720,如需转载请自行联系原作者