
- Lucene Tutorial
- Lucene - Home
- Lucene - Overview
- Lucene - Environment Setup
- Lucene - First Application
- Lucene - Indexing Classes
- Lucene - Searching Classes
- Lucene - Indexing Process
- Lucene - Indexing Operations
- Lucene - Search Operation
- Lucene - Query Programming
- Lucene - Analysis
- Lucene - Sorting
- Lucene Useful Resources
- Lucene - Quick Guide
- Lucene - Useful Resources
- Lucene - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Lucene - TermQuery
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
The following table shows a class constructor −
S.No. | Constructor & Description |
---|---|
1 | TermQuery(Term t) Constructs a query for the term t. |
Class Methods
The following table shows the different class methods −
S.No. | Method & Description |
---|---|
1 | void addDocument(Document doc)
Adds a document to this index. |
2 | Weight createWeight(Searcher searcher)
Expert: Constructs an appropriate Weight implementation for this query. |
3 | boolean equals(Object o)
Returns true iff o is equal to this. |
4 | void extractTerms(Set<Term> terms)
Expert: adds all terms occurring in this query to the terms set. |
5 | Term getTerm()
Returns the term of this query. |
6 | int hashCode()
Returns a hash code value for this object. |
7 | String toString(String field)
Prints a user-readable version of this query. |
Methods Inherited
This class inherits methods from the following classes −
- org.apache.lucene.search.Query
- java.lang.Object
lucene_searching_classes.htm
Advertisements