GeoIndex implements IndexDefinition
Read onlyYes
Geospatial index definition.
Two input shapes are supported:
- one field path (
['location']) holding either a[lat, lng]pair or a GeoJSON object (depending on$geoJson), - two field paths (
['lat', 'lng']) when latitude and longitude are stored as separate attributes.
Example:
$places->createIndex( new GeoIndex( fields : [ 'location' ] , geoJson : true ) ) ;
Tags
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>
- $geoJson : bool|null
- $inBackground : bool|null
- $name : string|null
Methods
- __construct() : mixed
- toArray() : array<string, mixed>
- Returns the request body for `POST /_api/index` corresponding to this index definition.
Properties
$fields
public
array<string|int, mixed>
$fields
$geoJson
public
bool|null
$geoJson
= null
$inBackground
public
bool|null
$inBackground
= null
$name
public
string|null
$name
= null
Methods
__construct()
public
__construct(array<int, string> $fields[, string|null $name = null ][, bool|null $geoJson = null ][, bool|null $inBackground = null ]) : mixed
Parameters
- $fields : array<int, string>
-
One field (point or GeoJSON object) or two fields ([latField, lngField]).
- $name : string|null = null
-
Optional human-readable index name.
- $geoJson : bool|null = null
-
Interpret the single field as a GeoJSON object instead of a
[lat, lng]pair. - $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>