Oihana PHP Arango

InvertedIndex implements IndexDefinition

Read onlyYes

Inverted index definition (ArangoDB 3.10+).

Modern replacement for the legacy FulltextIndex (deprecated since 3.10) and the building block of ArangoSearch views. Stores a token-level inverted lookup table on top of one or more document attributes.

The $fields argument accepts two shapes:

  • array<int, string> — list of attribute paths (analysed with the top-level $analyzer),
  • array<int, array<string, mixed>> — per-field configuration (each entry can override analyzer, features, includeAllFields, searchField, trackListPositions, …).

Example:

$products->createIndex
(
    new InvertedIndex
    (
        fields   : [ 'name' , 'description' ] ,
        analyzer : 'text_en' ,
        features : [ 'frequency' , 'position' , 'norm' ] ,
    )
) ;
Tags
see
https://docs.arangodb.com/stable/index-and-search/indexing/working-with-indexes/inverted-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

$analyzer  : string|null
$cache  : bool|null
$cleanupIntervalStep  : int|null
$commitIntervalMsec  : int|null
$consolidationIntervalMsec  : int|null
$features  : array<string|int, mixed>|null
$fields  : array<string|int, mixed>
$inBackground  : bool|null
$includeAllFields  : bool|null
$name  : string|null
$parallelism  : int|null
$primaryKeyCache  : bool|null
$primarySort  : array<string|int, mixed>|null
$searchField  : bool|null
$storedValues  : array<string|int, mixed>|null
$trackListPositions  : bool|null

Methods

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

Properties

$cleanupIntervalStep

public int|null $cleanupIntervalStep = null

$commitIntervalMsec

public int|null $commitIntervalMsec = null

$consolidationIntervalMsec

public int|null $consolidationIntervalMsec = null

$features

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

$primarySort

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

$storedValues

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

$trackListPositions

public bool|null $trackListPositions = null

Methods

__construct()

public __construct(array<int, string|array<string, mixed>> $fields[, string|null $name = null ][, string|null $analyzer = null ][, array<string, mixed>|null $primarySort = null ][, array<int, array<string, mixed>>|null $storedValues = null ][, array<int, string>|null $features = null ][, bool|null $includeAllFields = null ][, bool|null $searchField = null ][, bool|null $trackListPositions = null ][, bool|null $cache = null ][, bool|null $primaryKeyCache = null ][, int|null $parallelism = null ][, int|null $cleanupIntervalStep = null ][, int|null $commitIntervalMsec = null ][, int|null $consolidationIntervalMsec = null ][, bool|null $inBackground = null ]) : mixed
Parameters
$fields : array<int, string|array<string, mixed>>

List of attribute paths (string form) or per-field configurations (array form).

$name : string|null = null

Optional human-readable index name.

$analyzer : string|null = null

Top-level analyzer applied to every field that does not override it.

$primarySort : array<string, mixed>|null = null

Primary sort definition (typically { fields: [{field, direction}], compression }).

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

Stored value blocks (each block holds {fields, compression}).

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

Default per-field features (subset of frequency, position, offset, norm).

$includeAllFields : bool|null = null

When true, every document attribute is indexed.

$searchField : bool|null = null

When true, the index is search-only (no document lookup).

$trackListPositions : bool|null = null

Track the positions of each token within the source field.

$cache : bool|null = null

Keep an in-memory cache of frequently accessed entries.

$primaryKeyCache : bool|null = null

Keep a cache of primary-key values.

$parallelism : int|null = null

Number of threads that may build / query the index in parallel.

$cleanupIntervalStep : int|null = null

Frequency at which obsolete segments are cleaned up.

$commitIntervalMsec : int|null = null

Commit interval, in milliseconds.

$consolidationIntervalMsec : int|null = null

Consolidation interval, in milliseconds.

$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