【问题标题】:Nutch 1.13 index-links configurationNutch 1.13 索引链接配置
【发布时间】:2020-10-26 12:14:19
【问题描述】:

我目前正在尝试在使用 Apache Nutch 1.13 和 Solr 4.10.4 进行爬网运行期间提取 webgraph 结构。

根据文档,index-links 插件将outlinksinlinks 添加到集合中。

我已经相应地更改了我在 Solr 中的集合(传递了 schema.xml 中的相应字段并重新启动了 Solr),并调整了 solr-mapping 文件,但无济于事。 产生的错误如下所示。

bin/nutch index -D solr.server.url=http://localhost:8983/solr/collection1 crawl/crawldb/ -linkdb crawl/linkdb/ crawl/segments/* -filter -normalize -deleteGone
Segment dir is complete: crawl/segments/20170503114357.
Indexer: starting at 2017-05-03 11:47:02
Indexer: deleting gone documents: true
Indexer: URL filtering: true
Indexer: URL normalizing: true
Active IndexWriters :
SOLRIndexWriter
    solr.server.url : URL of the SOLR instance
    solr.zookeeper.hosts : URL of the Zookeeper quorum
    solr.commit.size : buffer size when sending to SOLR (default 1000)
    solr.mapping.file : name of the mapping file for fields (default solrindex-mapping.xml)
    solr.auth : use authentication (default false)
    solr.auth.username : username for authentication
    solr.auth.password : password for authentication


Indexing 1/1 documents
Deleting 0 documents
Indexing 1/1 documents
Deleting 0 documents
Indexer: java.io.IOException: Job failed!
    at org.apache.hadoop.mapred.JobClient.runJob(JobClient.java:865)
    at org.apache.nutch.indexer.IndexingJob.index(IndexingJob.java:147)
    at org.apache.nutch.indexer.IndexingJob.run(IndexingJob.java:230)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
    at org.apache.nutch.indexer.IndexingJob.main(IndexingJob.java:239)

有趣的是,我自己的研究让我假设它实际上并不简单,因为生成的解析(没有插件)看起来像这样:

bin/nutch indexchecker http://www.my-domain.com/
fetching: http://www.my-domain.com/
robots.txt whitelist not configured.
parsing: http://www.my-domain.com/
contentType: application/xhtml+xml
tstamp :    Wed May 03 11:40:57 CEST 2017
digest :    e549a51553a0fb3385926c76c52e0d79
host :  http://www.my-domain.com/
id :    http://www.my-domain.com/
title : Startseite
url :   http://www.my-domain.com/
content :   bla bla bla bla.

然而,一旦我启用index-links,输出突然变成这样:

bin/nutch indexchecker http://www.my-domain.com/
fetching: http://www.my-domain.com/
robots.txt whitelist not configured.
parsing: http://www.my-domain.com/
contentType: application/xhtml+xml
tstamp :    Wed May 03 11:40:57 CEST 2017
outlinks :  http://www.my-domain.com/2-uncategorised/331-links-administratives
outlinks :  http://www.my-domain.com/2-uncategorised/332-links-extern
outlinks :  http://www.my-domain.com/impressum.html
id :    http://www.my-domain.com/
title : Startseite
url :   http://www.my-domain.com/
content :   bla bla bla

显然,这不适合单个字段,但我只想拥有一个包含所有 outlinks 的列表(我已经读过 inlinks 不起作用,但无论如何我不需要它们)。

【问题讨论】:

    标签: solr web-crawler nutch


    【解决方案1】:

    您必须像这样指定solrindex-mapping.xml 中的字段

    <field dest="inlinks" source="inlinks"/>
    <field dest="outlinks" source="outlinks"/>
    

    然后,确保卸载重新加载集合,包括完全重启 Solr。

    你没有具体说明你是如何在schema.xml 中实现这些字段的,但对我来说,以下是有效的:

    <!-- fields for index-links plugin -->
    <field name="inlinks" type="url" stored="true" indexed="false" multiValued="true"/>
    <field name="outlinks" type="url" stored="true" indexed="false" multiValued="true"/>
    

    祝你好运!

    【讨论】:

    • 啊,谢谢你的提示!我认为实际上没有必要重新加载集合...愚蠢的我,谢谢你的提示!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-17
    • 1970-01-01
    • 2011-11-17
    • 1970-01-01
    相关资源
    最近更新 更多