Oihana PHP Arango

VectorIndex implements IndexDefinition

Read onlyYes

Vector index definition (ArangoDB 3.13+, Faiss-backed).

Indexes embedding vectors so that approximate nearest-neighbour searches can be answered efficiently via the AQL APPROX_NEAR_* family of functions.

The $params array is forwarded verbatim to the server and typically carries the Faiss configuration:

  • dimensions (int, required): vector size,
  • metric (string, required): "l2" or "cosine",
  • nLists (int, required): number of inverted lists at training time,
  • defaultNProbe (int, optional),
  • factory (string, optional): Faiss factory string for advanced use.

Example:

$docs->createIndex
(
    new VectorIndex
    (
        fields : [ 'embedding' ] ,
        params :
        [
            'dimensions' => 768 ,
            'metric'     => 'cosine' ,
            'nLists'     => 100 ,
        ] ,
    )
) ;
Tags
see
https://docs.arangodb.com/stable/index-and-search/indexing/working-with-indexes/vector-indexes/
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

$fields  : array<string|int, mixed>
$inBackground  : bool|null
$name  : string|null
$parallelism  : int|null
$params  : array<string|int, mixed>
$storedValues  : array<string|int, mixed>|null

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, array<string, mixed> $params[, int|null $parallelism = null ][, string|null $name = null ][, array<int, string>|null $storedValues = null ][, bool|null $inBackground = null ]) : mixed
Parameters
$fields : array<int, string>

Document attribute paths holding the vector (typically a single field).

$params : array<string, mixed>

Faiss configuration (see class doc).

$parallelism : int|null = null

Parallelism level — number of threads that may build / query the index in parallel.

$name : string|null = null

Optional human-readable index name.

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

Additional attribute paths kept alongside the index entries.

$inBackground : bool|null = null

Build the index in the background.

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