Meilisearch PHP | Documentation

SearchQuery
in package

Table of Contents

Properties

$attributesToCrop  : array<int, non-empty-string>|null
$attributesToHighlight  : array<int, non-empty-string>|null
$attributesToRetrieve  : array<int, non-empty-string>|null
$attributesToSearchOn  : array<int, non-empty-string>|null
$cropLength  : positive-int|null
$cropMarker  : string|null
$distinct  : non-empty-string|null
$facets  : array<int, non-empty-string>|null
$federationOptions  : FederationOptions|null
$filter  : array<int, non-empty-string|array<int, non-empty-string>>|null
$highlightPostTag  : string|null
$highlightPreTag  : string|null
$hitsPerPage  : int|null
$hybrid  : HybridSearchOptions|null
$indexUid  : non-empty-string|null
$limit  : int|null
$locales  : array<int, non-empty-string>|null
$matchingStrategy  : "last"|"all"|"frequency"|null
$offset  : int|null
$page  : int|null
$q  : string|null
$rankingScoreThreshold  : float|null
$showMatchesPosition  : bool|null
$showRankingScore  : bool|null
$showRankingScoreDetails  : bool|null
$sort  : array<int, non-empty-string>|null
$vector  : array<int, float|array<int, float>>|null

Methods

setAttributesToCrop()  : $this
setAttributesToHighlight()  : $this
setAttributesToRetrieve()  : $this
setAttributesToSearchOn()  : $this
setCropLength()  : $this
setCropMarker()  : $this
setDistinct()  : $this
setFacets()  : $this
setFederationOptions()  : $this
This option is only available while doing a federated search.
setFilter()  : $this
setHighlightPostTag()  : $this
setHighlightPreTag()  : $this
setHitsPerPage()  : $this
setHybrid()  : $this
This is an EXPERIMENTAL feature, which may break without a major version.
setIndexUid()  : $this
setLimit()  : $this
setLocales()  : $this
setMatchingStrategy()  : $this
setOffset()  : $this
setPage()  : $this
setQuery()  : $this
setRankingScoreThreshold()  : $this
setShowMatchesPosition()  : $this
setShowRankingScore()  : $this
setShowRankingScoreDetails()  : $this
This is an EXPERIMENTAL feature, which may break without a major version.
setSort()  : $this
setVector()  : $this
This is an EXPERIMENTAL feature, which may break without a major version.
toArray()  : array<string|int, mixed>

Properties

$attributesToCrop

private array<int, non-empty-string>|null $attributesToCrop = null

$attributesToHighlight

private array<int, non-empty-string>|null $attributesToHighlight = null

$attributesToRetrieve

private array<int, non-empty-string>|null $attributesToRetrieve = null

$attributesToSearchOn

private array<int, non-empty-string>|null $attributesToSearchOn = null

$cropLength

private positive-int|null $cropLength = null

$distinct

private non-empty-string|null $distinct = null

$facets

private array<int, non-empty-string>|null $facets = null

$filter

private array<int, non-empty-string|array<int, non-empty-string>>|null $filter = null

$highlightPostTag

private string|null $highlightPostTag = null

$highlightPreTag

private string|null $highlightPreTag = null

$hitsPerPage

private int|null $hitsPerPage = null

non-negative-int|null

$indexUid

private non-empty-string|null $indexUid = null

$limit

private int|null $limit = null

non-negative-int|null

$locales

private array<int, non-empty-string>|null $locales = null

$matchingStrategy

private "last"|"all"|"frequency"|null $matchingStrategy = null

$offset

private int|null $offset = null

non-negative-int|null

$page

private int|null $page = null

non-negative-int|null

$rankingScoreThreshold

private float|null $rankingScoreThreshold = null

$showMatchesPosition

private bool|null $showMatchesPosition = null

$showRankingScore

private bool|null $showRankingScore = null

$showRankingScoreDetails

private bool|null $showRankingScoreDetails = null

$sort

private array<int, non-empty-string>|null $sort = null

$vector

private array<int, float|array<int, float>>|null $vector = null

Methods

setAttributesToCrop()

public setAttributesToCrop(array<string|int, mixed> $attributesToCrop) : $this
Parameters
$attributesToCrop : array<string|int, mixed>
Return values
$this

setAttributesToHighlight()

public setAttributesToHighlight(array<int, non-empty-string> $attributesToHighlight) : $this
Parameters
$attributesToHighlight : array<int, non-empty-string>
Return values
$this

setAttributesToRetrieve()

public setAttributesToRetrieve(array<string|int, mixed> $attributesToRetrieve) : $this
Parameters
$attributesToRetrieve : array<string|int, mixed>
Return values
$this

setAttributesToSearchOn()

public setAttributesToSearchOn(array<int, non-empty-string> $attributesToSearchOn) : $this
Parameters
$attributesToSearchOn : array<int, non-empty-string>
Return values
$this

setCropLength()

public setCropLength(positive-int|null $cropLength) : $this
Parameters
$cropLength : positive-int|null
Return values
$this

setCropMarker()

public setCropMarker(string $cropMarker) : $this
Parameters
$cropMarker : string
Return values
$this

setDistinct()

public setDistinct(non-empty-string|null $distinct) : $this
Parameters
$distinct : non-empty-string|null
Return values
$this

setFacets()

public setFacets(array<int, non-empty-string> $facets) : $this
Parameters
$facets : array<int, non-empty-string>
Return values
$this

setFederationOptions()

This option is only available while doing a federated search.

public setFederationOptions(FederationOptions $federationOptions) : $this

If used in another context an error will be returned by Meilisearch.

Parameters
$federationOptions : FederationOptions
Return values
$this

setFilter()

public setFilter(array<int, non-empty-string|array<int, non-empty-string>> $filter) : $this
Parameters
$filter : array<int, non-empty-string|array<int, non-empty-string>>
Return values
$this

setHighlightPostTag()

public setHighlightPostTag(string $highlightPostTag) : $this
Parameters
$highlightPostTag : string
Return values
$this

setHighlightPreTag()

public setHighlightPreTag(string $highlightPreTag) : $this
Parameters
$highlightPreTag : string
Return values
$this

setHitsPerPage()

public setHitsPerPage(int|null $hitsPerPage) : $this
Parameters
$hitsPerPage : int|null
Return values
$this

setHybrid()

This is an EXPERIMENTAL feature, which may break without a major version.

public setHybrid(HybridSearchOptions $hybridOptions) : $this

Set hybrid search options (new HybridSearchOptions()) ->setSemanticRatio(0.8) ->setEmbedder('manual');

Parameters
$hybridOptions : HybridSearchOptions
Return values
$this

setIndexUid()

public setIndexUid(string $uid) : $this
Parameters
$uid : string
Return values
$this

setLimit()

public setLimit(int|null $limit) : $this
Parameters
$limit : int|null
Return values
$this

setLocales()

public setLocales(array<int, non-empty-string> $locales) : $this
Parameters
$locales : array<int, non-empty-string>
Return values
$this

setMatchingStrategy()

public setMatchingStrategy("last"|"all"|"frequency" $matchingStrategy) : $this
Parameters
$matchingStrategy : "last"|"all"|"frequency"
Return values
$this

setOffset()

public setOffset(int|null $offset) : $this
Parameters
$offset : int|null
Return values
$this

setPage()

public setPage(int|null $page) : $this
Parameters
$page : int|null
Return values
$this

setQuery()

public setQuery(string $q) : $this
Parameters
$q : string
Return values
$this

setRankingScoreThreshold()

public setRankingScoreThreshold(float|null $rankingScoreThreshold) : $this
Parameters
$rankingScoreThreshold : float|null
Return values
$this

setShowMatchesPosition()

public setShowMatchesPosition(bool|null $showMatchesPosition) : $this
Parameters
$showMatchesPosition : bool|null
Return values
$this

setShowRankingScore()

public setShowRankingScore(bool|null $showRankingScore) : $this
Parameters
$showRankingScore : bool|null
Return values
$this

setShowRankingScoreDetails()

This is an EXPERIMENTAL feature, which may break without a major version.

public setShowRankingScoreDetails(bool $showRankingScoreDetails) : $this

It's available after Meilisearch v1.3. To enable it properly and use ranking scoring details its required to opt-in through the /experimental-features route.

More info: https://www.meilisearch.com/docs/reference/api/experimental-features

Parameters
$showRankingScoreDetails : bool

whether the feature is enabled or not

Return values
$this

setSort()

public setSort(array<string|int, mixed> $sort) : $this
Parameters
$sort : array<string|int, mixed>
Return values
$this

setVector()

This is an EXPERIMENTAL feature, which may break without a major version.

public setVector(array<int, float|array<int, float>> $vector) : $this

It's available from Meilisearch v1.3. To enable it properly and use vector store capabilities it's required to activate it through the /experimental-features route.

More info: https://www.meilisearch.com/docs/reference/api/experimental-features

Parameters
$vector : array<int, float|array<int, float>>

a multi-level array floats

Return values
$this

toArray()

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

        
On this page

Search results