/
index_phrases.go
67 lines (62 loc) · 2.86 KB
/
index_phrases.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package mapping
// WithIndexPhrases is a mapping with the index_phrases parameter
//
// If IndexPhrases parameter is enabled, two-term word combinations (shingles)
// are indexed into a separate field. This allows exact phrase queries (no slop)
// to run more efficiently, at the expense of a larger index. Note that this
// works best when stopwords are not removed, as phrases containing stopwords
// will not use the subsidiary field and will fall back to a standard phrase
// query. Accepts true or false (default).
//
// https://www.elastic.co/guide/en/elasticsearch/reference/current/index-phrases.html#index-phrases
type WithIndexPhrases interface {
// IndexPhrases is a param that if enabled, two-term word combinations
// (shingles) are indexed into a separate field. This allows exact phrase
// queries (no slop) to run more efficiently, at the expense of a larger index.
//
// Note that this works best when stopwords are not removed, as phrases
// containing stopwords will not use the subsidiary field and will fall back to
// a standard phrase query. Accepts true or false (default).
IndexPhrases() bool
// SetIndexPhrases sets the IndexPhrases value to v
SetIndexPhrases(v bool)
}
// FieldWithIndexPhrases is a Field with the index_phrases parameter
//
// https://www.elastic.co/guide/en/elasticsearch/reference/current/index-phrases.html#index-phrases
type FieldWithIndexPhrases interface {
Field
WithIndexPhrases
}
// IndexPhrasesParam is a mixin that adds the index_phrases parameter
//
// If IndexPhrases parameter is enabled, two-term word combinations (shingles)
// are indexed into a separate field. This allows exact phrase queries (no slop)
// to run more efficiently, at the expense of a larger index. Note that this
// works best when stopwords are not removed, as phrases containing stopwords
// will not use the subsidiary field and will fall back to a standard phrase
// query. Accepts true or false (default).
//
// https://www.elastic.co/guide/en/elasticsearch/reference/current/index-phrases.html#index-phrases
type IndexPhrasesParam struct {
IndexPhrasesValue *bool `bson:"index_phrases,omitempty" json:"index_phrases,omitempty"`
}
// IndexPhrases is a param that if enabled, two-term word combinations
// (shingles) are indexed into a separate field. This allows exact phrase
// queries (no slop) to run more efficiently, at the expense of a larger index.
//
// Note that this works best when stopwords are not removed, as phrases
// containing stopwords will not use the subsidiary field and will fall back to
// a standard phrase query. Accepts true or false (default).
func (cp IndexPhrasesParam) IndexPhrases() bool {
if cp.IndexPhrasesValue != nil {
return *cp.IndexPhrasesValue
}
return false
}
// SetIndexPhrases sets the IndexPhrases value to v
func (cp *IndexPhrasesParam) SetIndexPhrases(v bool) {
if cp.IndexPhrases() != v {
cp.IndexPhrasesValue = &v
}
}