天天看点

Nutch1.3集成Solr3.4网页快照功能实现(四)

在工程中找到“solrindex-mapping.xml”修改如下:

<fields>

        <field dest="content" source="content"/>

        <b>&lt;field dest="cache_content" source="cache_content"/&gt;</b>

<b> </b>

        &lt;field dest="site" source="site"/&gt;

        &lt;field dest="title" source="title"/&gt;

        &lt;field dest="host" source="host"/&gt;

        &lt;field dest="segment" source="segment"/&gt;

        &lt;field dest="boost" source="boost"/&gt;

        &lt;field dest="digest" source="digest"/&gt;

        &lt;field dest="tstamp" source="tstamp"/&gt;

        &lt;field dest="id" source="url"/&gt;

        &lt;copyField source="url" dest="url"/&gt;

    &lt;/fields&gt;

在Solr应用中修改“schema.xml”添加对应的Field,如下:

&lt;field name="url" type="string" indexed="true" stored="true"/&gt;

  &lt;field name="content" type="textMaxWord" indexed="true" stored="true"/&gt;

  <b>&lt;field name="cache_content" type="binary" indexed="false" stored="true"/&gt;</b>

  &lt;field name="segment" type="string" indexed="false" stored="true"/&gt;

  &lt;field name="boost" type="float" indexed="true" stored="true"/&gt;

  &lt;field name="digest" type="string" indexed="false" stored="true"/&gt;

  &lt;field name="host" type="string" indexed="true" stored="false"/&gt;

  &lt;field name="cache" type="string" indexed="true" stored="false"/&gt;

  &lt;field name="site" type="string" indexed="true" stored="false"/&gt;

  &lt;field name="anchor" type="string" indexed="true" stored="false" multiValued="true"/&gt;

  &lt;field name="tstamp" type="string" indexed="false" stored="true"/&gt;

重启服务,大功告成,solr查询返回结果如下所示:

<a href="http://blog.51cto.com/attachment/201111/134800137.png" target="_blank"></a>

 本文转自william_xu 51CTO博客,原文链接:http://blog.51cto.com/williamx/722720,如需转载请自行联系原作者