forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanalyzer.d.ts
More file actions
479 lines (479 loc) · 11.5 KB
/
Copy pathanalyzer.d.ts
File metadata and controls
479 lines (479 loc) · 11.5 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
/**
* ```ts
* import type { Analyzer } from "arangojs/analyzer";
* ```
*
* The "analyzer" module provides analyzer related types and interfaces
* for TypeScript.
*
* @packageDocumentation
*/
import { ArangoResponseMetadata } from "./connection";
import { Database } from "./database";
/**
* Indicates whether the given value represents an {@link Analyzer}.
*
* @param analyzer - A value that might be an Analyzer.
*/
export declare function isArangoAnalyzer(analyzer: any): analyzer is Analyzer;
/**
* Name of a feature enabled for an Analyzer.
*/
export declare type AnalyzerFeature = "frequency" | "norm" | "position";
/**
* An object describing an Analyzer.
*/
export declare type AnalyzerDescription = AnalyzerInfo & {
name: string;
features: AnalyzerFeature[];
};
/**
* Options for creating an Analyzer.
*/
export declare type CreateAnalyzerOptions = AnalyzerInfo & {
/**
* Features to enable for this Analyzer.
*/
features?: AnalyzerFeature[];
};
/**
* Analyzer type and its type-specific properties.
*/
export declare type AnalyzerInfo = IdentityAnalyzerInfo | DelimiterAnalyzerInfo | StemAnalyzerInfo | NormAnalyzerInfo | NgramAnalyzerInfo | TextAnalyzerInfo | PipelineAnalyzer | AqlAnalyzer | GeoJsonAnalyzer | GeoPointAnalyzer | StopwordsAnalyzer;
/**
* Analyzer type and type-specific properties for an Identity Analyzer.
*/
export declare type IdentityAnalyzerInfo = {
/**
* Type of the Analyzer.
*/
type: "identity";
/**
* Additional properties for the Analyzer.
*
* The `identity` Analyzer does not take additional properties.
*/
properties?: null;
};
/**
* Analyzer type and type-specific properties for a Delimiter Analyzer.
*/
export declare type DelimiterAnalyzerInfo = {
/**
* Type of the Analyzer.
*/
type: "delimiter";
/**
* Additional properties for the Analyzer.
*
* The value will be used as delimiter to split text into tokens as specified
* in RFC 4180, without starting new records on newlines.
*/
properties: string | {
delimiter: string;
};
};
/**
* Analyzer type and type-specific properties for a Stem Analyzer.
*/
export declare type StemAnalyzerInfo = {
/**
* Type of the Analyzer.
*/
type: "stem";
/**
* Additional properties for the Analyzer.
*
* The value defines the text locale.
*
* Format: `language[_COUNTRY][.encoding][@variant]`
*/
properties: {
locale: string;
};
};
/**
* Properties of a Norm Analyzer.
*/
export declare type NormAnalyzerProperties = {
/**
* Text locale.
*
* Format: `language[_COUNTRY][.encoding][@variant]`
*/
locale: string;
/**
* Case conversion.
*
* Default: `"lower"`
*/
case?: "lower" | "none" | "upper";
/**
* Preserve accents in returned words.
*
* Default: `false`
*/
accent?: boolean;
};
/**
* Analyzer type and type-specific properties for a Norm Analyzer.
*/
export declare type NormAnalyzerInfo = {
/**
* Type of the Analyzer.
*/
type: "norm";
/**
* Additional properties for the Analyzer.
*/
properties: NormAnalyzerProperties;
};
/**
* Properties of an Ngram Analyzer.
*/
export declare type NgramAnalyzerProperties = {
/**
* Maximum n-gram length.
*/
max: number;
/**
* Minimum n-gram length.
*/
min: number;
/**
* Output the original value as well.
*/
preserveOriginal: boolean;
};
/**
* Analyzer type and type-specific properties for an Ngram Analyzer.
*/
export declare type NgramAnalyzerInfo = {
/**
* Type of the Analyzer.
*/
type: "ngram";
/**
* Additional properties for the Analyzer.
*/
properties: NgramAnalyzerProperties;
};
/**
* Properties of a Text Analyzer.
*/
export declare type TextAnalyzerProperties = {
/**
* Text locale.
*
* Format: `language[_COUNTRY][.encoding][@variant]`
*/
locale: string;
/**
* Case conversion.
*
* Default: `"lower"`
*/
case?: "lower" | "none" | "upper";
/**
* Words to omit from result.
*
* Defaults to the words loaded from the file at `stopwordsPath`.
*/
stopwords?: string[];
/**
* Path with a `language` sub-directory containing files with words to omit.
*
* Defaults to the path specified in the server-side environment variable
* `IRESEARCH_TEXT_STOPWORD_PATH` or the current working directory of the
* ArangoDB process.
*/
stopwordsPath?: string;
/**
* Preserve accents in returned words.
*
* Default: `false`
*/
accent?: boolean;
/**
* Apply stemming on returned words.
*
* Default: `true`
*/
stemming?: boolean;
/**
* If present, then edge n-grams are generated for each token (word).
*/
edgeNgram?: {
min?: number;
max?: number;
preserveOriginal?: boolean;
};
};
/**
* Analyzer type and type-specific properties for a Text Analyzer.
*/
export declare type TextAnalyzerInfo = {
/**
* Type of the Analyzer.
*/
type: "text";
/**
* Additional properties for the Analyzer.
*/
properties: TextAnalyzerProperties;
};
/**
* Properties of a Pipeline Analyzer.
*/
export declare type PipelineAnalyzerProperties = {
/**
* Definitions for Analyzers to chain in this Pipeline Analyzer.
*/
pipeline: AnalyzerInfo[];
};
/**
* Analyzer type and type-specific properties for a Pipeline Analyzer
*/
export declare type PipelineAnalyzer = {
/**
* Type of the Analyzer.
*/
type: "pipeline";
/**
* Additional properties for the Analyzer.
*/
properties: PipelineAnalyzerProperties;
};
/**
* Properties of an AQL Analyzer.
*/
export declare type AqlAnalyzerProperties = {
/**
* AQL query to be executed.
*/
queryString: string;
/**
* If set to `true`, the position is set to `0` for all members of the query result array.
*
* Default: `false`
*/
collapsePositions?: boolean;
/**
* If set to `false`, `null` values will be discarded from the View index.
*
* Default: `true`
*/
keepNull?: boolean;
/**
* Number between `1` and `1000` that determines the batch size for reading
* data from the query.
*
* Default: `1`
*/
batchSize?: number;
/**
* Memory limit for query execution in bytes.
*
* Default: `1048576` (1 MiB)
*/
memoryLimit?: number;
/**
* Data type of the returned tokens.
*
* Default: `"string"`
*/
returnType?: "string" | "number" | "bool";
};
/**
* Analyzer type and type-specific properties for an AQL Analyzer
*/
export declare type AqlAnalyzer = {
/**
* Type of the Analyzer.
*/
type: "aql";
/**
* Additional properties for the Analyzer.
*/
properties: AqlAnalyzerProperties;
};
/**
* Properties of a GeoJSON Analyzer.
*/
export declare type GeoJsonAnalyzerProperties = {
/**
* If set to `"centroid"`, only the centroid of the input geometry will be
* computed and indexed.
*
* If set to `"point"` only GeoJSON objects of type Point will be indexed and
* all other geometry types will be ignored.
*
* Default: `"shape"`
*/
type?: "shape" | "centroid" | "point";
/**
* Options for fine-tuning geo queries.
*
* Default: `{ maxCells: 20, minLevel: 4, maxLevel: 23 }`
*/
options?: {
maxCells?: number;
minLevel?: number;
maxLevel?: number;
};
};
/**
* Analyzer type and type-specific properties for a GeoJSON Analyzer
*/
export declare type GeoJsonAnalyzer = {
/**
* Type of the Analyzer.
*/
type: "geojson";
/**
* Additional properties for the Analyzer.
*/
properties: GeoJsonAnalyzerProperties;
};
/**
* Properties of a GeoPoint Analyzer.
*/
export declare type GeoPointAnalyzerProperties = {
/**
* Attribute paths of the latitude value relative to the field for which the
* Analyzer is defined in the View.
*/
latitude?: string[];
/**
* Attribute paths of the longitude value relative to the field for which the
* Analyzer is defined in the View.
*/
longitude?: string[];
/**
* Options for fine-tuning geo queries.
*
* Default: `{ maxCells: 20, minLevel: 4, maxLevel: 23 }`
*/
options?: {
minCells?: number;
minLevel?: number;
maxLevel?: number;
};
};
/**
* Analyzer type and type-specific properties for a GeoPoint Analyzer
*/
export declare type GeoPointAnalyzer = {
/**
* Type of the Analyzer.
*/
type: "geopoint";
/**
* Additional properties for the Analyzer.
*/
properties: GeoPointAnalyzerProperties;
};
/**
* Properties of a Stopwords Analyzer.
*/
export declare type StopwordsAnalyzerProperties = {
/**
* Hex-encoded strings that describe the tokens to be discarded.
*/
stopwords: string[];
};
/**
* Analyzer type and type-specific properties for a Stopwords Analyzer
*/
export declare type StopwordsAnalyzer = {
/**
* Type of the Analyzer.
*/
type: "stopwords";
/**
* Additional properties for the Analyzer.
*/
properties: StopwordsAnalyzerProperties;
};
/**
* Represents an Analyzer in a {@link Database}.
*/
export declare class Analyzer {
protected _name: string;
protected _db: Database;
/**
* @internal
* @hidden
*/
constructor(db: Database, name: string);
/**
* @internal
*
* Indicates that this object represents an ArangoDB Analyzer.
*/
get isArangoAnalyzer(): true;
/**
* Name of this Analyzer.
*
* See also {@link Database.analyzer}.
*/
get name(): string;
/**
* Checks whether the Analyzer exists.
*
* @example
* ```js
* const db = new Database();
* const analyzer = db.analyzer("some-analyzer");
* const result = await analyzer.exists();
* // result indicates whether the Analyzer exists
* ```
*/
exists(): Promise<boolean>;
/**
* Retrieves the Analyzer definition for the Analyzer.
*
* @example
* ```js
* const db = new Database();
* const analyzer = db.analyzer("some-analyzer");
* const definition = await analyzer.get();
* // definition contains the Analyzer definition
* ```
*/
get(): Promise<ArangoResponseMetadata & AnalyzerDescription>;
/**
* Creates a new Analyzer with the given `options` and the instance's name.
*
* See also {@link Database.createAnalyzer}.
*
* @param options - Options for creating the Analyzer.
*
* @example
* ```js
* const db = new Database();
* const analyzer = db.analyzer("potatoes");
* await analyzer.create({ type: "identity" });
* // the identity Analyzer "potatoes" now exists
* ```
*/
create(options: CreateAnalyzerOptions): Promise<AnalyzerDescription>;
/**
* Deletes the Analyzer from the database.
*
* @param force - Whether the Analyzer should still be deleted even if it
* is currently in use.
*
* @example
* ```js
* const db = new Database();
* const analyzer = db.analyzer("some-analyzer");
* await analyzer.drop();
* // the Analyzer "some-analyzer" no longer exists
* ```
*/
drop(force?: boolean): Promise<ArangoResponseMetadata & {
name: string;
}>;
}
//# sourceMappingURL=analyzer.d.ts.map