concept search in category lucene

This is an excerpt from Manning's book Lucene in Action, Second Edition.
We parse command-line arguments (index directory, query string). We use Lucene’s Directory and IndexSearcher classes to open our index for searching. We use QueryParser to parse a human-readable search text into Lucene’s Query class. Searching returns hits in the form of a TopDocs object. Print details on the search (how many hits were found and time taken) Note that the TopDocs 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 IndexSearcher.doc(int) call. That call returns a Document object from which we can then retrieve individual field values. Close the IndexSearcher when we’re done.
In this chapter we begin with a simple example showing that the code you write to implement search is generally no more than a few lines long. Next we illustrate the scoring formula, providing a deep look into one of Lucene’s most special attributes. With this example and a high-level understanding of how Lucene ranks search results, we’ll spend most of the chapter exploring the diversity of Lucene’s built-in search queries, including searching by specific term, by range (numeric or textual), by prefix or wildcard, by phrase, or by fuzzy term matching. We show how the powerful BooleanQuery can join any number of clauses together, including arbitrarily nested clauses, using Boolean constraints. Finally we show how simple it is to create a complex search query from a text search expression entered by the end user using Lucene’s built-in QueryParser.








