Oihana PHP Arango

PersistentIndex implements IndexDefinition

Read onlyYes

Persistent (B-tree) index definition — the default index type for most use cases.

Replaces the legacy hash and skiplist types since ArangoDB 3.7 (both are aliases of persistent server-side; this client intentionally exposes only persistent).

Example:

$users->createIndex
(
    new PersistentIndex
    (
        fields : [ 'email' ] ,
        unique : true ,
        sparse : true ,
        name   : 'idx_email_unique' ,
    )
) ;
Tags
author

Marc Alcaraz (ekameleon)

since
1.0.0

Table of Contents

Interfaces

IndexDefinition
Common contract for every index definition consumable by {@see \oihana\arango\clients\collection\Collection::createIndex()}.

Properties

$cacheEnabled  : bool|null
$deduplicate  : bool|null
$estimates  : bool|null
$fields  : array<string|int, mixed>
$inBackground  : bool|null
$name  : string|null
$sparse  : bool
$storedValues  : array<string|int, mixed>|null
$unique  : bool

Methods

__construct()  : mixed
toArray()  : array<string, mixed>
Returns the request body for `POST /_api/index` corresponding to this index definition.

Properties

$storedValues

public array<string|int, mixed>|null $storedValues = null

Methods

__construct()

public __construct(array<int, string> $fields[, bool $unique = false ][, bool $sparse = false ][, string|null $name = null ][, bool|null $deduplicate = null ][, bool|null $estimates = null ][, bool|null $cacheEnabled = null ][, array<int, string>|null $storedValues = null ][, bool|null $inBackground = null ]) : mixed
Parameters
$fields : array<int, string>

Document attribute paths the index applies to (e.g. ['email'], ['firstName', 'lastName']).

$unique : bool = false

Enforce uniqueness across indexed tuples.

$sparse : bool = false

Skip documents missing every indexed attribute.

$name : string|null = null

Optional human-readable index name (also accepted by Collection::dropIndex()).

$deduplicate : bool|null = null

Silently deduplicate identical entries instead of raising on collision.

$estimates : bool|null = null

Maintain selectivity estimates for the query optimizer.

$cacheEnabled : bool|null = null

Keep an in-memory cache of frequently accessed entries.

$storedValues : array<int, string>|null = null

Additional attribute paths kept alongside the index entries so the query can be answered without touching the document.

$inBackground : bool|null = null

Build the index in the background, without blocking concurrent writes.

toArray()

Returns the request body for `POST /_api/index` corresponding to this index definition.

public toArray() : array<string, mixed>
Tags
inheritDoc
Return values
array<string, mixed>
On this page

Search results