@@ -39,6 +39,83 @@ type ArangoSearchView interface {
39
39
SetProperties (ctx context.Context , options ArangoSearchViewProperties ) error
40
40
}
41
41
42
+ // ArangoSearchAnalyzerType specifies type of an analyzer
43
+ type ArangoSearchAnalyzerType string
44
+
45
+ const (
46
+ // ArangoSearchAnalyzerTypeIdentity treat value as atom (no transformation)
47
+ ArangoSearchAnalyzerTypeIdentity ArangoSearchAnalyzerType = "identity"
48
+ // ArangoSearchAnalyzerTypeDelimiter split into tokens at user-defined character
49
+ ArangoSearchAnalyzerTypeDelimiter ArangoSearchAnalyzerType = "delimiter"
50
+ // ArangoSearchAnalyzerTypeStem apply stemming to the value as a whole
51
+ ArangoSearchAnalyzerTypeStem ArangoSearchAnalyzerType = "stem"
52
+ // ArangoSearchAnalyzerTypeNorm apply normalization to the value as a whole
53
+ ArangoSearchAnalyzerTypeNorm ArangoSearchAnalyzerType = "norm"
54
+ // ArangoSearchAnalyzerTypeNGram create n-grams from value with user-defined lengths
55
+ ArangoSearchAnalyzerTypeNGram ArangoSearchAnalyzerType = "ngram"
56
+ // ArangoSearchAnalyzerTypeText tokenize into words, optionally with stemming, normalization and stop-word filtering
57
+ ArangoSearchAnalyzerTypeText ArangoSearchAnalyzerType = "text"
58
+ )
59
+
60
+ // ArangoSearchAnalyzerFeature specifies a feature to an analyzer
61
+ type ArangoSearchAnalyzerFeature string
62
+
63
+ const (
64
+ // ArangoSearchAnalyzerFeatureFrequency how often a term is seen, required for PHRASE()
65
+ ArangoSearchAnalyzerFeatureFrequency ArangoSearchAnalyzerFeature = "frequency"
66
+ // ArangoSearchAnalyzerFeatureNorm the field normalization factor
67
+ ArangoSearchAnalyzerFeatureNorm ArangoSearchAnalyzerFeature = "norm"
68
+ // ArangoSearchAnalyzerFeaturePosition sequentially increasing term position, required for PHRASE(). If present then the frequency feature is also required
69
+ ArangoSearchAnalyzerFeaturePosition ArangoSearchAnalyzerFeature = "position"
70
+ )
71
+
72
+ type ArangoSearchCaseType string
73
+
74
+ const (
75
+ // ArangoSearchCaseUpper to convert to all lower-case characters
76
+ ArangoSearchCaseUpper ArangoSearchCaseType = "upper"
77
+ // ArangoSearchCaseLower to convert to all upper-case characters
78
+ ArangoSearchCaseLower ArangoSearchCaseType = "lower"
79
+ // ArangoSearchCaseNone to not change character case (default)
80
+ ArangoSearchCaseNone ArangoSearchCaseType = "none"
81
+ )
82
+
83
+ // ArangoSearchAnalyzerProperties specifies options for the analyzer. Which fields are required and
84
+ // respected depends on the analyzer type.
85
+ // more information can be found here: https://www.arangodb.com/docs/stable/arangosearch-analyzers.html#analyzer-properties
86
+ type ArangoSearchAnalyzerProperties struct {
87
+ // Locale used by Stem, Norm, Text
88
+ Locale string `json:"locale,omitempty"`
89
+ // Delimiter used by Delimiter
90
+ Delimiter string `json:"delimiter,omitempty"`
91
+ // Accent used by Norm, Text
92
+ Accent * bool `json:"accent,omitempty"`
93
+ // Case used by Norm, Text
94
+ Case ArangoSearchCaseType `json:"case,omitempty"`
95
+
96
+ // Min used by NGram
97
+ Min * int64 `json:"min,omitempty"`
98
+ // Max used by NGram
99
+ Max * int64 `json:"max,omitempty"`
100
+ // PreserveOriginal used by NGram
101
+ PreserveOriginal * int64 `json:"preserveOriginal,omitempty"`
102
+
103
+ // Stemming used by Text
104
+ Stemming * bool `json:"stemming,omitempty"`
105
+ // Stopword used by Text
106
+ Stopwords []string `json:"stopwords,omitempty"`
107
+ // StopwordsPath used by Text
108
+ StopwordsPath []string `json:"stopwordsPath,omitempty"`
109
+ }
110
+
111
+ // ArangoSearchAnalyzerDefinition provides definition of an analyzer
112
+ type ArangoSearchAnalyzerDefinition struct {
113
+ Name string `json:"name,omitempty"`
114
+ Type ArangoSearchAnalyzerType `json:"type,omitempty"`
115
+ Properties ArangoSearchAnalyzerProperties `json:"properties,omitempty"`
116
+ Features []ArangoSearchAnalyzerFeature `json:"features,omitempty"`
117
+ }
118
+
42
119
// ArangoSearchViewProperties contains properties an an ArangoSearch view.
43
120
type ArangoSearchViewProperties struct {
44
121
// CleanupIntervalStep specifies the minimum number of commits to wait between
@@ -96,7 +173,9 @@ type ArangoSearchViewProperties struct {
96
173
type ArangoSearchSortDirection string
97
174
98
175
const (
99
- ArangoSearchSortDirectionAsc ArangoSearchSortDirection = "ASC"
176
+ // ArangoSearchSortDirectionAsc sort ascending
177
+ ArangoSearchSortDirectionAsc ArangoSearchSortDirection = "ASC"
178
+ // ArangoSearchSortDirectionDesc sort descending
100
179
ArangoSearchSortDirectionDesc ArangoSearchSortDirection = "DESC"
101
180
)
102
181
@@ -184,6 +263,7 @@ type ArangoSearchFields map[string]ArangoSearchElementProperties
184
263
// Note that this structure is recursive. Settings not specified (nil)
185
264
// at a given level will inherit their setting from a lower level.
186
265
type ArangoSearchElementProperties struct {
266
+ AnalyzerDefinitions []ArangoSearchAnalyzerDefinition `json:"analyzerDefinitions,omitempty"`
187
267
// The list of analyzers to be used for indexing of string values. Defaults to ["identify"].
188
268
Analyzers []string `json:"analyzers,omitempty"`
189
269
// If set to true, all fields of this element will be indexed. Defaults to false.
0 commit comments