Oihana PHP Arango

HasFacetList

Builds the AQL filter fragment for a {@see Facet::LIST} facet. Kept as a thin alias over the {@see HasFacetIn} primitive (operator defaults to `any.in`), preserving the historical type name. Composed into the model via {@see FacetTrait}.

Tags
see
HasFacetIn::prepareFacetIn()

The membership primitive this delegates to.

FacetTrait::prepareFacets()

The dispatcher that invokes this builder.

Table of Contents

Methods

prepareFacetList()  : string
Prepares a list facet (array membership, `ANY IN` by default).

Methods

prepareFacetList()

Prepares a list facet (array membership, `ANY IN` by default).

protected prepareFacetList(string $key, mixed $value, array<string|int, mixed> &$binds, array<string|int, mixed> $facet, string $doc) : string

Accepts a CSV string, a list, or an {op, val} object selecting the operator per request (FilterArrayComparator).

Parameters
$key : string
$value : mixed
$binds : array<string|int, mixed>
$facet : array<string|int, mixed>
$doc : string
Tags
throws
BindException
example

Set the facetable definition in the model :

Arango::FACETS =>
[
    Prop::KEYWORDS =>
    [
        Facet::TYPE     => Facet::LIST ,
        Facet::PROPERTY => Prop::KEYWORDS
    ]
]

Use the facet (array membership tested against doc.keywords) :

?facets={"keywords":"key1,key2"}                        // ANY IN  : has key1 OR key2
?facets={"keywords":["key1","key2"]}                    // ANY IN  : array form, same result
?facets={"keywords":{"op":"all.in","val":"key1,key2"}}  // ALL IN  : has BOTH
?facets={"keywords":{"op":"none.in","val":["key1"]}}    // NONE IN : has NEITHER

Generated AQL (default any.in) :

TO_ARRAY([@keywords_0,@keywords_1]) ANY IN doc.keywords
Return values
string
On this page

Search results