Oihana PHP Arango

exists.php

Table of Contents

Functions

exists()  : string
Match documents where an attribute is present (optionally of a given type).

Functions

exists()

Match documents where an attribute is present (optionally of a given type).

exists(string $path[, string|null $type = null ][, string|null $analyzer = null ]) : string

Wraps the ArangoDB AQL function EXISTS(path[, type[, analyzer]]):

  • exists('doc.text') — the attribute is present;
  • exists('doc.text', 'string') — present and of the given data type ("null", "bool"/"boolean", "numeric", "type", "string", "analyzer", "nested");
  • exists('doc.text', analyzer: 'text_en') — present and indexed by the given Analyzer; the "analyzer" type literal is filled in automatically.

With arangosearch Views, EXISTS() only matches values if the storeValues link property is set to "id" (default "none").

Example AQL usage:

EXISTS(doc.text)
EXISTS(doc.text, "string")
EXISTS(doc.text, "analyzer", "text_en")
Parameters
$path : string

Attribute path expression to test (kept raw).

$type : string|null = null

Optional data type to test for (emitted as a quoted string literal). Defaults to "analyzer" when $analyzer is provided.

$analyzer : string|null = null

Optional Analyzer name (emitted as a quoted string literal).

Tags
example
use function oihana\arango\db\functions\search\exists;

echo exists( 'doc.text' ) ;                       // 'EXISTS(doc.text)'
echo exists( 'doc.text' , 'string' ) ;            // 'EXISTS(doc.text,"string")'
echo exists( 'doc.text' , analyzer: 'text_en' ) ; // 'EXISTS(doc.text,"analyzer","text_en")'
see
https://docs.arangodb.com/stable/aql/functions/arangosearch/#exists
since
1.2.0
author

Marc Alcaraz

Return values
string

The formatted AQL expression.

On this page

Search results