- Lucene 入门教程
- Lucene - 主页
- Lucene - 概览
- Lucene - 环境设置
- Lucene - 第一个应用程序
- Lucene - 索引类
- Lucene - 搜索类
- Lucene - 索引进程
- Lucene - 索引操作
- Lucene - 搜索操作
- Lucene - 查询编程
- Lucene - 分析
- Lucene - 排序
- Lucene 有用资源
- Lucene - 快速指南
- Lucene - 有用资源
- Lucene - 讨论
Lucene - TermQuery
TermQuery 是最常用的查询对象,也是 Lucene 可以利用的许多复杂查询的基础。
类声明
以下是 org.apache.lucene.search.TermQuery 类的声明 −
public class TermQuery extends Query
类构造函数
下表显示了一个类构造函数 −
| 序号 | 构造函数和描述 |
|---|---|
| 1 | TermQuery(Term t) 构造针对术语 t 的查询。 |
类方法
下表显示了不同的类方法 −
| 序号 | 方法和描述 |
|---|---|
| 1 | void addDocument(Document doc)
将文档添加到此索引。 |
| 2 | Weight createWeight(Searcher searcher)
专家:为该查询构建合适的 Weight 实现。 |
| 3 | boolean equals(Object o)
当且仅当 o 等于此对象时返回 true。 |
| 4 | void extractTerms(Set<Term> terms)
专家:将此查询中出现的所有术语添加到术语集合中。 |
| 5 | Term getTerm()
返回此查询的术语。 |
| 6 | int hashCode()
返回此对象的哈希码值。 |
| 7 | String toString(String field)
打印此查询的用户可读版本。 |
继承的方法
此类继承了以下类中的方法 −
- org.apache.lucene.search.Query
- java.lang.Object
lucene_searching_classes.htm
广告