-
Notifications
You must be signed in to change notification settings - Fork 2
/
query.go
44 lines (38 loc) · 1.4 KB
/
query.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package search
import "github.com/geange/lucene-go/core/index"
// Query
// The abstract base class for queries.
// * Instantiable subclasses are:
// * TermQuery
// * BooleanQuery
// * WildcardQuery
// * PhraseQuery
// * PrefixQuery
// * MultiPhraseQuery
// * FuzzyQuery
// * RegexpQuery
// * TermRangeQuery
// * PointRangeQuery
// * ConstantScoreQuery
// * DisjunctionMaxQuery
// * MatchAllDocsQuery
// See also the family of Span Queries and additional queries available in the Queries module
type Query interface {
// CreateWeight
// Expert: Constructs an appropriate Weight implementation for this query.
// Only implemented by primitive queries, which re-write to themselves.
// scoreMode: How the produced scorers will be consumed.
// boost: The boost that is propagated by the parent queries.
CreateWeight(searcher *IndexSearcher, scoreMode ScoreMode, boost float64) (Weight, error)
// Rewrite
// Expert: called to re-write queries into primitive queries. For example, a PrefixQuery will be
// rewritten into a BooleanQuery that consists of TermQuerys.
Rewrite(reader index.IndexReader) (Query, error)
// Visit
// Recurse through the query tree, visiting any child queries
// visitor: a QueryVisitor to be called by each query in the tree
Visit(visitor QueryVisitor) error
// String
// Convert a query to a string, with field assumed to be the default field and omitted.
String(field string) string
}