北大天网搜索引擎TSE分析及完全注释[5]倒排索引的建立及文件介绍

本文主要是介绍北大天网搜索引擎TSE分析及完全注释[5]倒排索引的建立及文件介绍,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

不好意思让大家久等了,前一阵一直在忙考试,终于结束了。呵呵!废话不多说了下面我们开始吧!

TSE用的是将抓取回来的网页文档全部装入一个大文档,让后对这一个大文档内的数据整体统一的建索引,其中包含了几个步骤。

view plain copy to clipboard print ?
  1. 1.  The document index (Doc.idx) keeps information about each document.   
  2.   
  3. It is a fixed width ISAM (Index sequential access mode) index, orderd by docID.   
  4.   
  5. The information stored in each entry includes a pointer into the repository,   
  6.   
  7. a document length, a document checksum.   
  8.   
  9.   
  10.   
  11. //Doc.idx  文档编号 文档长度    checksum hash码   
  12.   
  13. 0   0   bc9ce846d7987c4534f53d423380ba70   
  14.   
  15. 1   76760   4f47a3cad91f7d35f4bb6b2a638420e5   
  16.   
  17. 2   141624  d019433008538f65329ae8e39b86026c   
  18.   
  19. 3   142350  5705b8f58110f9ad61b1321c52605795   
  20.   
  21. //Doc.idx   end   
  22.   
  23.   
  24.   
  25.   The url index (url.idx) is used to convert URLs into docIDs.   
  26.   
  27.   
  28.   
  29. //url.idx   
  30.   
  31. 5c36868a9c5117eadbda747cbdb0725f    0  
  32.   
  33. 3272e136dd90263ee306a835c6c70d77    1  
  34.   
  35. 6b8601bb3bb9ab80f868d549b5c5a5f3    2  
  36.   
  37. 3f9eba99fa788954b5ff7f35a5db6e1f    3  
  38.   
  39. //url.idx   end   
  40.   
  41.   
  42.   
  43. It is a list of URL checksums with their corresponding docIDs and is sorted by   
  44.   
  45. checksum. In order to find the docID of a particular URL, the URL's checksum   
  46.   
  47. is computed and a binary search is performed on the checksums file to find its   
  48.   
  49. docID.   
  50.   
  51.   
  52.   
  53.     ./DocIndex   
  54.   
  55.         got Doc.idx, Url.idx, DocId2Url.idx //Data文件夹中的Doc.idx DocId2Url.idx和Doc.idx中   
  56.   
  57.   
  58.   
  59. //DocId2Url.idx   
  60.   
  61. 0   http://*.*.edu.cn/index.aspx   
  62.   
  63. 1   http://*.*.edu.cn/showcontent1.jsp?NewsID=118   
  64.   
  65. 2   http://*.*.edu.cn/0102.html   
  66.   
  67. 3   http://*.*.edu.cn/0103.html   
  68.   
  69. //DocId2Url.idx end   
  70.   
  71.   
  72.   
  73. 2.  sort Url.idx|uniq > Url.idx.sort_uniq    //Data文件夹中的Url.idx.sort_uniq   
  74.   
  75.   
  76.   
  77. //Url.idx.sort_uniq   
  78.   
  79. //对hash值进行排序   
  80.   
  81. 000bfdfd8b2dedd926b58ba00d40986b    1111  
  82.   
  83. 000c7e34b653b5135a2361c6818e48dc    1831  
  84.   
  85. 0019d12f438eec910a06a606f570fde8    366  
  86.   
  87. 0033f7c005ec776f67f496cd8bc4ae0d    2103  
  88.   
  89.   
  90.   
  91. 3. Segment document to terms, (with finding document according to the url)   
  92.   
  93.     ./DocSegment Tianwang.raw.2559638448        //Tianwang.raw.2559638448为爬回来的文件 ,每个页面包含http头   
  94.   
  95.         got Tianwang.raw.2559638448.seg        
  96.   
  97.   
  98.   
  99. //Tianwang.raw.2559638448   爬取的原始网页文件在文档内部每一个文档之间应该是通过version,</html>和回车做标志位分割的   
  100.   
  101. version: 1.0  
  102.   
  103. url: http://***.105.138.175/Default2.asp?lang=gb   
  104.   
  105. origin: http://***.105.138.175/   
  106.   
  107. date: Fri, 23 May 2008 20:01:36 GMT   
  108.   
  109. ip: 162.105.138.175  
  110.   
  111. length: 38413  
  112.   
  113.   
  114.   
  115. HTTP/1.1 200 OK   
  116.   
  117. Server: Microsoft-IIS/5.0  
  118.   
  119. Date: Fri, 23 May 2008 11:17:49 GMT   
  120.   
  121. Connection: keep-alive   
  122.   
  123. Connection: Keep-Alive   
  124.   
  125. Content-Length: 38088  
  126.   
  127. Content-Type: text/html; Charset=gb2312   
  128.   
  129. Expires: Fri, 23 May 2008 11:17:49 GMT   
  130.   
  131. Set-Cookie: ASPSESSIONIDSSTRDCAB=IMEOMBIAIPDFCKPAEDJFHOIH; path=/   
  132.   
  133. Cache-control: private  
  134.   
  135.   
  136.   
  137.   
  138.   
  139.   
  140.   
  141. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  
  142.   
  143. "http://www.w3.org/TR/html4/loose.dtd">   
  144.   
  145. <html>   
  146.   
  147. <head>   
  148.   
  149. <title>Apabi数字资源平台</title>   
  150.   
  151. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">   
  152.   
  153. <META NAME="ROBOTS" CONTENT="INDEX,NOFOLLOW">   
  154.   
  155. <META NAME="DESCRIPTION" CONTENT="数字图书馆 方正数字图书馆 电子图书 电子书 ebook e书 Apabi 数字资源平台">   
  156.   
  157. <link rel="stylesheet" type="text/css" href="css/common.css">   
  158.   
  159.   
  160.   
  161. <style type="text/css">   
  162.   
  163. <!--   
  164.   
  165. .style4 {color: #666666}   
  166.   
  167. -->   
  168.   
  169. </style>   
  170.   
  171.   
  172.   
  173. <script LANGUAGE="vbscript">   
  174.   
  175. ...   
  176.   
  177. </script>   
  178.   
  179.   
  180.   
  181. <Script Language="javascript">   
  182.   
  183. ...   
  184.   
  185. </Script>   
  186.   
  187. </head>   
  188.   
  189. <body leftmargin="0" topmargin="0">   
  190.   
  191. </body>   
  192.   
  193. </html>   
  194.   
  195. //Tianwang.raw.2559638448   end   
  196.   
  197.   
  198.   
  199. //Tianwang.raw.2559638448.seg   将每个页面分成一行如下(注意中间没有回车作为分隔)   
  200.   
  201. 1  
  202.   
  203. ...   
  204.   
  205. ...   
  206.   
  207. ...   
  208.   
  209. 2  
  210.   
  211. ...   
  212.   
  213. ...   
  214.   
  215. ...   
  216.   
  217. //Tianwang.raw.2559638448.seg   end   
  218.   
  219.   
  220.   
  221. //下是 Tiny search 非必须因素   
  222.   
  223. 4. Create forward index (docic-->termid)     //建立正向索引   
  224.   
  225.     ./CrtForwardIdx Tianwang.raw.2559638448.seg > moon.fidx   
  226.   
  227.   
  228.   
  229. //Tianwang.raw.2559638448.seg 将每个页面分成一行如下<BR>//分词   DocID<BR>1<BR>三星/  s/  手机/  论坛/  ,/  手机/  铃声/  下载/  ,/  手机/  图片/  下载/  ,/  手机/<BR>2<BR>...<BR>...<BR>...  
1.  The document index (Doc.idx) keeps information about each document.
It is a fixed width ISAM (Index sequential access mode) index, orderd by docID.
The information stored in each entry includes a pointer into the repository,
a document length, a document checksum.
//Doc.idx  文档编号	文档长度	checksum hash码
0	0	bc9ce846d7987c4534f53d423380ba70
1	76760	4f47a3cad91f7d35f4bb6b2a638420e5
2	141624	d019433008538f65329ae8e39b86026c
3	142350	5705b8f58110f9ad61b1321c52605795
//Doc.idx	end
The url index (url.idx) is used to convert URLs into docIDs.
//url.idx
5c36868a9c5117eadbda747cbdb0725f	0
3272e136dd90263ee306a835c6c70d77	1
6b8601bb3bb9ab80f868d549b5c5a5f3	2
3f9eba99fa788954b5ff7f35a5db6e1f	3
//url.idx	end
It is a list of URL checksums with their corresponding docIDs and is sorted by
checksum. In order to find the docID of a particular URL, the URL's checksum
is computed and a binary search is performed on the checksums file to find its
docID.
./DocIndex
got Doc.idx, Url.idx, DocId2Url.idx	//Data文件夹中的Doc.idx DocId2Url.idx和Doc.idx中
//DocId2Url.idx
0	http://*.*.edu.cn/index.aspx
1	http://*.*.edu.cn/showcontent1.jsp?NewsID=118
2	http://*.*.edu.cn/0102.html
3	http://*.*.edu.cn/0103.html
//DocId2Url.idx	end
2.  sort Url.idx|uniq > Url.idx.sort_uniq	//Data文件夹中的Url.idx.sort_uniq
//Url.idx.sort_uniq
//对hash值进行排序
000bfdfd8b2dedd926b58ba00d40986b	1111
000c7e34b653b5135a2361c6818e48dc	1831
0019d12f438eec910a06a606f570fde8	366
0033f7c005ec776f67f496cd8bc4ae0d	2103
3. Segment document to terms, (with finding document according to the url)
./DocSegment Tianwang.raw.2559638448		//Tianwang.raw.2559638448为爬回来的文件 ,每个页面包含http头
got Tianwang.raw.2559638448.seg		
//Tianwang.raw.2559638448	爬取的原始网页文件在文档内部每一个文档之间应该是通过version,</html>和回车做标志位分割的
version: 1.0
url: http://***.105.138.175/Default2.asp?lang=gb
origin: http://***.105.138.175/
date: Fri, 23 May 2008 20:01:36 GMT
ip: 162.105.138.175
length: 38413
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Fri, 23 May 2008 11:17:49 GMT
Connection: keep-alive
Connection: Keep-Alive
Content-Length: 38088
Content-Type: text/html; Charset=gb2312
Expires: Fri, 23 May 2008 11:17:49 GMT
Set-Cookie: ASPSESSIONIDSSTRDCAB=IMEOMBIAIPDFCKPAEDJFHOIH; path=/
Cache-control: private
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Apabi数字资源平台</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<META NAME="ROBOTS" CONTENT="INDEX,NOFOLLOW">
<META NAME="DESCRIPTION" CONTENT="数字图书馆 方正数字图书馆 电子图书 电子书 ebook e书 Apabi 数字资源平台">
<link rel="stylesheet" type="text/css" href="css/common.css">
<style type="text/css">
<!--
.style4 {color: #666666}
-->
</style>
<script LANGUAGE="vbscript">
...
</script>
<Script Language="javascript">
...
</Script>
</head>
<body leftmargin="0" topmargin="0">
</body>
</html>
//Tianwang.raw.2559638448	end
//Tianwang.raw.2559638448.seg	将每个页面分成一行如下(注意中间没有回车作为分隔)
1
...
...
...
2
...
...
...
//Tianwang.raw.2559638448.seg	end
//下是 Tiny search 非必须因素
4. Create forward index (docic-->termid)		//建立正向索引
./CrtForwardIdx Tianwang.raw.2559638448.seg > moon.fidx
//Tianwang.raw.2559638448.seg 将每个页面分成一行如下
//分词   DocID
1
三星/  s/  手机/  论坛/  ,/  手机/  铃声/  下载/  ,/  手机/  图片/  下载/  ,/  手机/
2
...
...
...
view plain copy to clipboard print ?
  1. //Tianwang.raw.2559638448.seg end   
  2.   
  3.   
  4. //moon.fidx   
  5.   
  6. //每篇文档号对应文档内分出来的    分词  DocID   
  7.   
  8. 都会  2391  
  9.   
  10. 使   2391  
  11.   
  12. 那些  2391  
  13.   
  14. 拥有  2391  
  15.   
  16. 它   2391  
  17.   
  18. 的   2391  
  19.   
  20. 人   2391  
  21.   
  22. 的   2391  
  23.   
  24. 视野  2391  
  25.   
  26. 变   2391  
  27.   
  28. 窄   2391  
  29.   
  30. 在   2180  
  31.   
  32. 研究生部    2180  
  33.   
  34. 主页  2180  
  35.   
  36. 培养  2180  
  37.   
  38. 管理  2180  
  39.   
  40. 栏目  2180  
  41.   
  42. 下载  2180  
  43.   
  44. )   2180  
  45.   
  46. 、   2180  
  47.   
  48. 关于  2180  
  49.   
  50. 做好  2180  
  51.   
  52. 年   2180  
  53.   
  54. 国家  2180  
  55.   
  56. 公派  2180  
  57.   
  58. 研究生 2180  
  59.   
  60. 项目  2180  
  61.   
  62. //moon.fidx end   
  63.   
  64.   
  65.   
  66. 5.# set | grep "LANG"  
  67.   
  68. LANG=en; export LANG;   
  69.   
  70. sort moon.fidx > moon.fidx.sort   
  71.   
  72.   
  73.   
  74. 6. Create inverted index (termid-->docid)    //建立倒排索引   
  75.   
  76.     ./CrtInvertedIdx moon.fidx.sort > sun.iidx   
  77.   
  78.   
  79.   
  80. //sun.iidx  //文件规模大概减少1/2   
  81.   
  82. 花工   236  
  83.   
  84. 花海   2103  
  85.   
  86. 花卉   1018 1061 1061 1061 1730 1730 1730 1730 1730 1852 949 949  
  87.   
  88. 花蕾   447 447  
  89.   
  90. 花木   1061  
  91.   
  92. 花呢   1430  
  93.   
  94. 花期   447 447 447 447 447 525  
  95.   
  96. 花钱   174 236  
  97.   
  98. 花色   1730 1730  
  99.   
  100. 花色品种     1660  
  101.   
  102. 花生   450 526  
  103.   
  104. 花式   1428 1430 1430 1430  
  105.   
  106. 花纹   1430 1430  
  107.   
  108. 花序   447 447 447 447 447 450  
  109.   
  110. 花絮   136 137  
  111.   
  112. 花芽   450 450  
  113.   
  114. //sun.iidx  end   
  115.   
  116.   
  117.   
  118. TSESearch   CGI program for query   
  119.   
  120. Snapshot    CGI program for page snapshot   
  121.   
  122.   
  123.  
//Tianwang.raw.2559638448.seg end
//moon.fidx
//每篇文档号对应文档内分出来的	分词	DocID
都会	2391
使	2391
那些	2391
拥有	2391
它	2391
的	2391
人	2391
的	2391
视野	2391
变	2391
窄	2391
在	2180
研究生部	2180
主页	2180
培养	2180
管理	2180
栏目	2180
下载	2180
)	2180
、	2180
关于	2180
做好	2180
年	2180
国家	2180
公派	2180
研究生	2180
项目	2180
//moon.fidx	end
5.# set | grep "LANG"
LANG=en; export LANG;
sort moon.fidx > moon.fidx.sort
6. Create inverted index (termid-->docid)	//建立倒排索引
./CrtInvertedIdx moon.fidx.sort > sun.iidx
//sun.iidx	//文件规模大概减少1/2
花工	 236
花海	 2103
花卉	 1018 1061 1061 1061 1730 1730 1730 1730 1730 1852 949 949
花蕾	 447 447
花木	 1061
花呢	 1430
花期	 447 447 447 447 447 525
花钱	 174 236
花色	 1730 1730
花色品种	 1660
花生	 450 526
花式	 1428 1430 1430 1430
花纹	 1430 1430
花序	 447 447 447 447 447 450
花絮	 136 137
花芽	 450 450
//sun.iidx	end
TSESearch	CGI program for query
Snapshot	CGI program for page snapshot

author:http://hi.baidu.com/jrckkyy author:http://blog.csdn.net/jrckkyy

这篇关于北大天网搜索引擎TSE分析及完全注释[5]倒排索引的建立及文件介绍的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/670221

相关文章

慢sql提前分析预警和动态sql替换-Mybatis-SQL

《慢sql提前分析预警和动态sql替换-Mybatis-SQL》为防止慢SQL问题而开发的MyBatis组件,该组件能够在开发、测试阶段自动分析SQL语句,并在出现慢SQL问题时通过Ducc配置实现动... 目录背景解决思路开源方案调研设计方案详细设计使用方法1、引入依赖jar包2、配置组件XML3、核心配

Java NoClassDefFoundError运行时错误分析解决

《JavaNoClassDefFoundError运行时错误分析解决》在Java开发中,NoClassDefFoundError是一种常见的运行时错误,它通常表明Java虚拟机在尝试加载一个类时未能... 目录前言一、问题分析二、报错原因三、解决思路检查类路径配置检查依赖库检查类文件调试类加载器问题四、常见

Python中的Walrus运算符分析示例详解

《Python中的Walrus运算符分析示例详解》Python中的Walrus运算符(:=)是Python3.8引入的一个新特性,允许在表达式中同时赋值和返回值,它的核心作用是减少重复计算,提升代码简... 目录1. 在循环中避免重复计算2. 在条件判断中同时赋值变量3. 在列表推导式或字典推导式中简化逻辑

C#使用StackExchange.Redis实现分布式锁的两种方式介绍

《C#使用StackExchange.Redis实现分布式锁的两种方式介绍》分布式锁在集群的架构中发挥着重要的作用,:本文主要介绍C#使用StackExchange.Redis实现分布式锁的... 目录自定义分布式锁获取锁释放锁自动续期StackExchange.Redis分布式锁获取锁释放锁自动续期分布式

redis过期key的删除策略介绍

《redis过期key的删除策略介绍》:本文主要介绍redis过期key的删除策略,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录第一种策略:被动删除第二种策略:定期删除第三种策略:强制删除关于big key的清理UNLINK命令FLUSHALL/FLUSHDB命

C# foreach 循环中获取索引的实现方式

《C#foreach循环中获取索引的实现方式》:本文主要介绍C#foreach循环中获取索引的实现方式,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧... 目录一、手动维护索引变量二、LINQ Select + 元组解构三、扩展方法封装索引四、使用 for 循环替代

MySQL索引的优化之LIKE模糊查询功能实现

《MySQL索引的优化之LIKE模糊查询功能实现》:本文主要介绍MySQL索引的优化之LIKE模糊查询功能实现,本文通过示例代码给大家介绍的非常详细,感兴趣的朋友一起看看吧... 目录一、前缀匹配优化二、后缀匹配优化三、中间匹配优化四、覆盖索引优化五、减少查询范围六、避免通配符开头七、使用外部搜索引擎八、分

Java程序进程起来了但是不打印日志的原因分析

《Java程序进程起来了但是不打印日志的原因分析》:本文主要介绍Java程序进程起来了但是不打印日志的原因分析,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录Java程序进程起来了但是不打印日志的原因1、日志配置问题2、日志文件权限问题3、日志文件路径问题4、程序

Java字符串操作技巧之语法、示例与应用场景分析

《Java字符串操作技巧之语法、示例与应用场景分析》在Java算法题和日常开发中,字符串处理是必备的核心技能,本文全面梳理Java中字符串的常用操作语法,结合代码示例、应用场景和避坑指南,可快速掌握字... 目录引言1. 基础操作1.1 创建字符串1.2 获取长度1.3 访问字符2. 字符串处理2.1 子字

IDEA自动生成注释模板的配置教程

《IDEA自动生成注释模板的配置教程》本文介绍了如何在IntelliJIDEA中配置类和方法的注释模板,包括自动生成项目名称、包名、日期和时间等内容,以及如何定制参数和返回值的注释格式,需要的朋友可以... 目录项目场景配置方法类注释模板定义类开头的注释步骤类注释效果方法注释模板定义方法开头的注释步骤方法注