Represents an Analyzer in a databases.Database.

Accessors

Methods

Accessors

Methods

  • Creates a new Analyzer with the given options and the instance's name.

    See also databases.Database#createAnalyzer.

    Type Parameters

    Parameters

    • options: Options

      Options for creating the Analyzer.

    Returns Promise<Options extends {
            features?: AnalyzerFeature[];
            properties?: Record<string, never>;
            type: "identity";
        }
        ? IdentityAnalyzerDescription
        : Options extends CreateDelimiterAnalyzerOptions
            ? DelimiterAnalyzerDescription
            : Options extends {
                    features?: AnalyzerFeature[];
                    properties: {
                        locale: string;
                    };
                    type: "stem";
                }
                ? StemAnalyzerDescription
                : Options extends {
                        features?: AnalyzerFeature[];
                        properties: {
                            accent?: boolean;
                            case?: CaseConversion;
                            locale: string;
                        };
                        type: "norm";
                    }
                    ? NormAnalyzerDescription
                    : Options extends {
                            features?: AnalyzerFeature[];
                            properties: {
                                max: number;
                                min: number;
                                preserveOriginal: boolean;
                            };
                            type: "ngram";
                        }
                        ? NgramAnalyzerDescription
                        : Options extends {
                                features?: AnalyzerFeature[];
                                properties: {
                                    accent?: boolean;
                                    case?: CaseConversion;
                                    edgeNgram?: {
                                        max?: ...;
                                        min?: ...;
                                        preserveOriginal?: ...;
                                    };
                                    locale: string;
                                    stemming?: boolean;
                                    stopwords?: (...)[];
                                    stopwordsPath?: string;
                                };
                                type: "text";
                            }
                            ? TextAnalyzerDescription
                            : Options extends {
                                    features?: (...)[];
                                    properties: {
                                        break?: (...) | (...);
                                        case?: (...) | (...);
                                    };
                                    type: "segmentation";
                                }
                                ? SegmentationAnalyzerDescription
                                : Options extends {
                                        features?: (...) | (...);
                                        properties: {
                                            batchSize?: ...;
                                            collapsePositions?: ...;
                                            keepNull?: ...;
                                            memoryLimit?: ...;
                                            queryString: ...;
                                            returnType?: ...;
                                        };
                                        type: "aql";
                                    }
                                    ? AqlAnalyzerDescription
                                    : Options extends {
                                            features?: ...;
                                            properties: ...;
                                            type: ...;
                                        }
                                        ? PipelineAnalyzerDescription
                                        : (...) extends (...)
                                            ? (...)
                                            : (...)>

    Example

    const db = new Database();
    const analyzer = db.analyzer("potatoes");
    await analyzer.create({ type: "identity" });
    // the identity Analyzer "potatoes" now exists
  • Deletes the Analyzer from the database.

    Parameters

    • force: boolean = false

      Whether the Analyzer should still be deleted even if it is currently in use.

    Returns Promise<ArangoApiResponse<{
        name: string;
    }>>

    Example

    const db = new Database();
    const analyzer = db.analyzer("some-analyzer");
    await analyzer.drop();
    // the Analyzer "some-analyzer" no longer exists
  • Checks whether the Analyzer exists.

    Returns Promise<boolean>

    Example

    const db = new Database();
    const analyzer = db.analyzer("some-analyzer");
    const result = await analyzer.exists();
    // result indicates whether the Analyzer exists