2017-08-16 84 views
0

我有特定主題的小種子。我希望Nutch只應遵循預期涉及相關主題的那些外部鏈接(它可能僅僅是一種啓發式)。我該怎麼做。如果我必須寫一些插件,那麼擴展點應該是什麼。有沒有可用的例子。在Apache Nutch 2.3.1中選取的外部URL獲取

回答

0

對於您的特殊情況,您可以嘗試使用​​插件,您可以在NUTCH-2038中找到關於它的更多信息。請記住,這是以某種方式與您的用例保持一致的某種常規解決方案提供的。當然,現實可能會有所不同。

不過,如果您能想出一個很好的啓發式方法來檢測鏈接是否是一個很好的候選者,那麼您可以在HtmlParseFilter中實現該鏈接,然後您可以選擇應該返回哪些鏈接。請記住,在這個階段,您可能只有關於可能的outlink的唯一信息是URL。

0

設置你的Nutch的配置Nutch的-default.xml中

<property> 
    <name>db.ignore.internal.links</name> 
    <value>true</value> 
    <description>If true, when adding new links to a page, links from 
    the same host are ignored. This is an effective way to limit the 
    size of the link database, keeping only the highest quality 
    links. 
    </description> 
</property> 

<property> 
    <name>db.ignore.external.links</name> 
    <value>false</value> 
    <description>If true, outlinks leading from a page to external hosts 
    will be ignored. This is an effective way to limit the crawl to include 
    only initially injected hosts, without creating complex URLFilters. 
    </description> 
</property>