
- Lucene - Home
- Lucene - Overview
- Lucene - Environment Setup
- Lucene - First Application
- Lucene - Indexing Classes
- Lucene - Searching Classes
- Lucene - Indexing Process
- Lucene - Search Operation
- Lucene - Sorting
Lucene - Indexing Operations
- Lucene - Indexing Operations
- Lucene - Add Document
- Lucene - Update Document
- Lucene - Delete Document
- Lucene - Field Options
Lucene - Query Programming
- Lucene - Query Programming
- Lucene - TermQuery
- Lucene - TermRangeQuery
- Lucene - PrefixQuery
- Lucene - BooleanQuery
- Lucene - PhraseQuery
- Lucene - WildCardQuery
- Lucene - FuzzyQuery
- Lucene - MatchAllDocsQuery
- Lucene - MatchNoDocsQuery
- Lucene - RegexpQuery
Lucene - Analysis
- Lucene - Analysis
- Lucene - WhitespaceAnalyzer
- Lucene - SimpleAnalyzer
- Lucene - StopAnalyzer
- Lucene - StandardAnalyzer
- Lucene - KeywordAnalyzer
- Lucene - CustomAnalyzer
- Lucene - EnglishAnalyzer
- Lucene - FrenchAnalyzer
- Lucene - SpanishAnalyzer
Lucene - Resources
Lucene - TermQuery Class
TermQuery is the most commonly-used query object and is the foundation of many complex queries that Lucene can make use of.
Class Declaration
Following is the declaration for org.apache.lucene.search.TermQuery class −
public class TermQuery extends Query
Class Constructors
Following table shows the constructors for TermQuery −
S.No. | Constructor & Description |
---|---|
1 |
TermQuery(Term t) Constructs a query for the term t. |
2 |
TermQuery(Term t, TermStates states) Expert: constructs a TermQuery that will use the provided docFreq instead of looking up the docFreq against the searcher. |
Class Methods
S.No. | Method & Description |
---|---|
1 |
Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) Expert: Constructs an appropriate Weight implementation for this query. |
2 |
boolean equals(Object other) Returns true iff other is equal to this. |
3 |
Term getTerm() Returns the term of this query. |
4 |
TermStates getTermStates() Returns the TermStates passed to the constructor, or null if it was not passed. |
5 |
int hashCode() Override and implement query hash code properly in a subclass. |
6 |
String toString(String field) Prints a user-readable version of this query. |
7 |
void visit(QueryVisitor visitor) Recurse through the query tree, visiting any child queries. |
Methods Inherited
This class inherits methods from the following classes −
- org.apache.lucene.search.Query
- java.lang.Object