InvertedIndex
extends Index
in package
Inverted index representation
Tags
Table of Contents
Properties
- $collection : Collection
- Collection where the index belongs to
- $defaultOptions : array<string|int, mixed>
- Default options for inverted index
- $fields : array<string|int, mixed>
- Fields of index
- $id : string
- Index ID.
- $indexTypes : array<string|int, mixed>
- Valid indexes types
- $isNew : bool
- If the index is a new one or a representation of an existing index
- $name : string
- Index name.
- $sparse : bool
- Sparse
- $type : string
- Index type
- $unique : bool
- Unique constraint
Methods
- __construct() : mixed
- InvertedIndex constructor
- __toString() : mixed
- String representation of index
- getCollection() : Collection|null
- Returns the collection where index belong to
- getCreateData() : array<string|int, mixed>
- Return data for create index on server
- getFields() : array<string|int, mixed>
- Returns index fields
- getId() : string
- Index Id
- getName() : string
- Returns index name
- getType() : string
- Returns index type
- isNew() : bool
- If the index is a new one
- isSparse() : bool
- If the index is sparse
- isUnique() : bool
- If index has 'unique' constraint
- jsonSerialize() : mixed
- setCollection() : void
- Set the collection where the index belongs to
- toArray() : array<string|int, mixed>
- Returns an array representation of entity
Properties
$collection
Collection where the index belongs to
protected
Collection
$collection
$defaultOptions
Default options for inverted index
protected
array<string|int, mixed>
$defaultOptions
= [
'unique' => true,
'sparse' => true,
'analyzer' => "identity",
'inBackground' => true,
// Keep the collection available for writes during the index creation
'parallelism' => 2,
]
$fields
Fields of index
protected
array<string|int, mixed>
$fields
$id
Index ID.
protected
string
$id
$indexTypes
Valid indexes types
protected
static array<string|int, mixed>
$indexTypes
= ['fulltext', 'general', 'geo', 'hash', 'persistent', 'skiplist', 'ttl', 'primary', 'edge', 'inverted']
$isNew
If the index is a new one or a representation of an existing index
protected
bool
$isNew
$name
Index name.
protected
string
$name
$sparse
Sparse
protected
bool
$sparse
$type
Index type
protected
string
$type
$unique
Unique constraint
protected
bool
$unique
Methods
__construct()
InvertedIndex constructor
public
__construct(array<string|int, mixed> $fields[, array<string|int, mixed> $attributes = [] ]) : mixed
Parameters
- $fields : array<string|int, mixed>
-
Fields for which the index applies to
- $attributes : array<string|int, mixed> = []
-
Index $attributes
Tags
__toString()
String representation of index
public
__toString() : mixed
getCollection()
Returns the collection where index belong to
public
getCollection() : Collection|null
Return values
Collection|null —A collection object or null if the index was not set to an collection yet
getCreateData()
Return data for create index on server
public
getCreateData() : array<string|int, mixed>
Return values
array<string|int, mixed>getFields()
Returns index fields
public
getFields() : array<string|int, mixed>
Return values
array<string|int, mixed>getId()
Index Id
public
getId() : string
Return values
stringgetName()
Returns index name
public
getName() : string
Return values
stringgetType()
Returns index type
public
getType() : string
Return values
stringisNew()
If the index is a new one
public
isNew() : bool
Tags
Return values
bool —True if is a new object. False otherwise.
isSparse()
If the index is sparse
public
isSparse() : bool
Return values
boolisUnique()
If index has 'unique' constraint
public
isUnique() : bool
Return values
booljsonSerialize()
public
jsonSerialize() : mixed
Tags
setCollection()
Set the collection where the index belongs to
public
setCollection(Collection $collection) : void
Parameters
- $collection : Collection
toArray()
Returns an array representation of entity
public
toArray() : array<string|int, mixed>