Oihana PHP Arango

analyzer.php

Table of Contents

Functions

analyzer()  : string
Set the Analyzer for a search expression.

Functions

analyzer()

Set the Analyzer for a search expression.

analyzer(string $expr, string $analyzer) : string

Wraps the ArangoDB AQL function ANALYZER(expr, analyzer), which sets the Analyzer used to evaluate the wrapped search expression and all the nested functions that accept an Analyzer argument (so it does not have to be repeated). A nested function passing its own Analyzer takes precedence. Only applicable to queries against arangosearch Views — with search-alias Views and inverted indexes the Analyzer is inferred from the index definition.

The TOKENS() function is an exception: it always requires its own Analyzer argument, even when wrapped, because it is a regular string function.

Example AQL usage:

ANALYZER(PHRASE(doc.text, "foo") OR PHRASE(doc.text, "bar"), "text_en")
Parameters
$expr : string

Any valid search expression (kept raw).

$analyzer : string

Name of the Analyzer (emitted as a quoted string literal).

Tags
example
use function oihana\arango\db\functions\search\analyzer;
use function oihana\arango\db\functions\search\phrase;

$expr = analyzer( phrase( 'doc.text' , 'quick fox' ) , 'text_en' ) ;
// 'ANALYZER(PHRASE(doc.text,"quick fox"),"text_en")'
see
https://docs.arangodb.com/stable/aql/functions/arangosearch/#analyzer
boost()
since
1.2.0
author

Marc Alcaraz

Return values
string

The formatted AQL expression.

On this page

Search results