Meilisearch PHP | Documentation

AbstractSearchQuery
in package

AbstractYes
Tags
phpstan-type

RawBaseSearchQuery array{ q?: string, filter?: string|list<non-empty-string|list>, locales?: list, attributesToRetrieve?: list, attributesToCrop?: list, cropLength?: positive-int, attributesToHighlight?: list, cropMarker?: string, highlightPreTag?: string, highlightPostTag?: string, facets?: list, showMatchesPosition?: bool, sort?: list, matchingStrategy?: 'last'|'all'|'frequency', offset?: non-negative-int, limit?: non-negative-int, hitsPerPage?: non-negative-int, page?: non-negative-int, vector?: non-empty-list<float|non-empty-list>, hybrid?: array{semanticRatio?: float, embedder?: non-empty-string}, attributesToSearchOn?: non-empty-list, showRankingScore?: bool, showRankingScoreDetails?: bool, showPerformanceDetails?: bool, rankingScoreThreshold?: float, distinct?: non-empty-string, retrieveVectors?: bool, media?: array }

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
$filter  : string|array<int, non-empty-string|array<int, non-empty-string>>|null
$highlightPostTag  : string|null
$highlightPreTag  : string|null
$hitsPerPage  : int|null
$hybrid  : HybridSearchOptions|null
$limit  : int|null
$locales  : array<int, non-empty-string>|null
$matchingStrategy  : "last"|"all"|"frequency"|null
$media  : array<string|int, mixed>|null
$offset  : int|null
$page  : int|null
$q  : string|null
$rankingScoreThreshold  : float|null
$retrieveVectors  : bool|null
$showMatchesPosition  : bool|null
$showPerformanceDetails  : 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()  : static
setAttributesToHighlight()  : static
setAttributesToRetrieve()  : static
setAttributesToSearchOn()  : static
setCropLength()  : static
setCropMarker()  : static
setDistinct()  : static
setFacets()  : static
setFilter()  : static
setHighlightPostTag()  : static
setHighlightPreTag()  : static
setHitsPerPage()  : static
setHybrid()  : static
This is an EXPERIMENTAL feature, which may break without a major version.
setLimit()  : static
setLocales()  : static
setMatchingStrategy()  : static
setMedia()  : static
setOffset()  : static
setPage()  : static
setQuery()  : static
setRankingScoreThreshold()  : static
setRetrieveVectors()  : static
setShowMatchesPosition()  : static
setShowPerformanceDetails()  : static
setShowRankingScore()  : static
setShowRankingScoreDetails()  : static
This is an EXPERIMENTAL feature, which may break without a major version.
setSort()  : static
setVector()  : static
This is an EXPERIMENTAL feature, which may break without a major version.
baseArray()  : RawBaseSearchQuery
hydrateFromArray()  : static

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

$filter

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

Methods

setAttributesToCrop()

public setAttributesToCrop(array<int, non-empty-string> $attributesToCrop) : static
Parameters
$attributesToCrop : array<int, non-empty-string>
Return values
static

setAttributesToHighlight()

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

setAttributesToRetrieve()

public setAttributesToRetrieve(array<int, non-empty-string> $attributesToRetrieve) : static
Parameters
$attributesToRetrieve : array<int, non-empty-string>
Return values
static

setAttributesToSearchOn()

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

setCropLength()

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

setCropMarker()

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

setDistinct()

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

setFacets()

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

setFilter()

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

setHighlightPostTag()

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

setHighlightPreTag()

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

setHitsPerPage()

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

setHybrid()

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

public setHybrid(HybridSearchOptions $hybridOptions) : static

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

Parameters
$hybridOptions : HybridSearchOptions
Return values
static

setLimit()

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

setLocales()

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

setMatchingStrategy()

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

setMedia()

public setMedia(array<string|int, mixed>|null $media) : static
Parameters
$media : array<string|int, mixed>|null
Return values
static

setOffset()

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

setPage()

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

setQuery()

public setQuery(string|null $q) : static
Parameters
$q : string|null
Return values
static

setRankingScoreThreshold()

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

setRetrieveVectors()

public setRetrieveVectors(bool|null $retrieveVectors) : static
Parameters
$retrieveVectors : bool|null
Return values
static

setShowMatchesPosition()

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

setShowPerformanceDetails()

public setShowPerformanceDetails(bool|null $showPerformanceDetails) : static
Parameters
$showPerformanceDetails : bool|null
Return values
static

setShowRankingScore()

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

setShowRankingScoreDetails()

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

public setShowRankingScoreDetails(bool $showRankingScoreDetails) : static

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
static

setSort()

public setSort(array<int, non-empty-string> $sort) : static
Parameters
$sort : array<int, non-empty-string>
Return values
static

setVector()

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

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

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
static

baseArray()

protected baseArray() : RawBaseSearchQuery
Return values
RawBaseSearchQuery

hydrateFromArray()

protected hydrateFromArray(RawBaseSearchQuery $data) : static
Parameters
$data : RawBaseSearchQuery
Return values
static
On this page

Search results