As we've seen in previous chapter Lucene - Search Operation,
Lucene uses IndexSearcher to make searches and it uses Query object
created by QueryParser as input. In this chapter, we are going to
discuss various types of Query objects and ways to create them
programmatically. Creating different types of Query object gives control
on the kind of search to be made.
Consider a case of Advanced Search, provided by many applications where users are given multiple options to confine the search results. By Query programming, we can achieve the same very easily.
Following is the list of Query types that we'll discuss in due course.
Consider a case of Advanced Search, provided by many applications where users are given multiple options to confine the search results. By Query programming, we can achieve the same very easily.
Following is the list of Query types that we'll discuss in due course.
Sr. No. | Class & Description |
---|---|
1 | TermQuery This class acts as a core component which creates/updates indexes during indexing process. |
2 | TermRangeQuery TermRangeQuery is the used when a range of textual terms are to be searched. |
3 | PrefixQuery PrefixQuery is used to match documents whose index starts with a specified string. |
4 | BooleanQuery BooleanQuery is used to search documents which are result of multiple queries using AND, OR or NOT operators. |
5 | PhraseQuery Phrase query is used to search documents which contain a particular sequence of terms. |
6 | WildCardQuery WildcardQuery is used to search documents using wildcards like '*' for any character sequence,? matching a single character. |
7 | FuzzyQuery FuzzyQuery is used to search documents using fuzzy implementation that is an approximate search based on edit distance algorithm. |
8 | MatchAllDocsQuery MatchAllDocsQuery as name suggests matches all the documents. |
No comments:
Post a Comment