📜  Lucene-概述

📅  最后修改于: 2020-11-12 04:44:07             🧑  作者: Mango


Lucene是一个简单而强大的基于Java的搜索库。可以在任何应用程序中使用它来添加搜索功能。 Lucene是一个开源项目。它是可扩展的。这个高性能的库用于索引和搜索几乎所有类型的文本。 Lucene库提供了任何搜索应用程序所需的核心操作。索引和搜索。

搜索应用程序如何工作?

搜索应用程序执行以下全部或部分操作-

Step Title Description
1

Acquire Raw Content

The first step of any search application is to collect the target contents on which search application is to be conducted.

2

Build the document

The next step is to build the document(s) from the raw content, which the search application can understand and interpret easily.

3

Analyze the document

Before the indexing process starts, the document is to be analyzed as to which part of the text is a candidate to be indexed. This process is where the document is analyzed.

4

Indexing the document

Once documents are built and analyzed, the next step is to index them so that this document can be retrieved based on certain keys instead of the entire content of the document. Indexing process is similar to indexes at the end of a book where common words are shown with their page numbers so that these words can be tracked quickly instead of searching the complete book.

5

User Interface for Search

Once a database of indexes is ready then the application can make any search. To facilitate a user to make a search, the application must provide a user a mean or a user interface where a user can enter text and start the search process.

6

Build Query

Once a user makes a request to search a text, the application should prepare a Query object using that text which can be used to inquire index database to get the relevant details.

7

Search Query

Using a query object, the index database is then checked to get the relevant details and the content documents.

8

Render Results

Once the result is received, the application should decide on how to show the results to the user using User Interface. How much information is to be shown at first look and so on.

除了这些基本操作,搜索应用程序还可以提供管理用户界面,并帮助该应用程序的管理员根据用户配置文件控制搜索级别。搜索结果的分析是任何搜索应用程序的另一个重要且高级的方面。

Lucene在搜索应用程序中的作用

Lucene在上面提到的步骤2到步骤7中扮演角色,并提供了执行所需操作的类。简而言之,Lucene是任何搜索应用程序的核心,并提供与索引和搜索有关的重要操作。获取内容并显示结果留给应用程序部分处理。

在下一章中,我们将使用Lucene Search库执行一个简单的Search应用程序。