1

Nutch 2.0 を使用していくつかの Web サイトをクロールしていますが、タイトルや説明などの HTML メタ タグが抽出され、MySQL データベースに保存されていません。どうすればそれを機能させることができますか?

ありがとうアーラッシュ

4

4 に答える 4

5

の定義にparse-metatagsindex-metadataプラグインを必ず含めてください。plugin.includesnutch-site.xml

metatags.names index.parse.md次に、プロパティを追加index.content.mdし、それらを適切なタグにポイントします。私のものを見てください:

<property>
        <name>plugin.includes</name>
        <value>protocol-http|protocol-httpclient|urlfilter-regex|parse-(html|tika|metatags)|index-(basic|anchor|metadata)|scoring-opic|urlnormalizer-(pass|regex|basic)</value>
</property>
<property>
        <name>metatags.names</name>
        <value>*</value>
</property>
<property>
        <name>index.parse.md</name>
        <value>metatag.description,metatag.author,metatag.twitter:image</value>
</property>
<property>
        <name>index.content.md</name>
        <value>author,description,twitter:image</value>
</property>

構成をテストします。readwrite.com の記事に対してこのテストを実行しました。

bin/nutch indexchecker http://readwrite.com/2013/03/20/whats-behind-china-attacks-on-apple-and-android

出力は、正しい値を解析しているかどうかを示します。私の場合、私は欲しかったauthordescriptionそしてtwitter:image

fetching: http://readwrite.com/2013/03/20/whats-behind-china-attacks-on-apple-and-android
parsing: http://readwrite.com/2013/03/20/whats-behind-china-attacks-on-apple-and-android
contentType: text/html
content :   What's Really Behind China's Attacks On Apple And Android? – ReadWrite Sections Sections Social Mobi
title : What's Really Behind China's Attacks On Apple And Android? – ReadWrite
host :  readwrite.com
metatag.author :    Brian S Hall
tstamp :    Wed Mar 20 13:33:38 EDT 2013
metatag.twitter:image : http://readwrite.com/files/styles/150_150sc/public/fields/China%20graphic%20brian%20final.jpg
metatag.description :   Repeated outbursts suggest China could be growing concerned over America's dominance in the smartpho
url :   http://readwrite.com/2013/03/20/whats-behind-china-attacks-on-apple-and-android

欠点は、parse-metatagsプロパティではなく名前でのみタグに一致することです。たとえば<meta name="foo" content="bar">、Open Graph タグのようなもの<meta property="og:image" content="http://readwrite.com/sample.jpg" />は見逃されますが、問題ありません。

于 2013-03-20T17:48:24.360 に答える
0

Nutch 2.x に関する 最新のパッチを参照してください
。データベースにメタデータを保存することはできますが、Solr に転送する方法がわかりません。

于 2014-03-11T23:04:33.697 に答える