Nutch 1.13 索引链接配置
Nutch 1.13 index-links configuration
我目前正尝试在使用 Apache Nutch 1.13 和 Solr 4.10.4 进行爬网 运行 期间提取 webgraph 结构。
根据文档,索引链接插件将 outlinks
和 inlinks
添加到集合中。
我已经相应地更改了我在 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
不起作用,但我知道反正不需要它们)。
您必须像这样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"/>
问好,祝你好运!
我目前正尝试在使用 Apache Nutch 1.13 和 Solr 4.10.4 进行爬网 运行 期间提取 webgraph 结构。
根据文档,索引链接插件将 outlinks
和 inlinks
添加到集合中。
我已经相应地更改了我在 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
不起作用,但我知道反正不需要它们)。
您必须像这样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"/>
问好,祝你好运!