Meilisearch PHP | Documentation

Indexes extends Endpoint
in package
Uses HandlesDocuments, HandlesSettings, HandlesTasks

Table of Contents

Constants

PATH  = '/indexes'

Properties

$apiKey  : string|null
$http  : Http
$tasks  : Tasks
$createdAt  : DateTime|null
$primaryKey  : string|null
$uid  : string|null
$updatedAt  : DateTime|null

Methods

__construct()  : mixed
addDocuments()  : mixed
addDocumentsCsv()  : mixed
addDocumentsCsvInBatches()  : mixed
addDocumentsInBatches()  : mixed
addDocumentsJson()  : mixed
addDocumentsNdjson()  : mixed
addDocumentsNdjsonInBatches()  : mixed
all()  : IndexesResults
allRaw()  : array<string|int, mixed>
cancelTasks()  : array<string|int, mixed>
create()  : array<string|int, mixed>
delete()  : array<string|int, mixed>
deleteAllDocuments()  : array<string|int, mixed>
deleteDocument()  : array<string|int, mixed>
deleteDocuments()  : array<string|int, mixed>
deleteTasks()  : array<string|int, mixed>
facetSearch()  : FacetSearchResult
fetchInfo()  : self
fetchPrimaryKey()  : string|null
fetchRawInfo()  : array<string|int, mixed>|null
getCreatedAt()  : DateTime|null
getDictionary()  : array<int, non-empty-string>
getDisplayedAttributes()  : array<int, non-empty-string>
getDistinctAttribute()  : non-empty-string|null
getDocument()  : mixed
getDocuments()  : DocumentsResults
getFaceting()  : array{maxValuesPerFacet: int, sortFacetValuesBy: array}
getFilterableAttributes()  : array<int, non-empty-string>
getNonSeparatorTokens()  : array<int, non-empty-string>
getPagination()  : array{maxTotalHits: positive-int}
getPrimaryKey()  : string|null
getRankingRules()  : array<int, non-empty-string>
getSearchableAttributes()  : array<int, non-empty-string>
getSeparatorTokens()  : array<string|int, mixed>
getSettings()  : array<string|int, mixed>
getSortableAttributes()  : array<int, non-empty-string>
getStopWords()  : array<int, non-empty-string>
getSynonyms()  : array<non-empty-string, array<int, non-empty-string>>
getTask()  : array<string|int, mixed>
getTasks()  : TasksResults
getTypoTolerance()  : array{enabled: bool, minWordSizeForTypos: array{oneTypo: int, twoTypos: int}, disableOnWords: list, disableOnAttributes: list}
getUid()  : string|null
getUpdatedAt()  : DateTime|null
parseDate()  : DateTime|null
rawSearch()  : array<string|int, mixed>
resetDictionary()  : array<string|int, mixed>
resetDisplayedAttributes()  : array<string|int, mixed>
resetDistinctAttribute()  : array<string|int, mixed>
resetFaceting()  : array<string|int, mixed>
resetFilterableAttributes()  : array<string|int, mixed>
resetNonSeparatorTokens()  : array<string|int, mixed>
resetPagination()  : array<string|int, mixed>
resetRankingRules()  : array<string|int, mixed>
resetSearchableAttributes()  : array<string|int, mixed>
resetSeparatorTokens()  : array<string|int, mixed>
resetSettings()  : array<string|int, mixed>
resetSortableAttributes()  : array<string|int, mixed>
resetStopWords()  : array<string|int, mixed>
resetSynonyms()  : array<string|int, mixed>
resetTypoTolerance()  : array<string|int, mixed>
search()  : SearchResult|array<string|int, mixed>
show()  : array<string|int, mixed>|null
stats()  : array<string|int, mixed>
swapIndexes()  : array<string|int, mixed>
update()  : array<string|int, mixed>
updateDictionary()  : array<string|int, mixed>
updateDisplayedAttributes()  : array<string|int, mixed>
updateDistinctAttribute()  : array<string|int, mixed>
updateDocuments()  : mixed
updateDocumentsCsv()  : mixed
updateDocumentsCsvInBatches()  : mixed
updateDocumentsInBatches()  : mixed
updateDocumentsJson()  : mixed
updateDocumentsNdjson()  : mixed
updateDocumentsNdjsonInBatches()  : mixed
updateFaceting()  : array<string|int, mixed>
updateFilterableAttributes()  : array<string|int, mixed>
updateNonSeparatorTokens()  : array<string|int, mixed>
updatePagination()  : array<string|int, mixed>
updateRankingRules()  : array<string|int, mixed>
updateSearchableAttributes()  : array<string|int, mixed>
updateSeparatorTokens()  : array<string|int, mixed>
updateSettings()  : array<string|int, mixed>
updateSortableAttributes()  : array<string|int, mixed>
updateStopWords()  : array<string|int, mixed>
updateSynonyms()  : array<string|int, mixed>
updateTypoTolerance()  : array<string|int, mixed>
waitForTask()  : array<string|int, mixed>
waitForTasks()  : array<string|int, mixed>
fill()  : $this
newInstance()  : self
assertValidDocumentId()  : void
batch()  : Generator
batchCsvString()  : Generator
batchNdjsonString()  : Generator

Constants

PATH

protected mixed PATH = '/indexes'

Properties

$createdAt

private DateTime|null $createdAt

$primaryKey

private string|null $primaryKey

$updatedAt

private DateTime|null $updatedAt

Methods

__construct()

public __construct(Http $http[, mixed $uid = null ][, mixed $primaryKey = null ][, mixed $createdAt = null ][, mixed $updatedAt = null ]) : mixed
Parameters
$http : Http
$uid : mixed = null
$primaryKey : mixed = null
$createdAt : mixed = null
$updatedAt : mixed = null

addDocuments()

public addDocuments(array<string|int, mixed> $documents[, string $primaryKey = null ]) : mixed
Parameters
$documents : array<string|int, mixed>
$primaryKey : string = null

addDocumentsCsv()

public addDocumentsCsv(string $documents[, string $primaryKey = null ][, string $delimiter = null ]) : mixed
Parameters
$documents : string
$primaryKey : string = null
$delimiter : string = null

addDocumentsCsvInBatches()

public addDocumentsCsvInBatches(string $documents[, int|null $batchSize = 1000 ][, string $primaryKey = null ][, string $delimiter = null ]) : mixed
Parameters
$documents : string
$batchSize : int|null = 1000
$primaryKey : string = null
$delimiter : string = null

addDocumentsInBatches()

public addDocumentsInBatches(array<string|int, mixed> $documents[, int|null $batchSize = 1000 ][, string $primaryKey = null ]) : mixed
Parameters
$documents : array<string|int, mixed>
$batchSize : int|null = 1000
$primaryKey : string = null

addDocumentsJson()

public addDocumentsJson(string $documents[, string $primaryKey = null ]) : mixed
Parameters
$documents : string
$primaryKey : string = null

addDocumentsNdjson()

public addDocumentsNdjson(string $documents[, string $primaryKey = null ]) : mixed
Parameters
$documents : string
$primaryKey : string = null

addDocumentsNdjsonInBatches()

public addDocumentsNdjsonInBatches(string $documents[, int|null $batchSize = 1000 ][, string $primaryKey = null ]) : mixed
Parameters
$documents : string
$batchSize : int|null = 1000
$primaryKey : string = null

allRaw()

public allRaw([array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
Parameters
$options : array<string|int, mixed> = []
Return values
array<string|int, mixed>

create()

public create(string $uid[, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
Parameters
$uid : string
$options : array<string|int, mixed> = []
Tags
throws
Exception|ApiException
Return values
array<string|int, mixed>

delete()

public delete() : array<string|int, mixed>
Return values
array<string|int, mixed>

deleteAllDocuments()

public deleteAllDocuments() : array<string|int, mixed>
Return values
array<string|int, mixed>

deleteDocument()

public deleteDocument(mixed $documentId) : array<string|int, mixed>
Parameters
$documentId : mixed
Return values
array<string|int, mixed>

deleteDocuments()

public deleteDocuments(array<string|int, mixed> $options) : array<string|int, mixed>
Parameters
$options : array<string|int, mixed>
Return values
array<string|int, mixed>

fetchInfo()

public fetchInfo() : self
Return values
self

fetchPrimaryKey()

public fetchPrimaryKey() : string|null
Return values
string|null

fetchRawInfo()

public fetchRawInfo() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

getCreatedAt()

public getCreatedAt() : DateTime|null
Return values
DateTime|null

getDictionary()

public getDictionary() : array<int, non-empty-string>
Return values
array<int, non-empty-string>

getDisplayedAttributes()

public getDisplayedAttributes() : array<int, non-empty-string>
Return values
array<int, non-empty-string>

getDistinctAttribute()

public getDistinctAttribute() : non-empty-string|null
Return values
non-empty-string|null

getDocument()

public getDocument(mixed $documentId[, array<string|int, mixed> $fields = null ]) : mixed
Parameters
$documentId : mixed
$fields : array<string|int, mixed> = null

getFaceting()

public getFaceting() : array{maxValuesPerFacet: int, sortFacetValuesBy: array}
Return values
array{maxValuesPerFacet: int, sortFacetValuesBy: array}

getFilterableAttributes()

public getFilterableAttributes() : array<int, non-empty-string>
Return values
array<int, non-empty-string>

getNonSeparatorTokens()

public getNonSeparatorTokens() : array<int, non-empty-string>
Return values
array<int, non-empty-string>

getPagination()

public getPagination() : array{maxTotalHits: positive-int}
Return values
array{maxTotalHits: positive-int}

getPrimaryKey()

public getPrimaryKey() : string|null
Return values
string|null

getRankingRules()

public getRankingRules() : array<int, non-empty-string>
Return values
array<int, non-empty-string>

getSearchableAttributes()

public getSearchableAttributes() : array<int, non-empty-string>
Return values
array<int, non-empty-string>

getSeparatorTokens()

public getSeparatorTokens() : array<string|int, mixed>
Return values
array<string|int, mixed>

getSettings()

public getSettings() : array<string|int, mixed>
Return values
array<string|int, mixed>

getSortableAttributes()

public getSortableAttributes() : array<int, non-empty-string>
Return values
array<int, non-empty-string>

getStopWords()

public getStopWords() : array<int, non-empty-string>
Return values
array<int, non-empty-string>

getSynonyms()

public getSynonyms() : array<non-empty-string, array<int, non-empty-string>>
Return values
array<non-empty-string, array<int, non-empty-string>>

getTask()

public getTask(mixed $uid) : array<string|int, mixed>
Parameters
$uid : mixed
Return values
array<string|int, mixed>

getTypoTolerance()

public getTypoTolerance() : array{enabled: bool, minWordSizeForTypos: array{oneTypo: int, twoTypos: int}, disableOnWords: list, disableOnAttributes: list}
Return values
array{enabled: bool, minWordSizeForTypos: array{oneTypo: int, twoTypos: int}, disableOnWords: list, disableOnAttributes: list}

getUid()

public getUid() : string|null
Return values
string|null

getUpdatedAt()

public getUpdatedAt() : DateTime|null
Return values
DateTime|null

parseDate()

public static parseDate(string|null $dateTime) : DateTime|null
Parameters
$dateTime : string|null
Tags
throws
Exception
Return values
DateTime|null

rawSearch()

public rawSearch(string|null $query[, array<string|int, mixed> $searchParams = [] ]) : array<string|int, mixed>
Parameters
$query : string|null
$searchParams : array<string|int, mixed> = []
Return values
array<string|int, mixed>

resetDictionary()

public resetDictionary() : array<string|int, mixed>
Return values
array<string|int, mixed>

resetDisplayedAttributes()

public resetDisplayedAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>

resetDistinctAttribute()

public resetDistinctAttribute() : array<string|int, mixed>
Return values
array<string|int, mixed>

resetFaceting()

public resetFaceting() : array<string|int, mixed>
Return values
array<string|int, mixed>

resetFilterableAttributes()

public resetFilterableAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>

resetNonSeparatorTokens()

public resetNonSeparatorTokens() : array<string|int, mixed>
Return values
array<string|int, mixed>

resetPagination()

public resetPagination() : array<string|int, mixed>
Return values
array<string|int, mixed>

resetRankingRules()

public resetRankingRules() : array<string|int, mixed>
Return values
array<string|int, mixed>

resetSearchableAttributes()

public resetSearchableAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>

resetSeparatorTokens()

public resetSeparatorTokens() : array<string|int, mixed>
Return values
array<string|int, mixed>

resetSettings()

public resetSettings() : array<string|int, mixed>
Return values
array<string|int, mixed>

resetSortableAttributes()

public resetSortableAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>

resetStopWords()

public resetStopWords() : array<string|int, mixed>
Return values
array<string|int, mixed>

resetSynonyms()

public resetSynonyms() : array<string|int, mixed>
Return values
array<string|int, mixed>

resetTypoTolerance()

public resetTypoTolerance() : array<string|int, mixed>
Return values
array<string|int, mixed>
public search(string|null $query[, array<string|int, mixed> $searchParams = [] ][, array<string|int, mixed> $options = [] ]) : SearchResult|array<string|int, mixed>
Parameters
$query : string|null
$searchParams : array<string|int, mixed> = []
$options : array<string|int, mixed> = []
Tags
phpstan-return

($options is array{raw: true|non-falsy-string|positive-int} ? array : SearchResult)

Return values
SearchResult|array<string|int, mixed>

show()

public show() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

stats()

public stats() : array<string|int, mixed>
Return values
array<string|int, mixed>

swapIndexes()

public swapIndexes(array<string|int, array{indexes: mixed}> $indexes) : array<string|int, mixed>
Parameters
$indexes : array<string|int, array{indexes: mixed}>
Return values
array<string|int, mixed>

update()

public update(mixed $body) : array<string|int, mixed>
Parameters
$body : mixed
Return values
array<string|int, mixed>

updateDictionary()

public updateDictionary(array<int, non-empty-string> $wordDictionary) : array<string|int, mixed>
Parameters
$wordDictionary : array<int, non-empty-string>
Return values
array<string|int, mixed>

updateDisplayedAttributes()

public updateDisplayedAttributes(array<int, non-empty-string> $displayedAttributes) : array<string|int, mixed>
Parameters
$displayedAttributes : array<int, non-empty-string>
Return values
array<string|int, mixed>

updateDistinctAttribute()

public updateDistinctAttribute(non-empty-string $distinctAttribute) : array<string|int, mixed>
Parameters
$distinctAttribute : non-empty-string
Return values
array<string|int, mixed>

updateDocuments()

public updateDocuments(array<string|int, mixed> $documents[, string $primaryKey = null ]) : mixed
Parameters
$documents : array<string|int, mixed>
$primaryKey : string = null

updateDocumentsCsv()

public updateDocumentsCsv(string $documents[, string $primaryKey = null ][, string $delimiter = null ]) : mixed
Parameters
$documents : string
$primaryKey : string = null
$delimiter : string = null

updateDocumentsCsvInBatches()

public updateDocumentsCsvInBatches(string $documents[, int|null $batchSize = 1000 ][, string $primaryKey = null ][, string $delimiter = null ]) : mixed
Parameters
$documents : string
$batchSize : int|null = 1000
$primaryKey : string = null
$delimiter : string = null

updateDocumentsInBatches()

public updateDocumentsInBatches(array<string|int, mixed> $documents[, int|null $batchSize = 1000 ][, string $primaryKey = null ]) : mixed
Parameters
$documents : array<string|int, mixed>
$batchSize : int|null = 1000
$primaryKey : string = null

updateDocumentsJson()

public updateDocumentsJson(string $documents[, string $primaryKey = null ]) : mixed
Parameters
$documents : string
$primaryKey : string = null

updateDocumentsNdjson()

public updateDocumentsNdjson(string $documents[, string $primaryKey = null ]) : mixed
Parameters
$documents : string
$primaryKey : string = null

updateDocumentsNdjsonInBatches()

public updateDocumentsNdjsonInBatches(string $documents[, int|null $batchSize = 1000 ][, string $primaryKey = null ]) : mixed
Parameters
$documents : string
$batchSize : int|null = 1000
$primaryKey : string = null

updateFaceting()

public updateFaceting(array{maxValuesPerFacet?: int, sortFacetValuesBy?: array$faceting) : array<string|int, mixed>
Parameters
$faceting : array{maxValuesPerFacet?: int, sortFacetValuesBy?: array}
Return values
array<string|int, mixed>

updateFilterableAttributes()

public updateFilterableAttributes(array<int, non-empty-string> $filterableAttributes) : array<string|int, mixed>
Parameters
$filterableAttributes : array<int, non-empty-string>
Return values
array<string|int, mixed>

updateNonSeparatorTokens()

public updateNonSeparatorTokens(array<int, non-empty-string> $nonSeparatorTokens) : array<string|int, mixed>
Parameters
$nonSeparatorTokens : array<int, non-empty-string>
Return values
array<string|int, mixed>

updatePagination()

public updatePagination(array{maxTotalHits: positive-int} $pagination) : array<string|int, mixed>
Parameters
$pagination : array{maxTotalHits: positive-int}
Return values
array<string|int, mixed>

updateRankingRules()

public updateRankingRules(array<int, non-empty-string> $rankingRules) : array<string|int, mixed>
Parameters
$rankingRules : array<int, non-empty-string>
Return values
array<string|int, mixed>

updateSearchableAttributes()

public updateSearchableAttributes(array<int, non-empty-string> $searchableAttributes) : array<string|int, mixed>
Parameters
$searchableAttributes : array<int, non-empty-string>
Return values
array<string|int, mixed>

updateSeparatorTokens()

public updateSeparatorTokens(array<int, non-empty-string> $separatorTokens) : array<string|int, mixed>
Parameters
$separatorTokens : array<int, non-empty-string>
Return values
array<string|int, mixed>

updateSettings()

public updateSettings(mixed $settings) : array<string|int, mixed>
Parameters
$settings : mixed
Return values
array<string|int, mixed>

updateSortableAttributes()

public updateSortableAttributes(array<int, non-empty-string> $sortableAttributes) : array<string|int, mixed>
Parameters
$sortableAttributes : array<int, non-empty-string>
Return values
array<string|int, mixed>

updateStopWords()

public updateStopWords(array<int, non-empty-string> $stopWords) : array<string|int, mixed>
Parameters
$stopWords : array<int, non-empty-string>
Return values
array<string|int, mixed>

updateSynonyms()

public updateSynonyms(array<non-empty-string, array<int, non-empty-string>> $synonyms) : array<string|int, mixed>
Parameters
$synonyms : array<non-empty-string, array<int, non-empty-string>>
Return values
array<string|int, mixed>

updateTypoTolerance()

public updateTypoTolerance(array{enabled: bool, minWordSizeForTypos: array{oneTypo: int, twoTypos: int}, disableOnWords: list, disableOnAttributes: list$typoTolerance) : array<string|int, mixed>
Parameters
$typoTolerance : array{enabled: bool, minWordSizeForTypos: array{oneTypo: int, twoTypos: int}, disableOnWords: list, disableOnAttributes: list}
Return values
array<string|int, mixed>

waitForTask()

public waitForTask(mixed $uid[, int $timeoutInMs = 5000 ][, int $intervalInMs = 50 ]) : array<string|int, mixed>
Parameters
$uid : mixed
$timeoutInMs : int = 5000
$intervalInMs : int = 50
Tags
throws
TimeOutException
Return values
array<string|int, mixed>

waitForTasks()

public waitForTasks(mixed $uids[, int $timeoutInMs = 5000 ][, int $intervalInMs = 50 ]) : array<string|int, mixed>
Parameters
$uids : mixed
$timeoutInMs : int = 5000
$intervalInMs : int = 50
Tags
throws
TimeOutException
Return values
array<string|int, mixed>

fill()

protected fill(array<string|int, mixed> $attributes) : $this
Parameters
$attributes : array<string|int, mixed>
Return values
$this

newInstance()

protected newInstance(array<string|int, mixed> $attributes) : self
Parameters
$attributes : array<string|int, mixed>
Return values
self

assertValidDocumentId()

private assertValidDocumentId(mixed $documentId) : void
Parameters
$documentId : mixed

batch()

private static batch(array<string|int, mixed> $documents, int $batchSize) : Generator
Parameters
$documents : array<string|int, mixed>
$batchSize : int
Return values
Generator

batchCsvString()

private static batchCsvString(string $documents, int $batchSize) : Generator
Parameters
$documents : string
$batchSize : int
Return values
Generator

batchNdjsonString()

private static batchNdjsonString(string $documents, int $batchSize) : Generator
Parameters
$documents : string
$batchSize : int
Return values
Generator

On this page

Search results