Analyzer API
These functions implement the HTTP API for manipulating Analyzers.
Note: Analyzers were introduced in ArangoDB 3.5 and are not supported by earlier versions of ArangoDB.
analyzer.exists
async analyzer.exists(): boolean
Checks whether the Analyzer exists.
Examples
const db = new Database();
const analyzer = db.analyzer("some-analyzer");
const result = await analyzer.exists();
// result indicates whether the Analyzer exists
analyzer.get
async analyzer.get(): Object
Retrieves the Analyzer definition for the Analyzer.
Examples
const db = new Database();
const analyzer = db.analyzer("some-analyzer");
const definition = await analyzer.get();
// definition contains the Analyzer definition
analyzer.create
async analyzer.create([options]): Object
Creates an Analyzer with the given options, then returns the new Analyzer definition.
Arguments
-
options:
Object(optional)An object with the following properties:
-
features:
string(optional)The features to enable for this Analyzer.
-
type:
stringThe type of Analyzer to create. Can be
"identity","delimiter","stem","norm","ngram"or"text". -
properties:
anyAdditional properties for the given Analyzer type.
If the type is
"identity", the properties are optional or can beundefinedornull.If the type is
"delimiter", the properties must be an object with the following property:-
delimiter:
stringDelimiter to use to split text into tokens as specified in RFC 4180, without starting new records on newlines.
If the type is
"stem", the properties must be an object with the following property:-
locale:
stringText locale. Format:
language[_COUNTRY][.encoding][@variant].
If the type is
"norm", the properties must be an object with the following properties:-
locale:
stringText locale. Format:
language[_COUNTRY][.encoding][@variant]. -
case:
string(Default:"lower")Case conversion. Can be
"lower","none"or"upper". -
accent:
boolean(Default:false)Preserve accent in returned words.
If the type is
"ngram", the properties must be an object with the following properties:-
max:
numberMaximum n-gram length.
-
min:
numberMinimum n-gram length.
-
preserveOriginal:
booleanOutput the original value as well.
If the type is
"text", the properties must be an object with the following properties:-
locale:
stringText locale. Format:
language[_COUNTRY][.encoding][@variant]. -
case:
string(Default:"lower")Case conversion. Can be
"lower","none"or"upper". -
stopwords:
Array<string>(optional)Words to omit from result. Defaults to the words loaded from the file at stopwordsPath.
-
stopwordsPath:
string(optional)Path with a
languagesub-directory containing files with words to omit.Defaults to the path specified in the server-side environment variable
IRESEARCH_TEXT_STOPWORD_PATHor the current working directory of the ArangoDB process. -
accent:
boolean(Default:false)Preserve accent in returned words.
-
stemming:
boolean(Default:true)Apply stemming on returned words.
-
-
Examples
const db = new Database();
const analyzer = db.analyzer("potatoes");
await analyzer.create({ type: "identity" });
// the identity analyzer "potatoes" now exists
analyzer.drop
async analyzer.drop(): Object
Deletes the Analyzer from the database, then returns an object with the name of the Analyzer that was dropped.
Examples
const db = new Database();
const analyzer = db.analyzer("some-analyzer");
await analyzer.drop();
// the Analyzer "some-analyzer" no longer exists