如何基于JAVA技术研究搜索引擎?

如何基于JAVA技术研究搜索引擎?

目录............................................................................................................................................................................ 1

摘要............................................................................................................................................................................ 3

第一章 引言............................................................................................................................................................. 4

第二章 搜索引擎的结构........................................................................................................................................ 5

2.1系统概述........................................................................................................................................................... 5

2.2搜索引擎的构成............................................................................................................................................... 5

2.2.1网络机器人............................................................................................................................................... 5

2.2.2索引与搜索............................................................................................................................................... 5

2.2.3 Web服务器............................................................................................................................................. 6

2.3搜索引擎的主要指标及分析........................................................................................................................... 6

2.4小节................................................................................................................................................................... 6

第三章 网络机器人................................................................................................................................................ 7

3.1什么是网络机器人........................................................................................................................................... 7

3.2网络机器人的结构分析................................................................................................................................... 7

3.2.1如何解析HTML........................................................................................................................................ 7

3.2.2 Spider程序结构...................................................................................................................................... 8

3.2.3如何构造Spider程序............................................................................................................................... 9

3.2.4如何提高程序性能................................................................................................................................. 11

3.2.5网络机器人的代码分析............................................................................................................................. 12

3.3小节................................................................................................................................................................ 14

第四章 基于lucene的索引与搜索.................................................................................................................. 15

4.1什么是Lucene全文检索............................................................................................................................ 15

4.2 Lucene的原理分析................................................................................................................................... 15

4.2.1全文检索的实现机制............................................................................................................................ 15

4.2.2 Lucene的索引效率.............................................................................................................................. 15

4.2.3 中文切分词机制.................................................................................................................................. 17

4.3 LuceneSpider的结合........................................................................................................................ 18

4.4小节................................................................................................................................................................ 21

第五章 基于TomcatWeb服务器................................................................................................................. 22

5.1什么是基于TomcatWeb服务器............................................................................................................ 22

5.2用户接口设计................................................................................................................................................ 22

5.3.1客户端设计............................................................................................................................................ 22

5.3.2服务端设计............................................................................................................................................ 23

5.3Tomcat上部署项目................................................................................................................................. 25

5.4小节................................................................................................................................................................ 25

第六章 搜索引擎策略.......................................................................................................................................... 26

6.1简介................................................................................................................................................................ 26

6.2面向主题的搜索策略.................................................................................................................................... 26

6.2.1导向词.................................................................................................................................................... 26

6.2.3权威网页和中心网页............................................................................................................................ 27

6.3小节................................................................................................................................................................ 27

参考文献................................................................................................................................................................. 28

摘要

网络中的资源非常丰富,但是如何有效的搜索信息却是一件困难的事情。建立搜索引擎就是解决这个问题的最好方法。本文首先详细介绍了基于英特网的搜索引擎的系统结构,然后从网络机器人、索引引擎、Web服务器三个方面进行详细的说明。为了更加深刻的理解这种技术,本人还亲自实现了一个自己的搜索引擎——新闻搜索引擎。

新闻搜索引擎是从指定的Web页面中按照超连接进行解析、搜索,并把搜索到的每条新闻进行索引后加入数据库。然后通过Web服务器接受客户端请求后从索引数据库中搜索出所匹配的新闻。

本人在介绍搜索引擎的章节中除了详细的阐述技术核心外还结合了新闻搜索引擎的实现代码来说明,图文并茂、易于理解。

Abstract

The resources in the internet are abundant, but it is a difficult job to search some useful information. So a search engine is the best method to solve this problem. This article fist introduces the system structure of search engine based on the internet in detail, then gives a minute explanation form Spider search, engine and web server. In order to understand the technology more deeply, I have programmed a news search engine by myself.

The news search engine is explained and searched according to hyperlink from a appointed web page, then indexs every searched information and adds it to the index database. Then after receiving the customers' requests from the web server, it soon searchs the right news form the index engine,

In the chapter of introducing search engine, it is not only elaborate the core technology, but also combine with the modern code,pictures included, easy to understand.

第一章 引言

面对浩瀚的网络资源,搜索引擎为所有网上冲浪的用户提供了一个入口,毫不夸张的说,所有的用户都可以从搜索出发到达自己想去的网上任何一个地方。因此它也成为除了电子邮件以外最多人使用的网上服务。

搜索引擎技术伴随着WWW的发展是引人注目的。搜索引擎大约经历了三代的更新发展:

第一代搜索引擎出现于1994年。这类搜索引擎一般都索引少于1000000个网页,极少重新搜集网页并去刷新索引。而且其检索速度非常慢,一般都要等待10秒甚至更长的时间。在实现技术上也基本沿用较为成熟的IRInformation Retrieval)、网络、数据库等技术,相当于利用一些已有技术实现的一个WWW上的应用。在19943月到4月,网络爬虫World Web Worm (WWWW)平均每天承受大约1500次查询。

大约在1996年出现的第二代搜索引擎系统大多采用分布式方案(多个微型计算机协同工作)来提高数据规模、响应速度和用户数量,它们一般都保持一个大约50000000网页的索引数据库,每天能够响应10000000次用户检索请求。199711月,当时最先进的几个搜索引擎号称能建立从2000000100000000的网页索引。Altavista搜索引擎声称他们每天大概要承受20000000次查询。

2000年搜索引擎2000年大会上,按照Google公司总裁Larry Page的演讲,Google正在用