Bånder

QueryBuilder
in package

Table of Contents

Constants

GEO_FILTER_UNITS  = ['m', 'km', 'mi', 'ft']

Properties

$geoFilters  : array<string|int, mixed>
$highlight  : string|null
$language  : string|null
$numericFilters  : array<string|int, mixed>
$offset  : int|null
$options  : array<string|int, mixed>
$pageSize  : int|null
$payload  : string|null
$query  : string
$return  : string|null
$scorer  : string|null
$sortByField  : string|null
$sortOrder  : string
$summarize  : string|null
$tagFilters  : array<string|int, mixed>
$indexName  : string
$redis  : Redis

Methods

__construct()  : mixed
geoFilter()  : self
Add a geo-spatial filter.
highlight()  : self
Add highlighting to specific fields.
limit()  : self
Set result limits for pagination.
noContent()  : self
noStopWords()  : self
numericFilter()  : self
Add a numeric range filter.
query()  : self
Set the query string for full-text search.
returnFields()  : self
Add fields to return in the result.
search()  : SearchResult
Execute the query.
sortBy()  : self
Add sorting.
summarize()  : self
Add summarization to specific fields.
tagFilter()  : self
Add a tag filter for exact matches.
withScores()  : self
Add RedisSearch-specific directives.
buildSearchCommand()  : array<string|int, mixed>
Build the Redis command arguments dynamically.

Constants

GEO_FILTER_UNITS

private mixed GEO_FILTER_UNITS = ['m', 'km', 'mi', 'ft']

Properties

$geoFilters

protected array<string|int, mixed> $geoFilters = []

$numericFilters

protected array<string|int, mixed> $numericFilters = []

$options

protected array<string|int, mixed> $options = []

$tagFilters

protected array<string|int, mixed> $tagFilters = []

Methods

__construct()

public __construct(Redis $redis, string $indexName) : mixed
Parameters
$redis : Redis
$indexName : string

geoFilter()

Add a geo-spatial filter.

public geoFilter(string $field, float $lon, float $lat, float $radius[, string $unit = 'km' ]) : self
Parameters
$field : string
$lon : float
$lat : float
$radius : float
$unit : string = 'km'
Return values
self

highlight()

Add highlighting to specific fields.

public highlight(array<string|int, mixed> $fields[, string $openTag = '<strong>' ][, string $closeTag = '</strong>' ]) : self
Parameters
$fields : array<string|int, mixed>
$openTag : string = '<strong>'
$closeTag : string = '</strong>'
Return values
self

limit()

Set result limits for pagination.

public limit(int $offset[, int $pageSize = 10 ]) : self
Parameters
$offset : int
$pageSize : int = 10
Return values
self

noContent()

public noContent() : self
Return values
self

noStopWords()

public noStopWords() : self
Return values
self

numericFilter()

Add a numeric range filter.

public numericFilter(string $field, float|int $min[, float|int|null $max = null ]) : self
Parameters
$field : string
$min : float|int
$max : float|int|null = null
Return values
self

query()

Set the query string for full-text search.

public query(string $query) : self
Parameters
$query : string
Return values
self

returnFields()

Add fields to return in the result.

public returnFields(array<string|int, mixed> $fields) : self
Parameters
$fields : array<string|int, mixed>
Return values
self

sortBy()

Add sorting.

public sortBy(string $field[, string $order = 'ASC' ]) : self
Parameters
$field : string
$order : string = 'ASC'
Return values
self

summarize()

Add summarization to specific fields.

public summarize(array<string|int, mixed> $fields[, int $fragments = 3 ][, int $length = 50 ][, string $separator = '...' ]) : self
Parameters
$fields : array<string|int, mixed>
$fragments : int = 3
$length : int = 50
$separator : string = '...'
Return values
self

tagFilter()

Add a tag filter for exact matches.

public tagFilter(string $field, array<string|int, mixed> $values) : self
Parameters
$field : string
$values : array<string|int, mixed>
Return values
self

withScores()

Add RedisSearch-specific directives.

public withScores() : self
Return values
self

buildSearchCommand()

Build the Redis command arguments dynamically.

private buildSearchCommand() : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results