天天看點

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,如需轉載請自行聯系原作者