1 | /**
|
2 | * ```ts
|
3 | * import type { Analyzer } from "arangojs/analyzer.js";
|
4 | * ```
|
5 | *
|
6 | * The "analyzer" module provides analyzer related types and interfaces
|
7 | * for TypeScript.
|
8 | *
|
9 | * @packageDocumentation
|
10 | */
|
11 | import { ArangoApiResponse } from "./connection.js";
|
12 | import { Database } from "./database.js";
|
13 | /**
|
14 | * Indicates whether the given value represents an {@link Analyzer}.
|
15 | *
|
16 | * @param analyzer - A value that might be an Analyzer.
|
17 | */
|
18 | export declare function isArangoAnalyzer(analyzer: any): analyzer is Analyzer;
|
19 | /**
|
20 | * Name of a feature enabled for an Analyzer.
|
21 | */
|
22 | export type AnalyzerFeature = "frequency" | "norm" | "position" | "offset";
|
23 | /**
|
24 | * Analyzer type and its type-specific properties.
|
25 | */
|
26 | export type CreateAnalyzerOptions = CreateIdentityAnalyzerOptions | CreateDelimiterAnalyzerOptions | CreateMultiDelimiterAnalyzerOptions | CreateStemAnalyzerOptions | CreateNormAnalyzerOptions | CreateNgramAnalyzerOptions | CreateTextAnalyzerOptions | CreateSegmentationAnalyzerOptions | CreateAqlAnalyzerOptions | CreatePipelineAnalyzerOptions | CreateStopwordsAnalyzerOptions | CreateCollationAnalyzerOptions | CreateMinHashAnalyzerOptions | CreateClassificationAnalyzerOptions | CreateNearestNeighborsAnalyzerOptions | CreateWildcardAnalyzerOptions | CreateGeoJsonAnalyzerOptions | CreateGeoPointAnalyzerOptions | CreateGeoS2AnalyzerOptions;
|
27 | /**
|
28 | * Options for creating an Identity Analyzer.
|
29 | */
|
30 | export type CreateIdentityAnalyzerOptions = {
|
31 | /**
|
32 | * Type of the Analyzer.
|
33 | */
|
34 | type: "identity";
|
35 | /**
|
36 | * Features to enable for this Analyzer.
|
37 | */
|
38 | features?: AnalyzerFeature[];
|
39 | /**
|
40 | * Additional properties for the Analyzer.
|
41 | *
|
42 | * The `identity` Analyzer does not take additional properties.
|
43 | */
|
44 | properties?: Record<string, never>;
|
45 | };
|
46 | /**
|
47 | * Options for creating a Delimiter Analyzer.
|
48 | */
|
49 | export type CreateDelimiterAnalyzerOptions = {
|
50 | /**
|
51 | * Type of the Analyzer.
|
52 | */
|
53 | type: "delimiter";
|
54 | /**
|
55 | * Features to enable for this Analyzer.
|
56 | */
|
57 | features?: AnalyzerFeature[];
|
58 | /**
|
59 | * Additional properties for the Analyzer.
|
60 | *
|
61 | * The value will be used as delimiter to split text into tokens as specified
|
62 | * in RFC 4180, without starting new records on newlines.
|
63 | */
|
64 | properties: string | {
|
65 | delimiter: string;
|
66 | };
|
67 | };
|
68 | /**
|
69 | * Options for creating a Multi-Delimiter Analyzer.
|
70 | */
|
71 | export type CreateMultiDelimiterAnalyzerOptions = {
|
72 | /**
|
73 | * Type of the Analyzer.
|
74 | */
|
75 | type: "multi_delimiter";
|
76 | /**
|
77 | * Features to enable for this Analyzer.
|
78 | */
|
79 | features?: AnalyzerFeature[];
|
80 | /**
|
81 | * Additional properties for the Analyzer.
|
82 | *
|
83 | * The value will be used as delimiter to split text into tokens as specified
|
84 | * in RFC 4180, without starting new records on newlines.
|
85 | */
|
86 | properties: {
|
87 | delimiters: string[];
|
88 | };
|
89 | };
|
90 | /**
|
91 | * Options for creating a Stem Analyzer.
|
92 | */
|
93 | export type CreateStemAnalyzerOptions = {
|
94 | /**
|
95 | * Type of the Analyzer.
|
96 | */
|
97 | type: "stem";
|
98 | /**
|
99 | * Features to enable for this Analyzer.
|
100 | */
|
101 | features?: AnalyzerFeature[];
|
102 | /**
|
103 | * Additional properties for the Analyzer.
|
104 | *
|
105 | * The value defines the text locale.
|
106 | *
|
107 | * Format: `language[_COUNTRY][.encoding][@variant]`
|
108 | */
|
109 | properties: {
|
110 | locale: string;
|
111 | };
|
112 | };
|
113 | /**
|
114 | * Options for creating a Norm Analyzer.
|
115 | */
|
116 | export type CreateNormAnalyzerOptions = {
|
117 | /**
|
118 | * Type of the Analyzer.
|
119 | */
|
120 | type: "norm";
|
121 | /**
|
122 | * Features to enable for this Analyzer.
|
123 | */
|
124 | features?: AnalyzerFeature[];
|
125 | /**
|
126 | * Additional properties for the Analyzer.
|
127 | */
|
128 | properties: {
|
129 | /**
|
130 | * Text locale.
|
131 | *
|
132 | * Format: `language[_COUNTRY][.encoding][@variant]`
|
133 | */
|
134 | locale: string;
|
135 | /**
|
136 | * Case conversion.
|
137 | *
|
138 | * Default: `"lower"`
|
139 | */
|
140 | case?: "lower" | "none" | "upper";
|
141 | /**
|
142 | * Preserve accents in returned words.
|
143 | *
|
144 | * Default: `false`
|
145 | */
|
146 | accent?: boolean;
|
147 | };
|
148 | };
|
149 | /**
|
150 | * Options for creating an Ngram Analyzer.
|
151 | */
|
152 | export type CreateNgramAnalyzerOptions = {
|
153 | /**
|
154 | * Type of the Analyzer.
|
155 | */
|
156 | type: "ngram";
|
157 | /**
|
158 | * Features to enable for this Analyzer.
|
159 | */
|
160 | features?: AnalyzerFeature[];
|
161 | /**
|
162 | * Additional properties for the Analyzer.
|
163 | */
|
164 | properties: {
|
165 | /**
|
166 | * Maximum n-gram length.
|
167 | */
|
168 | max: number;
|
169 | /**
|
170 | * Minimum n-gram length.
|
171 | */
|
172 | min: number;
|
173 | /**
|
174 | * Output the original value as well.
|
175 | */
|
176 | preserveOriginal: boolean;
|
177 | };
|
178 | };
|
179 | /**
|
180 | * Options for creating a Text Analyzer.
|
181 | */
|
182 | export type CreateTextAnalyzerOptions = {
|
183 | /**
|
184 | * Type of the Analyzer.
|
185 | */
|
186 | type: "text";
|
187 | /**
|
188 | * Features to enable for this Analyzer.
|
189 | */
|
190 | features?: AnalyzerFeature[];
|
191 | /**
|
192 | * Additional properties for the Analyzer.
|
193 | */
|
194 | properties: {
|
195 | /**
|
196 | * Text locale.
|
197 | *
|
198 | * Format: `language[_COUNTRY][.encoding][@variant]`
|
199 | */
|
200 | locale: string;
|
201 | /**
|
202 | * Case conversion.
|
203 | *
|
204 | * Default: `"lower"`
|
205 | */
|
206 | case?: "lower" | "none" | "upper";
|
207 | /**
|
208 | * Words to omit from result.
|
209 | *
|
210 | * Defaults to the words loaded from the file at `stopwordsPath`.
|
211 | */
|
212 | stopwords?: string[];
|
213 | /**
|
214 | * Path with a `language` sub-directory containing files with words to omit.
|
215 | *
|
216 | * Defaults to the path specified in the server-side environment variable
|
217 | * `IRESEARCH_TEXT_STOPWORD_PATH` or the current working directory of the
|
218 | * ArangoDB process.
|
219 | */
|
220 | stopwordsPath?: string;
|
221 | /**
|
222 | * Preserve accents in returned words.
|
223 | *
|
224 | * Default: `false`
|
225 | */
|
226 | accent?: boolean;
|
227 | /**
|
228 | * Apply stemming on returned words.
|
229 | *
|
230 | * Default: `true`
|
231 | */
|
232 | stemming?: boolean;
|
233 | /**
|
234 | * If present, then edge n-grams are generated for each token (word).
|
235 | */
|
236 | edgeNgram?: {
|
237 | min?: number;
|
238 | max?: number;
|
239 | preserveOriginal?: boolean;
|
240 | };
|
241 | };
|
242 | };
|
243 | /**
|
244 | * Options for creating a Segmentation Analyzer
|
245 | */
|
246 | export type CreateSegmentationAnalyzerOptions = {
|
247 | /**
|
248 | * Type of the Analyzer.
|
249 | */
|
250 | type: "segmentation";
|
251 | /**
|
252 | * Features to enable for this Analyzer.
|
253 | */
|
254 | features?: AnalyzerFeature[];
|
255 | /**
|
256 | * Additional properties for the Analyzer.
|
257 | */
|
258 | properties: {
|
259 | /**
|
260 | * Which tokens should be returned.
|
261 | *
|
262 | * Default: `"alpha"`
|
263 | */
|
264 | break?: "all" | "alpha" | "graphic";
|
265 | /**
|
266 | * What case all returned tokens should be converted to if applicable.
|
267 | *
|
268 | * Default: `"none"`
|
269 | */
|
270 | case?: "lower" | "upper" | "none";
|
271 | };
|
272 | };
|
273 | /**
|
274 | * Options for creating an AQL Analyzer
|
275 | */
|
276 | export type CreateAqlAnalyzerOptions = {
|
277 | /**
|
278 | * Type of the Analyzer.
|
279 | */
|
280 | type: "aql";
|
281 | /**
|
282 | * Features to enable for this Analyzer.
|
283 | */
|
284 | features?: AnalyzerFeature[];
|
285 | /**
|
286 | * Additional properties for the Analyzer.
|
287 | */
|
288 | properties: {
|
289 | /**
|
290 | * AQL query to be executed.
|
291 | */
|
292 | queryString: string;
|
293 | /**
|
294 | * If set to `true`, the position is set to `0` for all members of the query result array.
|
295 | *
|
296 | * Default: `false`
|
297 | */
|
298 | collapsePositions?: boolean;
|
299 | /**
|
300 | * If set to `false`, `null` values will be discarded from the View index.
|
301 | *
|
302 | * Default: `true`
|
303 | */
|
304 | keepNull?: boolean;
|
305 | /**
|
306 | * Number between `1` and `1000` that determines the batch size for reading
|
307 | * data from the query.
|
308 | *
|
309 | * Default: `1`
|
310 | */
|
311 | batchSize?: number;
|
312 | /**
|
313 | * Memory limit for query execution in bytes.
|
314 | *
|
315 | * Default: `1048576` (1 MiB)
|
316 | */
|
317 | memoryLimit?: number;
|
318 | /**
|
319 | * Data type of the returned tokens.
|
320 | *
|
321 | * Default: `"string"`
|
322 | */
|
323 | returnType?: "string" | "number" | "bool";
|
324 | };
|
325 | };
|
326 | /**
|
327 | * Options for creating a Pipeline Analyzer
|
328 | */
|
329 | export type CreatePipelineAnalyzerOptions = {
|
330 | /**
|
331 | * Type of the Analyzer.
|
332 | */
|
333 | type: "pipeline";
|
334 | /**
|
335 | * Features to enable for this Analyzer.
|
336 | */
|
337 | features?: AnalyzerFeature[];
|
338 | /**
|
339 | * Additional properties for the Analyzer.
|
340 | */
|
341 | properties: {
|
342 | /**
|
343 | * Definitions for Analyzers to chain in this Pipeline Analyzer.
|
344 | */
|
345 | pipeline: Omit<CreateAnalyzerOptions, "features">[];
|
346 | };
|
347 | };
|
348 | /**
|
349 | * Options for creating a Stopwords Analyzer
|
350 | */
|
351 | export type CreateStopwordsAnalyzerOptions = {
|
352 | /**
|
353 | * Type of the Analyzer.
|
354 | */
|
355 | type: "stopwords";
|
356 | /**
|
357 | * Features to enable for this Analyzer.
|
358 | */
|
359 | features?: AnalyzerFeature[];
|
360 | /**
|
361 | * Additional properties for the Analyzer.
|
362 | */
|
363 | properties: {
|
364 | /**
|
365 | * Array of strings that describe the tokens to be discarded.
|
366 | */
|
367 | stopwords: string[];
|
368 | /**
|
369 | * Whether stopword values should be interpreted as hex-encoded strings.
|
370 | *
|
371 | * Default: `false`
|
372 | */
|
373 | hex?: boolean;
|
374 | };
|
375 | };
|
376 | /**
|
377 | * Options for creating a Collation Analyzer
|
378 | */
|
379 | export type CreateCollationAnalyzerOptions = {
|
380 | /**
|
381 | * Type of the Analyzer.
|
382 | */
|
383 | type: "collation";
|
384 | /**
|
385 | * Features to enable for this Analyzer.
|
386 | */
|
387 | features?: AnalyzerFeature[];
|
388 | /**
|
389 | * Additional properties for the Analyzer.
|
390 | */
|
391 | properties: {
|
392 | /**
|
393 | * Text locale.
|
394 | *
|
395 | * Format: `language[_COUNTRY][.encoding][@variant]`
|
396 | */
|
397 | locale: string;
|
398 | };
|
399 | };
|
400 | /**
|
401 | * (Enterprise Edition only.) Options for creating a MinHash Analyzer
|
402 | */
|
403 | export type CreateMinHashAnalyzerOptions = {
|
404 | /**
|
405 | * Type of the Analyzer.
|
406 | */
|
407 | type: "minhash";
|
408 | /**
|
409 | * Features to enable for this Analyzer.
|
410 | */
|
411 | features?: AnalyzerFeature[];
|
412 | /**
|
413 | * Additional properties for the Analyzer.
|
414 | */
|
415 | properties: {
|
416 | /**
|
417 | * An Analyzer definition-like object with `type` and `properties` attributes.
|
418 | */
|
419 | analyzer: Omit<CreateAnalyzerOptions, "features">;
|
420 | /**
|
421 | * Size of the MinHash signature.
|
422 | */
|
423 | numHashes: number;
|
424 | };
|
425 | };
|
426 | /**
|
427 | * (Enterprise Edition only.) Options for creating a Classification Analyzer
|
428 | */
|
429 | export type CreateClassificationAnalyzerOptions = {
|
430 | /**
|
431 | * Type of the Analyzer.
|
432 | */
|
433 | type: "classification";
|
434 | /**
|
435 | * Features to enable for this Analyzer.
|
436 | */
|
437 | features?: AnalyzerFeature[];
|
438 | /**
|
439 | * Additional properties for the Analyzer.
|
440 | */
|
441 | properties: {
|
442 | /**
|
443 | * On-disk path to the trained fastText supervised model.
|
444 | */
|
445 | model_location: string;
|
446 | /**
|
447 | * Number of class labels that will be produced per input.
|
448 | *
|
449 | * Default: `1`
|
450 | */
|
451 | top_k?: number;
|
452 | /**
|
453 | * Probability threshold for which a label will be assigned to an input.
|
454 | *
|
455 | * Default: `0.99`
|
456 | */
|
457 | threshold?: number;
|
458 | };
|
459 | };
|
460 | /**
|
461 | * (Enterprise Edition only.) Options for creating a NearestNeighbors Analyzer.
|
462 | */
|
463 | export type CreateNearestNeighborsAnalyzerOptions = {
|
464 | /**
|
465 | * Type of the Analyzer.
|
466 | */
|
467 | type: "nearest_neighbors";
|
468 | /**
|
469 | * Features to enable for this Analyzer.
|
470 | */
|
471 | features?: AnalyzerFeature[];
|
472 | /**
|
473 | * Additional properties for the Analyzer.
|
474 | */
|
475 | properties: {
|
476 | /**
|
477 | * On-disk path to the trained fastText supervised model.
|
478 | */
|
479 | model_location: string;
|
480 | /**
|
481 | * Number of class labels that will be produced per input.
|
482 | *
|
483 | * Default: `1`
|
484 | */
|
485 | top_k?: number;
|
486 | };
|
487 | };
|
488 | /**
|
489 | * Options for creating a Wildcard Analyzer.
|
490 | */
|
491 | export type CreateWildcardAnalyzerOptions = {
|
492 | /**
|
493 | * Type of the Analyzer.
|
494 | */
|
495 | type: "wildcard";
|
496 | /**
|
497 | * Features to enable for this Analyzer.
|
498 | */
|
499 | features?: AnalyzerFeature[];
|
500 | /**
|
501 | * Additional properties for the Analyzer.
|
502 | */
|
503 | properties: {
|
504 | /**
|
505 | * N-gram length. Must be a positive integer greater than or equal to 2.
|
506 | */
|
507 | ngramSize: string;
|
508 | /**
|
509 | * An Analyzer definition-like object with `type` and `properties` attributes.
|
510 | */
|
511 | analyzer?: Omit<CreateAnalyzerOptions, "features">;
|
512 | };
|
513 | };
|
514 | /**
|
515 | * Options for creating a GeoJSON Analyzer
|
516 | */
|
517 | export type CreateGeoJsonAnalyzerOptions = {
|
518 | /**
|
519 | * Type of the Analyzer.
|
520 | */
|
521 | type: "geojson";
|
522 | /**
|
523 | * Features to enable for this Analyzer.
|
524 | */
|
525 | features?: AnalyzerFeature[];
|
526 | /**
|
527 | * Additional properties for the Analyzer.
|
528 | */
|
529 | properties: {
|
530 | /**
|
531 | * If set to `"centroid"`, only the centroid of the input geometry will be
|
532 | * computed and indexed.
|
533 | *
|
534 | * If set to `"point"` only GeoJSON objects of type Point will be indexed and
|
535 | * all other geometry types will be ignored.
|
536 | *
|
537 | * Default: `"shape"`
|
538 | */
|
539 | type?: "shape" | "centroid" | "point";
|
540 | /**
|
541 | * Options for fine-tuning geo queries.
|
542 | *
|
543 | * Default: `{ maxCells: 20, minLevel: 4, maxLevel: 23 }`
|
544 | */
|
545 | options?: {
|
546 | maxCells?: number;
|
547 | minLevel?: number;
|
548 | maxLevel?: number;
|
549 | };
|
550 | };
|
551 | };
|
552 | /**
|
553 | * Options for creating a GeoPoint Analyzer
|
554 | */
|
555 | export type CreateGeoPointAnalyzerOptions = {
|
556 | /**
|
557 | * Type of the Analyzer.
|
558 | */
|
559 | type: "geopoint";
|
560 | /**
|
561 | * Features to enable for this Analyzer.
|
562 | */
|
563 | features?: AnalyzerFeature[];
|
564 | /**
|
565 | * Additional properties for the Analyzer.
|
566 | */
|
567 | properties: {
|
568 | /**
|
569 | * Attribute paths of the latitude value relative to the field for which the
|
570 | * Analyzer is defined in the View.
|
571 | */
|
572 | latitude?: string[];
|
573 | /**
|
574 | * Attribute paths of the longitude value relative to the field for which the
|
575 | * Analyzer is defined in the View.
|
576 | */
|
577 | longitude?: string[];
|
578 | /**
|
579 | * Options for fine-tuning geo queries.
|
580 | *
|
581 | * Default: `{ maxCells: 20, minLevel: 4, maxLevel: 23 }`
|
582 | */
|
583 | options?: {
|
584 | minCells?: number;
|
585 | minLevel?: number;
|
586 | maxLevel?: number;
|
587 | };
|
588 | };
|
589 | };
|
590 | /**
|
591 | * (Enterprise Edition only.) Options for creating a Geo S2 Analyzer
|
592 | */
|
593 | export type CreateGeoS2AnalyzerOptions = {
|
594 | /**
|
595 | * Type of the Analyzer.
|
596 | */
|
597 | type: "geo_s2";
|
598 | /**
|
599 | * Features to enable for this Analyzer.
|
600 | */
|
601 | features?: AnalyzerFeature[];
|
602 | /**
|
603 | * Additional properties for the Analyzer.
|
604 | */
|
605 | properties: {
|
606 | /**
|
607 | * If set to `"centroid"`, only the centroid of the input geometry will be
|
608 | * computed and indexed.
|
609 | *
|
610 | * If set to `"point"` only GeoJSON objects of type Point will be indexed and
|
611 | * all other geometry types will be ignored.
|
612 | *
|
613 | * Default: `"shape"`
|
614 | */
|
615 | type?: "shape" | "centroid" | "point";
|
616 | /**
|
617 | * Options for fine-tuning geo queries.
|
618 | *
|
619 | * Default: `{ maxCells: 20, minLevel: 4, maxLevel: 23 }`
|
620 | */
|
621 | options?: {
|
622 | maxCells?: number;
|
623 | minLevel?: number;
|
624 | maxLevel?: number;
|
625 | };
|
626 | /**
|
627 | * If set to `"latLngDouble"`, each latitude and longitude value is stored
|
628 | * as an 8-byte floating-point value (16 bytes per coordinate pair).
|
629 | *
|
630 | * If set to `"latLngInt"`, each latitude and longitude value is stored as
|
631 | * a 4-byte integer value (8 bytes per coordinate pair).
|
632 | *
|
633 | * If set to `"s2Point"`, each longitude-latitude pair is stored in the
|
634 | * native format of Google S2 (24 bytes per coordinate pair).
|
635 | *
|
636 | * Default: `"latLngDouble"`
|
637 | */
|
638 | format?: "latLngDouble" | "latLngInt" | "s2Point";
|
639 | };
|
640 | };
|
641 | /**
|
642 | * Shared attributes of all Analyzer descriptions.
|
643 | */
|
644 | export type GenericAnalyzerDescription = {
|
645 | /**
|
646 | * A unique name for this Analyzer.
|
647 | */
|
648 | name: string;
|
649 | /**
|
650 | * Features enabled for this Analyzer.
|
651 | */
|
652 | features: AnalyzerFeature[];
|
653 | };
|
654 | /**
|
655 | * An object describing an Analyzer.
|
656 | */
|
657 | export type AnalyzerDescription = IdentityAnalyzerDescription | DelimiterAnalyzerDescription | MultiDelimiterAnalyzerDescription | StemAnalyzerDescription | NormAnalyzerDescription | NgramAnalyzerDescription | TextAnalyzerDescription | SegmentationAnalyzerDescription | AqlAnalyzerDescription | PipelineAnalyzerDescription | StopwordsAnalyzerDescription | CollationAnalyzerDescription | MinHashAnalyzerDescription | ClassificationAnalyzerDescription | NearestNeighborsAnalyzerDescription | WildcardAnalyzerDescription | GeoJsonAnalyzerDescription | GeoPointAnalyzerDescription | GeoS2AnalyzerDescription;
|
658 | /**
|
659 | * An object describing an Identity Analyzer.
|
660 | */
|
661 | export type IdentityAnalyzerDescription = GenericAnalyzerDescription & {
|
662 | type: "identity";
|
663 | properties: Record<string, never>;
|
664 | };
|
665 | /**
|
666 | * An object describing a Delimiter Analyzer.
|
667 | */
|
668 | export type DelimiterAnalyzerDescription = GenericAnalyzerDescription & {
|
669 | type: "delimiter";
|
670 | properties: {
|
671 | delimiter: string;
|
672 | };
|
673 | };
|
674 | /**
|
675 | * An object describing a Multi Delimiter Analyzer.
|
676 | */
|
677 | export type MultiDelimiterAnalyzerDescription = GenericAnalyzerDescription & {
|
678 | type: "multi_delimiter";
|
679 | properties: {
|
680 | delimiters: string[];
|
681 | };
|
682 | };
|
683 | /**
|
684 | * An object describing a Stem Analyzer.
|
685 | */
|
686 | export type StemAnalyzerDescription = GenericAnalyzerDescription & {
|
687 | type: "stem";
|
688 | properties: {
|
689 | locale: string;
|
690 | };
|
691 | };
|
692 | /**
|
693 | * An object describing a Norm Analyzer.
|
694 | */
|
695 | export type NormAnalyzerDescription = GenericAnalyzerDescription & {
|
696 | type: "norm";
|
697 | properties: {
|
698 | locale: string;
|
699 | case: "lower" | "none" | "upper";
|
700 | accent: boolean;
|
701 | };
|
702 | };
|
703 | /**
|
704 | * An object describing an Ngram Analyzer.
|
705 | */
|
706 | export type NgramAnalyzerDescription = GenericAnalyzerDescription & {
|
707 | type: "ngram";
|
708 | properties: {
|
709 | max: number;
|
710 | min: number;
|
711 | preserveOriginal: boolean;
|
712 | };
|
713 | };
|
714 | /**
|
715 | * An object describing a Text Analyzer.
|
716 | */
|
717 | export type TextAnalyzerDescription = GenericAnalyzerDescription & {
|
718 | type: "text";
|
719 | properties: {
|
720 | locale: string;
|
721 | case: "lower" | "none" | "upper";
|
722 | stopwords: string[];
|
723 | stopwordsPath: string;
|
724 | accent: boolean;
|
725 | stemming: boolean;
|
726 | edgeNgram: {
|
727 | min: number;
|
728 | max: number;
|
729 | preserveOriginal: boolean;
|
730 | };
|
731 | };
|
732 | };
|
733 | /**
|
734 | * An object describing a Segmentation Analyzer
|
735 | */
|
736 | export type SegmentationAnalyzerDescription = GenericAnalyzerDescription & {
|
737 | type: "segmentation";
|
738 | properties: {
|
739 | break: "all" | "alpha" | "graphic";
|
740 | case: "lower" | "upper" | "none";
|
741 | };
|
742 | };
|
743 | /**
|
744 | * An object describing an AQL Analyzer
|
745 | */
|
746 | export type AqlAnalyzerDescription = GenericAnalyzerDescription & {
|
747 | type: "aql";
|
748 | properties: {
|
749 | queryString: string;
|
750 | collapsePositions: boolean;
|
751 | keepNull: boolean;
|
752 | batchSize: number;
|
753 | memoryLimit: number;
|
754 | returnType: "string" | "number" | "bool";
|
755 | };
|
756 | };
|
757 | /**
|
758 | * An object describing a Pipeline Analyzer
|
759 | */
|
760 | export type PipelineAnalyzerDescription = GenericAnalyzerDescription & {
|
761 | type: "pipeline";
|
762 | properties: {
|
763 | pipeline: Omit<AnalyzerDescription, "name" | "features">[];
|
764 | };
|
765 | };
|
766 | /**
|
767 | * An object describing a Stopwords Analyzer
|
768 | */
|
769 | export type StopwordsAnalyzerDescription = GenericAnalyzerDescription & {
|
770 | type: "stopwords";
|
771 | properties: {
|
772 | stopwords: string[];
|
773 | hex: boolean;
|
774 | };
|
775 | };
|
776 | /**
|
777 | * An object describing a Collation Analyzer
|
778 | */
|
779 | export type CollationAnalyzerDescription = GenericAnalyzerDescription & {
|
780 | type: "collation";
|
781 | properties: {
|
782 | locale: string;
|
783 | };
|
784 | };
|
785 | /**
|
786 | * (Enterprise Edition only.) An object describing a MinHash Analyzer
|
787 | */
|
788 | export type MinHashAnalyzerDescription = GenericAnalyzerDescription & {
|
789 | type: "minhash";
|
790 | properties: {
|
791 | analyzer: Omit<AnalyzerDescription, "name" | "features">;
|
792 | numHashes: number;
|
793 | };
|
794 | };
|
795 | /**
|
796 | * (Enterprise Edition only.) An object describing a Classification Analyzer
|
797 | */
|
798 | export type ClassificationAnalyzerDescription = GenericAnalyzerDescription & {
|
799 | type: "classification";
|
800 | properties: {
|
801 | model_location: string;
|
802 | top_k: number;
|
803 | threshold: number;
|
804 | };
|
805 | };
|
806 | /**
|
807 | * (Enterprise Edition only.) An object describing a NearestNeighbors Analyzer
|
808 | */
|
809 | export type NearestNeighborsAnalyzerDescription = GenericAnalyzerDescription & {
|
810 | type: "nearest_neighbors";
|
811 | properties: {
|
812 | model_location: string;
|
813 | top_k: number;
|
814 | };
|
815 | };
|
816 | /**
|
817 | * An object describing a Wildcard Analyzer
|
818 | */
|
819 | export type WildcardAnalyzerDescription = GenericAnalyzerDescription & {
|
820 | type: "wildcard";
|
821 | properties: {
|
822 | ngramSize: number;
|
823 | analyzer?: Omit<AnalyzerDescription, "name" | "features">;
|
824 | };
|
825 | };
|
826 | /**
|
827 | * An object describing a GeoJSON Analyzer
|
828 | */
|
829 | export type GeoJsonAnalyzerDescription = GenericAnalyzerDescription & {
|
830 | type: "geojson";
|
831 | properties: {
|
832 | type: "shape" | "centroid" | "point";
|
833 | description: {
|
834 | maxCells: number;
|
835 | minLevel: number;
|
836 | maxLevel: number;
|
837 | };
|
838 | };
|
839 | };
|
840 | /**
|
841 | * An object describing a GeoPoint Analyzer
|
842 | */
|
843 | export type GeoPointAnalyzerDescription = GenericAnalyzerDescription & {
|
844 | type: "geopoint";
|
845 | properties: {
|
846 | latitude: string[];
|
847 | longitude: string[];
|
848 | description: {
|
849 | minCells: number;
|
850 | minLevel: number;
|
851 | maxLevel: number;
|
852 | };
|
853 | };
|
854 | };
|
855 | /**
|
856 | * (Enterprise Edition only.) An object describing a GeoS2 Analyzer
|
857 | */
|
858 | export type GeoS2AnalyzerDescription = GenericAnalyzerDescription & {
|
859 | type: "geo_s2";
|
860 | properties: {
|
861 | type: "shape" | "centroid" | "point";
|
862 | description: {
|
863 | maxCells: number;
|
864 | minLevel: number;
|
865 | maxLevel: number;
|
866 | };
|
867 | format: "latLngDouble" | "latLngInt" | "s2Point";
|
868 | };
|
869 | };
|
870 | /**
|
871 | * Represents an Analyzer in a {@link database.Database}.
|
872 | */
|
873 | export declare class Analyzer {
|
874 | protected _name: string;
|
875 | protected _db: Database;
|
876 | /**
|
877 | * @internal
|
878 | */
|
879 | constructor(db: Database, name: string);
|
880 | /**
|
881 | * @internal
|
882 | *
|
883 | * Indicates that this object represents an ArangoDB Analyzer.
|
884 | */
|
885 | get isArangoAnalyzer(): true;
|
886 | /**
|
887 | * Name of this Analyzer.
|
888 | *
|
889 | * See also { database.Database}.
|
890 | */
|
891 | get name(): string;
|
892 | /**
|
893 | * Checks whether the Analyzer exists.
|
894 | *
|
895 | * @example
|
896 | * ```js
|
897 | * const db = new Database();
|
898 | * const analyzer = db.analyzer("some-analyzer");
|
899 | * const result = await analyzer.exists();
|
900 | * // result indicates whether the Analyzer exists
|
901 | * ```
|
902 | */
|
903 | exists(): Promise<boolean>;
|
904 | /**
|
905 | * Retrieves the Analyzer definition for the Analyzer.
|
906 | *
|
907 | * @example
|
908 | * ```js
|
909 | * const db = new Database();
|
910 | * const analyzer = db.analyzer("some-analyzer");
|
911 | * const definition = await analyzer.get();
|
912 | * // definition contains the Analyzer definition
|
913 | * ```
|
914 | */
|
915 | get(): Promise<ArangoApiResponse<AnalyzerDescription>>;
|
916 | /**
|
917 | * Creates a new Analyzer with the given `options` and the instance's name.
|
918 | *
|
919 | * See also {@link database.Database#createAnalyzer}.
|
920 | *
|
921 | * @param options - Options for creating the Analyzer.
|
922 | *
|
923 | * @example
|
924 | * ```js
|
925 | * const db = new Database();
|
926 | * const analyzer = db.analyzer("potatoes");
|
927 | * await analyzer.create({ type: "identity" });
|
928 | * // the identity Analyzer "potatoes" now exists
|
929 | * ```
|
930 | */
|
931 | create<Options extends CreateAnalyzerOptions>(options: Options): Promise<Options extends CreateIdentityAnalyzerOptions ? IdentityAnalyzerDescription : Options extends CreateDelimiterAnalyzerOptions ? DelimiterAnalyzerDescription : Options extends CreateStemAnalyzerOptions ? StemAnalyzerDescription : Options extends CreateNormAnalyzerOptions ? NormAnalyzerDescription : Options extends CreateNgramAnalyzerOptions ? NgramAnalyzerDescription : Options extends CreateTextAnalyzerOptions ? TextAnalyzerDescription : Options extends CreateSegmentationAnalyzerOptions ? SegmentationAnalyzerDescription : Options extends CreateAqlAnalyzerOptions ? AqlAnalyzerDescription : Options extends CreatePipelineAnalyzerOptions ? PipelineAnalyzerDescription : Options extends CreateStopwordsAnalyzerOptions ? StopwordsAnalyzerDescription : Options extends CreateCollationAnalyzerOptions ? CollationAnalyzerDescription : Options extends CreateMinHashAnalyzerOptions ? MinHashAnalyzerDescription : Options extends CreateClassificationAnalyzerOptions ? ClassificationAnalyzerDescription : Options extends CreateNearestNeighborsAnalyzerOptions ? NearestNeighborsAnalyzerDescription : Options extends CreateGeoJsonAnalyzerOptions ? GeoJsonAnalyzerDescription : Options extends CreateGeoPointAnalyzerOptions ? GeoPointAnalyzerDescription : Options extends CreateGeoS2AnalyzerOptions ? GeoS2AnalyzerDescription : AnalyzerDescription>;
|
932 | /**
|
933 | * Deletes the Analyzer from the database.
|
934 | *
|
935 | * @param force - Whether the Analyzer should still be deleted even if it
|
936 | * is currently in use.
|
937 | *
|
938 | * @example
|
939 | * ```js
|
940 | * const db = new Database();
|
941 | * const analyzer = db.analyzer("some-analyzer");
|
942 | * await analyzer.drop();
|
943 | * // the Analyzer "some-analyzer" no longer exists
|
944 | * ```
|
945 | */
|
946 | drop(force?: boolean): Promise<ArangoApiResponse<{
|
947 | name: string;
|
948 | }>>;
|
949 | }
|
950 | //# sourceMappingURL=analyzer.d.ts.map |
\ | No newline at end of file |