Lucene - 查詢



Query 是一個抽象類,包含各種實用方法,並且是 Lucene 在搜尋過程中使用的所有型別查詢的父類。

類宣告

以下是org.apache.lucene.search.Query類的宣告:

public abstract class Query
   extends Object
      implements Serializable, Cloneable

類建構函式

下表顯示了一個類建構函式:

序號 建構函式及說明
1

Query()

類方法

下表顯示了不同的類方法:

序號 方法及說明
1

Object clone()

返回此查詢的克隆。

2

Query combine(Query[] queries)

專家:在 MultiSearcher 下重寫查詢時呼叫。

3

Weight createWeight(Searcher searcher)

專家:為該查詢構造合適的 Weight 實現。

4

boolean equals(Object obj)

5

void extractTerms(Set<Term> terms)

專家:將此查詢中出現的所有術語新增到術語集中。

6

float getBoost()

獲取此子句的提升值。

7

Similarity getSimilarity(Searcher searcher)

已棄用。不要使用“執行時”子類/委託,而是對 Weight 進行子類化。

8

int hashCode()

9

static Query mergeBooleanQueries(BooleanQuery... queries)

專家:將一組 BooleanQuery 的子句合併到單個 BooleanQuery 中。

10

Query rewrite(IndexReader reader)

專家:用於將查詢重寫為基本查詢。

11

void setBoost(float b)

將此查詢子句的提升值設定為 b。

12

String toString()

將查詢列印到字串。

13

abstract String toString(String field)

將查詢列印到字串,假設欄位為預設欄位並省略。

14

Weight weight(Searcher searcher)

已棄用。Weight 實現中絕不要使用此方法。Query 的子類應該使用 createWeight(org.apache.lucene.search.Searcher) 代替。

繼承的方法

此類繼承自以下類的方法:

  • java.lang.Object
lucene_searching_classes.htm
廣告
© . All rights reserved.