HasFacetEdge uses trait:short
Builds the AQL filter fragment for an {@see Facet::EDGE} facet: it keeps documents linked (or, when negated, not linked) to a target vertex through an inbound edge traversal. The match is driven by {@see HasFacetSimpleConditions} — a configurable operator (`Facet::OP`, default `eq`) over one or more vertex fields (`AQL::FIELDS`, default `_key`). Composed via {@see FacetTrait}.
Matching several fields with op = like makes this facet a full-text-ish
lookup over a linked vocabulary (the former THESAURUS facet, now just an
EDGE configuration).
Tags
Table of Contents
Methods
- prepareFacetEdge() : string
- Prepares a facet condition with an edge definition.
- prepareSimpleConditions() : string
- Builds a simple existential facet expression.
- simpleLength() : string
- Wraps a set of OR-ed term groups into `LENGTH(FOR … FILTER [prefix &&] (…) RETURN …)`.
Methods
prepareFacetEdge()
Prepares a facet condition with an edge definition.
protected
prepareFacetEdge(string $key, mixed $value, array<string|int, mixed> &$binds, array<string|int, mixed> $facet, string $doc) : string
Parameters
- $key : string
- $value : mixed
- $binds : array<string|int, mixed>
- $facet : array<string|int, mixed>
- $doc : string
Tags
Return values
stringprepareSimpleConditions()
Builds a simple existential facet expression.
protected
prepareSimpleConditions(mixed $value, array<string|int, mixed> $facet, string $forSource, string|null $prefix, string $docRef, string $key, array<string|int, mixed> &$binds, string $return) : string
Positive values are matched inside a LENGTH(FOR … FILTER [prefix &&] (… OR …) …) > 0 clause; negated values are excluded with a twin
LENGTH(…) == 0 clause; both are AND-ed (and parenthesized) when present.
Parameters
- $value : mixed
-
The facet value: a scalar, a CSV string, a list, or an
{op, val}object. - $facet : array<string|int, mixed>
-
The facet definition (
Facet::OP,AQL::FIELDS). - $forSource : string
-
The compiled
FOR …source (traversal or collection). - $prefix : string|null
-
An extra condition AND-ed inside the FILTER (e.g. a join match), or null.
- $docRef : string
-
The related-document variable (e.g.
doc_location). - $key : string
-
The facet key, used to namespace the bind names.
- $binds : array<string|int, mixed>
-
The bind variables, populated by reference.
- $return : string
-
The compiled
RETURN …clause.
Tags
Return values
stringsimpleLength()
Wraps a set of OR-ed term groups into `LENGTH(FOR … FILTER [prefix &&] (…) RETURN …)`.
private
simpleLength(string $forSource, string|null $prefix, array<int, string> $groups, string $return) : string
Parameters
- $forSource : string
- $prefix : string|null
- $groups : array<int, string>
- $return : string