SearchResult
in package
implements
Countable, IteratorAggregate
Tags
Table of Contents
Interfaces
- Countable
- IteratorAggregate
Properties
- $estimatedTotalHits : int|null
- `estimatedTotalHits` is the attributes returned by the Meilisearch server and its value will not be modified by the methods in this class.
- $facetDistribution : array<string, mixed>
- $facetStats : array<string, mixed>
- $hits : array<int, array<string, mixed>>
- $hitsCount : int|null
- $hitsPerPage : int|null
- $limit : int|null
- $numberedPagination : bool
- $offset : int|null
- $page : int|null
- $processingTimeMs : int
- $query : string
- $raw : array<string, mixed>
- $semanticHitCount : int|null
- $totalHits : int|null
- $totalPages : int|null
Methods
- __construct() : mixed
- applyOptions() : self
- Return a new {@see SearchResult} instance.
- count() : int
- getEstimatedTotalHits() : int
- getFacetDistribution() : array<string, mixed>
- getFacetStats() : array<string, mixed>
- getHit() : mixed
- getHits() : array<int, array<string|int, mixed>>
- getHitsCount() : int
- getHitsPerPage() : int|null
- getIterator() : ArrayIterator
- getLimit() : int
- getOffset() : int
- getPage() : int|null
- getProcessingTimeMs() : int
- getQuery() : string
- getRaw() : array<string, mixed>
- Return the original search result.
- getSemanticHitCount() : int
- getTotalHits() : int|null
- getTotalPages() : int|null
- toArray() : array<string|int, mixed>
- toJSON() : string
- transformFacetDistribution() : self
- transformHits() : self
Properties
$estimatedTotalHits
`estimatedTotalHits` is the attributes returned by the Meilisearch server and its value will not be modified by the methods in this class.
private
int|null
$estimatedTotalHits
Please, use hitsCount
if you want to know the real size of the hits
array at any time.
$facetDistribution
private
array<string, mixed>
$facetDistribution
$facetStats
private
array<string, mixed>
$facetStats
$hits
private
array<int, array<string, mixed>>
$hits
$hitsCount
private
int|null
$hitsCount
$hitsPerPage
private
int|null
$hitsPerPage
$limit
private
int|null
$limit
$numberedPagination
private
bool
$numberedPagination
$offset
private
int|null
$offset
$page
private
int|null
$page
$processingTimeMs
private
int
$processingTimeMs
$query
private
string
$query
$raw
private
array<string, mixed>
$raw
$semanticHitCount
private
int|null
$semanticHitCount
$totalHits
private
int|null
$totalHits
$totalPages
private
int|null
$totalPages
Methods
__construct()
public
__construct(array<string|int, mixed> $body) : mixed
Parameters
- $body : array<string|int, mixed>
applyOptions()
Return a new {@see SearchResult} instance.
public
applyOptions(mixed $options) : self
The $options parameter is an array, and the following keys are accepted:
- transformFacetDistribution (callable)
- transformHits (callable)
The method does NOT trigger a new search.
Parameters
- $options : mixed
Return values
selfcount()
public
count() : int
Return values
intgetEstimatedTotalHits()
public
getEstimatedTotalHits() : int
Return values
intgetFacetDistribution()
public
getFacetDistribution() : array<string, mixed>
Return values
array<string, mixed>getFacetStats()
public
getFacetStats() : array<string, mixed>
Return values
array<string, mixed>getHit()
public
getHit(int $key[, mixed $default = null ]) : mixed
Parameters
- $key : int
- $default : mixed = null
getHits()
public
getHits() : array<int, array<string|int, mixed>>
Return values
array<int, array<string|int, mixed>>getHitsCount()
public
getHitsCount() : int
Return values
intgetHitsPerPage()
public
getHitsPerPage() : int|null
Return values
int|nullgetIterator()
public
getIterator() : ArrayIterator
Return values
ArrayIteratorgetLimit()
public
getLimit() : int
Return values
intgetOffset()
public
getOffset() : int
Return values
intgetPage()
public
getPage() : int|null
Return values
int|nullgetProcessingTimeMs()
public
getProcessingTimeMs() : int
Return values
intgetQuery()
public
getQuery() : string
Return values
stringgetRaw()
Return the original search result.
public
getRaw() : array<string, mixed>
Return values
array<string, mixed>getSemanticHitCount()
public
getSemanticHitCount() : int
Return values
intgetTotalHits()
public
getTotalHits() : int|null
Return values
int|nullgetTotalPages()
public
getTotalPages() : int|null
Return values
int|nulltoArray()
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>toJSON()
public
toJSON() : string
Return values
stringtransformFacetDistribution()
public
transformFacetDistribution(callable $callback) : self
Parameters
- $callback : callable
Return values
selftransformHits()
public
transformHits(callable $callback) : self
Parameters
- $callback : callable