【问题标题】:Indexing issue in Nutch-Solr (Want to display data in solr)Nutch-Solr 中的索引问题(想要在 solr 中显示数据)
【发布时间】:2013-10-05 06:46:45
【问题描述】:

我正在尝试使用 NutchIndex Solr 中的数据抓取数据

我已按照此 URL Using Nutch with SolrNutch Wiki Tutorial 中的步骤进行操作

我已经成功地使用 Solrindex 命令

索引数据

bin/nutch solrindex http://127.0.0.1:8983/solr/ crawl/crawldb -linkdb crawl/linkdb crawl/segments/* 但在结果中我找不到索引数据。

我想要的结果如下 Image

但我在右侧看不到任何结果数据。

【问题讨论】:

    标签: solr lucene nutch


    【解决方案1】:

    如果您希望在搜索响应中返回一些数据,请检查目标字段是否由 solr 存储,然后您可以使用 fl 参数设置要在查询中返回的字段列表(存储字段名称为价值)。您还可以在 solrconfig.xml 中设置默认 fl 值。

    例如,假设您希望返回 content 字段。在您的 schema.xml 中,在 <fields> 声明中,您应该有该字段的选项 stored="true",如下所示:

    <field name="content" type="text" indexed="true" stored="true"/>
    

    然后在solrconfig.xml中,在requestHandler定义中声明默认的fl参数,可以设置具体的字段(空格分隔的字段名)。如果我们只想返回存储在content 字段中的数据,xml 示例(从教程中获取)应该如下所示。

    <requestHandler name="/nutch" class="solr.SearchHandler" >
      <lst name="defaults">
        <str name="defType">dismax</str>
        <str name="echoParams">explicit</str>
        <float name="tie">0.01</float>
        <str name="qf">
        content^0.5 anchor^1.0 title^1.2
        </str>
        <str name="pf">
        content^0.5 anchor^1.5 title^1.2 site^1.5
        </str>
        <str name="fl">
        url content
        </str>
        <str name="mm">
        2&lt;-1 5&lt;-2 6&lt;90%
        </str>
        <int name="ps">100</int>
        <bool hl="true"/>
        <str name="q.alt">*:*</str>
        <str name="hl.fl">title url content</str>
        <str name="f.title.hl.fragsize">0</str>
        <str name="f.title.hl.alternateField">title</str>
        <str name="f.url.hl.fragsize">0</str>
        <str name="f.url.hl.alternateField">url</str>
        <str name="f.content.hl.fragmenter">regex</str>
      </lst>
    </requestHandler>
    

    您可以直接在查询中覆盖这些默认值。一个常见的用例是将“*,score”放在 solr 查询界面的 fl 区域,这样您就可以看到所有存储的字段(使用通配符 *)以及结果中的分数。您可能还想根据目标请求处理程序(应为“/nutch”)指定查询类型参数(qt)。

    有用的链接:

    http://wiki.apache.org/solr/SchemaXml#Common_field_options http://wiki.apache.org/solr/CommonQueryParameters#fl

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-26
      • 1970-01-01
      • 2012-11-05
      • 1970-01-01
      • 1970-01-01
      • 2017-07-06
      相关资源
      最近更新 更多