1. What is lucene?
People new to Lucene often mistake it for a ready-to-use application like
File-search program, a web crawler, or a web site search engine. That isn' t what
Lucene is: Lucene is a software library, a toolkit if you will, not a full-featured
Search application. It concerns itself with text indexing and searching, and it
Does those things very well. Lucene lets your application deal with business rules
Specific to its problem domain while hiding the complexity of indexing and
Searching implementation behind a simple-to-use API. You can think of Lucene
As a layer that applications sit on top of, as shown in
Figure 1.5 Typical application integration with Lucene
2. What can Lucene do?
Lucene allows you to add indexing and searching capabilities to your applications
(These functions are described in section 1.3). Lucene can index and make searchable
Any data that can be converted to a textual format.
This means you can use Lucene to index and
Search data stored in files: web pages on remote web servers, documents stored in
Local file systems, simple text files, Microsoft Word documents ENTs, HTML or PDF
Files, or any other format from which you can extract textual information.
3What are Indexing and Index?
This is where indexing comes in: To search large amounts of text
Quickly, you must first index that text and convert it into a format that will let you
Search it rapidly, eliminating the slow sequential scanning process. This conversion
Process is calledIndexing, And its output is calledIndex.
Specifically, Lucene and Index have the following meanings:
You can think of an index as a data structure that allows fast random access
Words stored inside it. The concept behind it is analogous to an index at the end
Of a book, which lets you quickly locate pages that discuss certain topics. In
Case of Lucene, an index is a specially designed data structure, typically stored
On the file system as a set of index files.
Appendix B, with Index file structure description
4. What is Searching?
SearchingIs the process of looking up words in an index to find documents where
They appear
The quality of Searching is described by Pricision and Recall.
Recall measures how well the search system finds relevant statements,
Whereas precision measures how well the system filters out the irrelevant
Documents.
Other factors evaluating Searching:
We already mentioned speed and the ability to quickly
Search large quantities of text. Support for single and multiterm queries, phrase
Queries, wildcards, result ranking, and sorting are also important, as is a friendly
Syntax for entering those queries.
5. Simple Example: search for a txt file in the directory tree. A small example is provided, but you can understand Lucene as a whole.
From the examples, we can see that Lucene is separated from a specific service, and it only uses a few javaseapi
6. Note:
Note that the Hits object contains only references to the underlying documents.
In other words, instead of being loaded immediately upon search, matches are
Loaded from the index in a lazy fashion-only when requested with the hits.
Doc (int) call.
HitsOnly the indexes that contain documents. Loading matching items from the index to the Search is delayed-only when
Hits.doc ()Hour