This page gives an overview of the AQL functions supported by this query builder.
If you are missing a function please create an issue requesting it. In the meantime you can use the raw clause.
Functions always return expressions to be used in clauses or other expressions.
Example:
$qb = new QueryBuilder();
$qb->for('i', '1..100')
->filter('i', '<', $qb->max([0,1,10,25,50]))
->limit(10)
->sort('i', 'desc')
->return('i');
ArangoDB supports many more functions than those listed below. It is possible to use those by using rawExpressions.
The following functions are directly supported in FluentAql.
Description | AQL Function |
---|---|
analyzer($leftOperand, $comparisonOperand, $rightOperand, $analyzer) | ANALYZER(expr, analyzer) |
bm25($doc, $k, $b) | BM25(doc, k, b) |
boost($leftOperand, $comparisonOperand, $rightOperand, $analyzer) | BOOST(expr, boost) |
exists($path, $type) | EXISTS(path) |
inRange($path, $low, $high, $includeLow, $includeHigh) | IN_RANGE(path, low, high, includeLow, includeHigh) |
levenshteinMatch($path, $target, $distance, $transpositions, $maxTerms, $prefix) | LEVENSHTEIN_MATCH(path, target, distance, transpositions, maxTerms, prefix) |
like($path, $search) | LIKE(path, search) |
nGramMatch($path, $target, $threshold, $analyzer) | NGRAM_MATCH(path, target, threshold, analyzer) |
phrase(path, $phrasePart1, $skipTokens1, ... $phrasePartN, $skipTokensN, $analyzer) | PHRASE(path, [ phrasePart1, skipTokens1, ... phrasePartN, skipTokensN ], analyzer) |
tfidf($doc, $normalize) | TFIDF(doc, normalize) |
Description | AQL Function |
---|---|
append($array, $values, $unique) | APPEND(anyArray, values, unique) |
count($value) | COUNT(anyArray) |
countDistinct($value) | COUNT_DISTINCT(anyArray) |
first($value) | FIRST(anyArray) |
flatten($array, $depth) | FLATTEN(anyArray, depth) |
intersection($arrays) | INTERSECTION(array1, array2, ... arrayN) |
last($value) | LAST(anyArray) |
length($value) | LENGTH(anyArray) |
shift($array) | SHIFT(anyArray) |
union($arrays) | UNION(array1, array2, ... arrayN) |
unionDistinct($arrays) | UNION_DISTINCT(array1, array2, ... arrayN) |
unique($array) | UNIQUE(anyArray) |
Description | AQL Function |
---|---|
dateCompare($date1, $date2, $unitRangeStart, $unitRangeEnd) | DATE_COMPARE(date1, date2, unitRangeStart, unitRangeEnd) |
dateDay($date) | DATE_DAY(date) |
dateFormat($date, $format) | DATE_FORMAT(date, format) |
dateHour($date) | DATE_HOUR(date) |
dateIso8601($date) | DATE_ISO8601(date) |
dateLocalToUtc($date, $timezone, $zoneInfo) | DATE_LOCALTOUTC(date, timezone, zoneinfo) |
dateMonth($date) | DATE_MONTH(date) |
dateNow() | DATE_NOW() |
dateMillisecond($date) | DATE_MILLISECOND(date) |
dateMinute($date) | DATE_MINUTE(date) |
dateRound($date, $amount, $unit) | DATE_ROUND(date, amount, unit) |
dateSecond($date) | DATE_SECOND(date) |
dateTimestamp($date) | DATE_TIMESTAMP(date) |
dateTrunc($date, $unit) | DATE_TRUNC(date, unit) |
dateUtcToLocal($date, $timezone, $zoneInfo) | DATE_UTCTOLOCAL(date, timezone, zoneinfo) |
dateYear($date) | DATE_YEAR(date) |
Description | AQL Function |
---|---|
attributes($document, $removeInternal, $sort) | ATTRIBUTES(document, removeInternal, sort) |
keepAttributes($document, $attributes) | KEEP(document, attributeName1, attributeName2, ... attributeNameN) |
matches($document, $examples,$returnIndex) | MATCHES(document, examples, returnIndex) |
merge(...$documents) | MERGE(...documents) |
parseIdentifier($documentHandle) | PARSE_IDENTIFIER(documentHandle) |
unset($document, $attributes) | UNSET(document, ...attributeName) |
Description | AQL Function |
---|---|
distance($latitude1, $longitude1, $latitude2, $longitude2) | DISTANCE(latitude1, longitude1, latitude2, longitude2) |
geoArea($geoJson, $ellipsoid) | GEO_AREA(geoJson, ellipsoid) |
geoContains($geoJsonA, $geoJsonB) | GEO_AREA(GEO_CONTAINS(geoJsonA, geoJsonB) |
geoDistance($geoJsonA, $geoJsonB, $ellipsoid) | GEO_DISTANCE(geoJsonA, geoJsonB, ellipsoid) |
geoEquals($geoJsonA, $geoJsonB) | GEO_EQUALS(geoJsonA, geoJsonB) |
geoIntersects($geoJsonA, $geoJsonB) | GEO_INTERSECTS(geoJsonA, geoJsonB) |
geoInRange($geoJsonA, $geoJsonB, $low, $high, $includeLow, $includeHigh) | GEO_IN_RANGE(geoJsonA, geoJsonB, low, high, includeLow, includeHigh) |
geoLineString($points) | GEO_LINESTRING(points) |
geoMultiLineString($points) | GEO_MULTILINESTRING(points) |
geoMultiPoint($points) | GEO_MULTIPOINT(points) |
geoPoint($longitude, $latitude) | GEO_POINT(longitude, latitude) |
geoPolygon($points) | GEO_POLYGON(points) |
geoMultiPolygon($points) | GEO_MULTIPOLYGON(points) |
Description | AQL Function |
---|---|
assert($leftOperand, $comparisonOperand, $rightOperand, $analyzer) | ASSERT(expr, message) |
currentDatabase() | CURRENT_DATABASE() |
currentUser() | CURRENT_USER() |
document($collection, $id) | DOCUMENT(collection, id) |
document($collection, $id) | DOCUMENT(collection, id) |
firstDocument(...$arguments) | FIRST_DOCUMENT(alternative, ...) |
warn($leftOperand, $comparisonOperand, $rightOperand, $analyzer) | WARN(expr, message) |
Description | AQL Function |
---|---|
average($value) | AVERAGE(numArray |
avg($value) | AVG(numArray |
ceil($value) | CEIL(value) |
cosineSimilarity($x, $y) | COSINE_SIMILARITY(x, y) |
decayGauss($value, $origin, $scale, $offset, $decay) | DECAY_GAUSS(value, origin, scale, offset, decay) |
decayExp($value, $origin, $scale, $offset, $decay) | DECAY_EXP(value, origin, scale, offset, decay) |
decayLinear($value, $origin, $scale, $offset, $decay) | DECAY_LINEAR(value, origin, scale, offset, decay) |
floor($value) | FLOOR(value) |
l1Distance($x, $y) | L1_DISTANCE(x, y) |
l2Distance($x, $y) | L2_DISTANCE(x, y) |
max($value) | MAX(anyArray) |
min($value) | MIN(anyArray) |
product($array) | PRODUCT(numArray) |
rand() | RAND() |
range($start, $stop, $step) | RANGE(start, stop, step) |
round($value) | ROUND(value) |
sum($value) | SUM(numArray) |
Description | AQL Function |
---|---|
concat(...$arguments) | CONCAT(value1, value2, ... valueN) |
concatSeparator($separator, $values) | CONCAT_SEPARATOR(separator, value1, value2, ... valueN) |
findFirst($text, $search, $start, $end) | FIND_FIRST(text, search, start, end) |
findLast($text, $search, $start, $end) | FIND_Last(text, search, start, end) |
levenshteinDistance($value1, $value2) | LEVENSHTEIN_DISTANCE(value1, value2) |
lower($value) | LOWER(value) |
ltrim($value, $char) | LTRIM(value, char) |
regexMatches($text, $regex, $caseInsensitive) | REGEX_MATCHES(text, regex, caseInsensitive) |
regexReplace($text, $regex, $replacement, $caseInsensitive) | REGEX_REPLACE(text, search, replacement, caseInsensitive) |
regexSplit($text, $splitExpression, $caseInsensitive, $limit) | REGEX_SPLIT(text, splitExpression, caseInsensitive, limit) |
regexTest($text, $search, $caseInsensitive) | REGEX_TEST(text, search, caseInsensitive) |
rtrim($value, $char) | RTRIM(value, char) |
split($value, $separator, $limit) | SPLIT(value, separator, limit) |
substitute($text, $search, $replace, $limit) | SUBSTITUTE(value, search, replace, limit) |
substring($value, $offset, $length) | SUBSTRING(value, offset, length) |
tokens($input, $analyzer) | TOKENS(input, analyzer) |
trim($value, $type) | TRIM(value, type) |
upper($value) | UPPER(value) |
uuid() | UUID() |
Description | AQL Function |
---|---|
toArray($value) | TO_ARRAY(value) |
toBool($value) | TO_BOOL(value) |
tolist($value) | TO_LIST(value) |
toNumber($value) | TO_NUMBER(value) |
toString($value) | TO_STRING(value) |