ArangoDB v3.13 is under development and not released yet. This documentation is not final and potentially incomplete.
The @arangodb/analyzers
module of the JavaScript API
The analyzers module provides a JavaScript interface for managing ArangoSearch Analyzers
The JavaScript API can be accessed via the @arangodb/analyzers
module from
both server-side and client-side code (arangosh, Foxx):
var analyzers = require("@arangodb/analyzers");
See Analyzers for general information and details about the attributes.
Analyzer Module Methods
Create an Analyzer
var analyzer = analyzers.save(<name>, <type>[, <properties>[, <features>]])
Create a new Analyzer with custom configuration in the current database.
- name (string): name for identifying the Analyzer later
- type (string): the kind of Analyzer to create
- properties (object, optional): settings specific to the chosen type. Most types require at least one property, so this may not be optional
- features (array, optional): array of strings with names of the features to enable
- returns analyzer (object): Analyzer object, also if an Analyzer with the same settings exists already. An error is raised if the settings mismatch or if they are invalid
var analyzers = require("@arangodb/analyzers");
analyzers.save("csv", "delimiter", { "delimiter": "," }, ["frequency", "norm", "position"]);
Get an Analyzer
var analyzer = analyzers.analyzer(<name>)
Get an Analyzer by the name, stored in the current database. The name can be
prefixed with _system::
to access Analyzers stored in the _system
database.
- name (string): name of the Analyzer to find
- returns analyzer (object|null): Analyzer object if found, else
null
var analyzers = require("@arangodb/analyzers");
analyzers.analyzer("text_en");
List all Analyzers
var analyzerArray = analyzers.toArray()
List all Analyzers available in the current database.
- returns analyzerArray (array): array of Analyzer objects
var analyzers = require("@arangodb/analyzers");
analyzers.toArray();
Remove an Analyzer
analyzers.remove(<name> [, <force>])
Delete an Analyzer from the current database.
- name (string): name of the Analyzer to remove
- force (bool, optional): remove Analyzer even if in use by a View.
Default:
false
- returns nothing: no return value on success, otherwise an error is raised
var analyzers = require("@arangodb/analyzers");
analyzers.remove("csv");
Analyzer Object Methods
Individual Analyzer objects expose getter accessors for the aforementioned definition attributes (see Create an Analyzer).
Get Analyzer Name
var name = analyzer.name()
- returns name (string): name of the Analyzer
var analyzers = require("@arangodb/analyzers");
analyzers.analyzer("text_en").name();
Get Analyzer Type
var type = analyzer.type()
- returns type (string): type of the Analyzer
var analyzers = require("@arangodb/analyzers");
analyzers.analyzer("text_en").type();
Get Analyzer Properties
var properties = analyzer.properties()
- returns properties (object): type-dependent properties of the Analyzer
var analyzers = require("@arangodb/analyzers");
analyzers.analyzer("text_en").properties();
Get Analyzer Features
var features = analyzer.features()
- returns features (array): array of strings with the features of the Analyzer
var analyzers = require("@arangodb/analyzers");
analyzers.analyzer("text_en").features();