<property>
<name>http.max.delays</name>
<value>20</value>
<description>The number of times a thread will delay when trying to
fetch a page. Each time it finds that a host is busy, it will wait
fetcher.server.delay. After http.max.delays attepts, it will give
up on the page for now.</description>
</property>
爬虫的网络延时线程等待时间,以秒计时 , 默认的配时间是3秒,视网络状况而定。如果在爬虫运行的时候发现服务器返回了主机忙消息,则等待时间由fetcher.server.delay 决定,所以在网络状况不太好的情况下fetcher.server.delay 也设置稍大一点的值较好,此外还有一个http.timeout 也和网络状况有关系。
<property>
<name>http.content.limit</name>
<value>65536</value>
<description>The length limit for downloaded content, in bytes.
If this value is nonnegative (>=0), content longer than it will be truncated;
otherwise, no truncation at all.
</description>
</property>
描述爬虫抓取的文档内容长度的配置项。原来的值是 65536 , 也就是说抓取到的一个文档截取 65KB左右,超过部分将被忽略,对于抓取特定内容的搜索引擎需要修改此项,比如XML文档。
<property>
<name>db.default.fetch.interval</name>
<value>30</value>
<description>The default number of days between re-fetches of a page.
</description>
</property>
这个功能对定期自动爬取需求的开发有用,设置多少天重新爬一个页面。
<property>
<name>fetcher.server.delay</name>
<value>5.0</value>
<description>The number of seconds the fetcher will delay between
successive requests to the same server.</description>
</property>
<property>
<name>fetcher.threads.fetch</name>
<value>10</value>
<description>The number of FetcherThreads the fetcher should use.
This is also determines the maximum number of requests that are
made at once (each FetcherThread handles one connection).</description>
</property>
<property>
<name>fetcher.threads.per.host</name>
<value>1</value>
<description>This number is the maximum number of threads that
should be allowed to access a host at one time.</description>
</property>
<property>
<name>fetcher.verbose</name>
<value>false</value>
<description>If true, fetcher will log more verbosely.</description>
</property>
这几个是爬虫线程的配置项,看名称就容易理解。
<property>
<name>parser.threads.parse</name>
<value>10</value>
<description>Number of ParserThreads ParseSegment should use.</description>
</property>
解析爬取到的文档线程数, 和爬虫线程对应,因为爬虫主要的处理类是有很多地方使用到了同步,所以此配置项和爬虫线程保持一直对处理有好处。
<property>
<name>fs.default.name</name>
<value>local</value>
<description>The name of the default file system. Either the
literal string "local" or a host:port for NDFS.</description>
</property>
分布式文件系统 使用的配置项,默认的是 local 表示 使用本地文件系统,如果使用 host:port 的形式表示使用分布式文件系统NDFS,此处的文件系统地址是 nameserver ,也就是通过 bin/nutch namenode xxxx启动的 主机地址和端口号。
<property>
<name>ndfs.name.dir</name>
<value>/tmp/nutch/ndfs/name</value>
<description>Determines where on the local filesystem the NDFS name node
should store the name table.</description>
</property>
分布式文件系统namenode 使用的 的存放数据的目录 ,Namenode 会使用此项,另外在启动 namenode 或datanode的时候也可以加上 路径作为参数也可以生效。
<property>
<name>ndfs.data.dir</name>
<value>/tmp/nutch/ndfs/data</value>
<description>Determines where on the local filesystem an NDFS data node
should store its blocks.</description>
</property>
分布式文件系统ndatanode 使用的 的存放数据的目录 ,datanode 会使用此项,另外在启动 datanode的时候也可以加上 路径作为参数也可以生效。
<property>
<name>indexer.max.tokens</name>
<value>10000</value>
<description>
The maximum number of tokens that will be indexed for a single field
in a document. This limits the amount of memory required for
indexing, so that collections with very large files will not crash
the indexing process by running out of memory.
Note that this effectively truncates large documents, excluding
from the index tokens that occur further in the document. If you
know your source documents are large, be sure to set this value
high enough to accomodate the expected size. If you set it to
Integer.MAX_VALUE, then the only limit is your memory, but you
should anticipate an OutOfMemoryError.
</description>
</property>
这个配置项的功能是限制索引的时候每个文档的单个字段最大10000个Tokens,也就是说在采用默认的一元分词的 情况下,最大的文档字数限制是10000,如果采用其他中文非一元分词系统,则索引的单个文档单个字段将会超过10000个,对内存有影响。
<property>
<name>indexer.mergeFactor</name>
<value>200</value>
<description>The factor that determines the frequency of Lucene segment
merges. This must not be less than 2, higher values increase indexing
speed but lead to increased RAM usage, and increase the number of
open file handles (which may lead to "Too many open files" errors).
NOTE: the "segments" here have nothing to do with Nutch segments, they
are a low-level data unit used by Lucene.
</description>
</property>
合并因子,在建立索引的时候用到,表示索引200个文档的时候回写到存储设备。
<property>
<name>indexer.minMergeDocs</name>
<value>50</value>
<description>This number determines the minimum number of Lucene
Documents buffered in memory between Lucene segment merges. Larger
values increase indexing speed and increase RAM usage.
</description>
</property>
这个配置项对内存影响巨大,功能是在建立索引的时候最小的合并文档数量,这个值设置太小一个会影响索引速度,另外一个在需要索引的文档数量很大的时候会出现 Too Many Open files 的错误,这个时候需要调整此配置项,有试验表明1000的时候会有比较快的索引速度,但我把此项值调整到10000 , 索引的时候最高内存占用到1.8G,索引创建速度是25page/sec , 并且多次索引的时候有一个衰减。不过对查询的相应时间有很大提升,如果内存足够的话修改较大的值比较好。
<property>
<name>indexer.maxMergeDocs</name>
<value>50</value>
<description>This number determines the maximum number of Lucene
Documents to be merged into a new Lucene segment. Larger values
increase indexing speed and reduce the number of Lucene segments,
which reduces the number of open file handles; however, this also
increases RAM usage during indexing.
</description>
</property>
这个好像不需要设置,因为默认的值是 Integer.MAX_VALUE , 不会比这个更大了。
<property>
<name>searcher.summary.context</name>
<value>5</value>
<description>
The number of context terms to display preceding and following
matching terms in a hit summary.
</description>
</property>
这个比较有用,在前面的文章里有介绍。
<property>
<name>searcher.summary.length</name>
<value>20</value>
<description>
The total number of terms to display in a hit summary.
</description>
</property>
在前面的文章里也有介绍。
<property>
<name>plugin.folders</name>
<value>plugins</value>
<description>Directories where nutch plugins are located. Each
element may be a relative or absolute path. If absolute, it is used
as is. If relative, it is searched for on the classpath.</description>
</property>
<property>
<name>plugin.includes</name>
<value>protocol-httpclient|urlfilter-regex|parse-(text|html|rss)|index-more|query-(basic|site|url)</value>
<description>Regular expression naming plugin directory names to
include. Any plugin not matching this expression is excluded. By
default Nutch includes crawling just HTML and plain text via HTTP,
and basic indexing and search plugins.
</description>
</property>
这两个是配置 插件功能 的配置项 ,plugin.folders制定插件加载路径,plugin.includes表示需要加载的插件列表,关于插件后面会专门做介绍。
<property>
<name>parser.character.encoding.default</name>
<value>windows-1252</value>
<description>The character encoding to fall back to when no other information
is available</description>
</property>
解析文档的时候使用的默认编码windows-1252 好像比较少用到的一种编码,我不太熟悉。
<property>
<name>parser.html.impl</name>
<value>neko</value>
<description>HTML Parser implementation. Currently the following keywords
are recognized: "neko" uses NekoHTML, "tagsoup" uses TagSoup.
</description>
</property>
制定解析HTML文档的时候使用的解析器, NEKO功能比较强大,后面会有专门的文章介绍Neko 从HTML到 TEXT以及html片断的解析等功能做介绍。
<property>
<name>extension.clustering.hits-to-cluster</name>
<value>100</value>
<description>Number of snippets retrieved for the clustering extension
if clustering extension is available and user requested results
to be clustered.</description>
</property>
聚合功能,对搜索结果有聚合需求的应用可能会用到。
<property>
<name>extension.ontology.extension-name</name>
<value></value>
<description>Use the specified online ontology extension. If empty,
the first available extension will be used. The "name" here refers to an ‘id‘
attribute of the ‘implementation‘ element in the plugin descriptor XML
file.</description>
</property>
人工智能,这个功能在我以后的开发过程中会逐步深入,等我有相关的经验以后在给大家介绍。◎_◎
<property>
<name>query.url.boost</name>
<value>4.0</value>
<description> Used as a boost for url field in Lucene query.
</description>
</property>
<property>
<name>query.anchor.boost</name>
<value>2.0</value>
<description> Used as a boost for anchor field in Lucene query.
</description>
</property>
<property>
<name>query.title.boost</name>
<value>1.5</value>
<description> Used as a boost for title field in Lucene query.
</description>
</property>
<property>
<name>query.host.boost</name>
<value>2.0</value>
<description> Used as a boost for host field in Lucene query.
</description>
</property>
<property>
<name>query.phrase.boost</name>
<value>1.0</value>
<description> Used as a boost for phrase in Lucene query.
Multiplied by boost for field phrase is matched in.
</description>
</property>
以上的几个关于搜索结果排序的分值计算因子在以后的搜索结果排序会专门做介绍,这几个项对垂直搜索的用处不太大。
<property>
<name>lang.analyze.max.length</name>
<value>2048</value>
<description> The maximum bytes of data to uses to indentify
the language (0 means full content analysis).
The larger is this value, the better is the analysis, but the
slowest it is.
</description>
</property>
和语言有关系,分词的时候会用到,不过我没用过这个配置项。
还有几个重要的配置项在 nutch-site.xml里面配置。
<property>
<name>searcher.dir</name>
<value>C:\</value>
</property>
可以有两种方式 ,如果指向的目录下面有 search-servers.txt 文件 ,那么优先处理 search-servers.txt文件中的内容 ,并解析其中复合
hostname port
格式的内容(即分布式查询请求),解析到后就想该服务器发送查询请求,如果没有则查找 segements 目录 ,segments 是本地索引文件。
如果两个都没有找到,她就要报错了。
search-servers.txt
内容很简单 例如:
127.0.0.1 9999
不过需要注意的是 ,这个 9999的端口 启动的 是查询服务器 ,是用 bin/nutch server 9999 的命令启动的,
和 namenode 启动比较相似 ,我当初接触的时候就以为是 namenode 的地址,郁闷的很久。
namenode 和 searchserver 结合不太好 , 没有提供直接从 namenode 到searchserver 的 文件访问接口,需要自己开发,如果大
家知道有可以直接从 namenode 到searchserver 的方法或者现成的程序,请告诉我一下,我需要,要是实在找不到,那就没办法了,自己写。
我现在从namenode 到 searchserver的方法比较原始,不值得推荐,所以就不作介绍了。