Nutch的输出文件(不包括临时文件)主要可分为crawldb、index、indexs、linkdb和segments。
Crawldb<o:p></o:p>
Crawldb是所有需要抓取的超连接信息
Segments<o:p></o:p>
Segments是每轮抓取的时候根据crawldb生成的。存放的信息包括6种content、crawl_fetch、crawl_generate、crawl_parse、parse_data、parse_text。其中content是抓取下来的网页内容;crawl_generate最初生成;crawl_fetch、content在抓取时生成;crawl_parse、parse_data、parse_text在解析抓取的数据文件时生成。其中crawl_generate、crawl_fetch和crawl_parse是crawldb的部分url数据,它们格式一样,不同的是抓取时间、状态、签名等有所变化。格式如下:
////////////////////crawl_generate、crawl_fetch、crawl_parse、crawldb的格式//////////////
http://www.163.com/ Version: 4
Status: 5 (fetch_success)
Fetch time: Thu Oct 26 19:20:33 CST 2006
Modified time: Thu Jan 01 08:00:00 CST 1970
Retries since fetch: 0
Retry interval: 30.0 days
Score: 1.0
Signature: <st1:chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="3029" unitname="C">3029c</st1:chmetcnv>621e<st1:chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="26" unitname="C">26c</st1:chmetcnv><st1:chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="43797241" unitname="a">43797241a</st1:chmetcnv>8d34980b2dc
Metadata: null
parse_data的格式如下:
……
outlink: toUrl: http://cha.so.163.com/so.php?key=001001006&q=%CA%D6%BB%FA anchor: 手机
Content Metadata: nutch.crawl.score=1.0 nutch.content.digest=<st1:chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="3029" unitname="C">3029c</st1:chmetcnv>621e<st1:chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="26" unitname="C">26c</st1:chmetcnv><st1:chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="43797241" unitname="a">43797241a</st1:chmetcnv>8d34980b2dc Content-Type=text/html;
charset=GB2312 date=Thu, 26 Oct 2006 11:20:33 GMT Cache-Control=max-age=146
Content-Encoding=gzip Content-Length=19628 Connection=close Expires=Thu, 26
Oct 2006 11:23:00 GMT nutch.segment.name=20061026192026 Accept-Ranges=bytes
Server=Apache/<st1:chsdate w:st="on" isrocdate="False" islunardate="False" day="30" month="12" year="1899">2.0.55</st1:chsdate> (Unix) X-Cache=HIT from www.163.com Vary=Accept-Encoding
Parse Metadata: OriginalCharEncoding=GB2312 CharEncodingForConversion=GB2312
parse_text是网页的文本信息。
Index<o:p></o:p>
据初步分析index由indexs合并而来的,存放的是索引信息。在非分布式搜索时优先根据查找index文件夹,如果不存在则查找indexs。
Linkdb<o:p></o:p>
Linkdb中存放的是所有超连接及其每个连接的连入地址和锚文本。读取出来的格式如下:
http://tech.163.com/06/1025/18/2UA64IC300091537.html Inlinks:
fromUrl: http://tech.163.com/discover/ anchor:
fromUrl: http://tech.163.com/discover/ anchor: 蟒蛇鳄鱼颠峰对决
……