Web crawler Stormcrawler:ApacheTika用于解析PDF属性

Web crawler Stormcrawler:ApacheTika用于解析PDF属性,web-crawler,apache-tika,stormcrawler,Web Crawler,Apache Tika,Stormcrawler,我已经添加了Tika作为我的StormCrawler实现的参考,它可以在爬网中获取PDF文档。但是,标题、作者和其他属性不会被解析。我尝试了“index.md.mapping:”的不同组合,并向ES_IndexInit添加了相应的属性,但PDF文档的Kibana(索引)中的内容字段始终为空。一切都适用于HTML页面。如果我遗漏了一些东西,或者我可以看一个例子,你能帮我提些建议吗 es爬虫。流量: 名称:“爬虫” 包括: -资源:真的 文件:“/crawler default.yaml” 覆盖

我已经添加了Tika作为我的StormCrawler实现的参考,它可以在爬网中获取PDF文档。但是,标题、作者和其他属性不会被解析。我尝试了“index.md.mapping:”的不同组合,并向ES_IndexInit添加了相应的属性,但PDF文档的Kibana(索引)中的内容字段始终为空。一切都适用于HTML页面。如果我遗漏了一些东西,或者我可以看一个例子,你能帮我提些建议吗


es爬虫。流量:


名称:“爬虫”

包括: -资源:真的 文件:“/crawler default.yaml” 覆盖:false

- resource: false
  file: "crawler-conf.yaml"
  override: true

- resource: false
  file: "es-conf.yaml"
  override: true
- resource: false
  file: "crawler-conf.yaml"
  override: true

- resource: false
  file: "es-conf.yaml"
  override: true

- resource: false
  file: "injection-conf.yaml"
  override: true
喷口: -id:“喷口” 类名:“com.digitalpebble.stormcrawler.elasticsearch.persistence.AggregationSpout” 平行度:10

螺栓: -id:“分割者” 类名:“com.digitalpebble.stormcrawler.bolt.URLPartitionerBolt” 平行度:1 -id:“抓取器” 类名:“com.digitalpebble.stormcrawler.bolt.FetcherBolt” 平行度:1 -id:“站点地图” 类名:“com.digitalpebble.stormcrawler.bolt.SiteMapParserBolt” 平行度:1 -id:“解析” 类名:“com.digitalpebble.stormcrawler.bolt.JSoupParserBolt” 平行度:5 -id:“索引” 类名:“com.digitalpebble.stormcrawler.elasticsearch.bolt.IndexerBolt” 平行度:1 -id:“状态” 类名:“com.digitalpebble.stormcrawler.elasticsearch.persistence.StatusUpdaterBolt” 平行度:1 -id:“状态度量” 类名:“com.digitalpebble.stormcrawler.elasticsearch.metrics.StatusMetricsBolt” 平行度:4 -id:“重新定向螺栓” 类名:“com.digitalpebble.stormcrawler.tika.RedirectionBolt” 平行度:1 -id:“螺栓” 类名:“com.digitalpebble.stormcrawler.tika.ParserBolt” 平行度:1

溪流: -来自:“喷口” 致:“分割者” 分组: 类型:洗牌

  • 来自:“喷口” 致:“状态度量” 分组: 类型:洗牌

  • 来自:“分割者” 致:“取数器” 分组: 类型:字段 参数:[“键”]

  • 摘自:“抓取者” 至:“网站地图” 分组: 类型:本地\u或\u洗牌

  • 来自:“网站地图” 至:“解析” 分组: 类型:本地\u或\u洗牌

  • 来自:“解析” 致:“索引” 分组: 类型:本地\u或\u洗牌

  • 摘自:“抓取者” 致:“地位” 分组: 类型:字段 参数:[“url”] streamId:“状态”

  • 来自:“网站地图” 致:“地位” 分组: 类型:字段 参数:[“url”] streamId:“状态”

  • 来自:“解析” 致:“地位” 分组: 类型:字段 参数:[“url”] streamId:“状态”

  • 从:“索引” 致:“地位” 分组: 类型:字段 参数:[“url”] streamId:“状态”

  • 来自:“解析” 致:“重新定向螺栓” 分组: 类型:本地\u或\u洗牌

  • 发自:“你的螺栓” 致:“螺栓” 分组: 类型:本地\u或\u洗牌

  • 发自:“你的螺栓” 致:“索引” 分组: 类型:本地\u或\u洗牌

  • 发件人:“parser_bolt” 致:“索引” 分组: 类型:本地\u或\u洗牌

es喷油器。流量:

名称:“喷油器”

包括: -资源:真的 文件:“/crawler default.yaml” 覆盖:false

- resource: false
  file: "crawler-conf.yaml"
  override: true

- resource: false
  file: "es-conf.yaml"
  override: true
- resource: false
  file: "crawler-conf.yaml"
  override: true

- resource: false
  file: "es-conf.yaml"
  override: true

- resource: false
  file: "injection-conf.yaml"
  override: true
组成部分: -id:“方案” 类名:“com.digitalpebble.stormcrawler.util.StringTabScheme” 构造器参数: -发现

喷口: -id:“喷口” 类名:“com.digitalpebble.stormcrawler.spout.FileSpout” 平行度:1 构造器参数: - "." -“seeds.txt” -参考:“方案”

螺栓: -id:“状态” 类名:“com.digitalpebble.stormcrawler.elasticsearch.persistence.StatusUpdaterBolt” 平行度:1 -id:“螺栓” 类名:“com.digitalpebble.stormcrawler.tika.ParserBolt” 平行度:1

溪流: -来自:“喷口” 致:“地位” 分组: 类型:字段 参数:[“url”]

pom.xml:

http://maven.apache.org/maven-v4_0_0.xsd“>

4.0.0
xyz.com
搜索
search1.0
罐子
UTF-8
org.apache.maven.plugins
maven编译器插件
3.2
1.8
1.8
org.codehaus.mojo
execmaven插件
1.3.2
执行官
JAVA
真的
假的
编译
org.apache.maven.plugins
maven阴影插件
1.3.3
包裹
阴凉处
假的
org.apache.storm.flux.flux
*:*
META-INF/*.SF
META-INF/*.DSA
META-INF/*.RSA
org.apache.storm
风暴核心
1.1.1
假如
org.apache.storm
磁芯
1.0.2
com.digitalpebble.stormcrawler
风暴爬虫
  indexer.md.mapping:
  - parse.title=title
  - parse.Author=author
 @Test
public void testMetadata() throws IOException {

    bolt.prepare(new HashMap(), TestUtil.getMockedTopologyContext(),
            new OutputCollector(output));

    parse("https://www.adobe.com/digitalimag/pdfs/about_metadata.pdf",
            "about_metadata.pdf");

    List<List<Object>> outTuples = output.getEmitted();

    // single document
    Assert.assertEquals(1, outTuples.size());
    // metadata
    Metadata md = (Metadata) outTuples.get(0).get(2);
    Assert.assertTrue(
            md.getFirstValue("parse.pdf:docinfo:subject").contains(
                    "By simple definition, metadata is data about data. Metadata is structured information that explains, describes, or locates the original primary data, or that otherwise makes using the original primary data more efficient."));

}
from: "redirection_bolt"
to: "parser_bolt"
grouping:
  type: LOCAL_OR_SHUFFLE
  streamId: "tika"