CoreQuery
in package
implements
QueryInterface
Default querying interface,
Table of Contents
Interfaces
Properties
- $boostedFields : array<string|int, mixed>
- $filters : array<string|int, mixed>
- $highlight : bool
- $orFilters : array<string|int, mixed>
- $rows : int
- $sort : array<string|int, mixed>
- $spellcheck : bool
- $start : int
- $terms : array<string|int, mixed>
Methods
- addBoostedField() : self
- addFilter() : CoreQuery
- addOrFilter() : self
- Add the or filters in a key-value pair
- addSort() : self
- Add a sort field and direction
- addTerm() : $this
- Each boosted query needs a separate addition! e.g. $this->addTerm('test', ['MyField', 'MyOtherField'], 3) followed by $this->addTerm('otherTest', ['Title'], 5);
- getBoostedFields() : array<string|int, mixed>
- getFilters() : array<string|int, mixed>
- getOrFilters() : array<string|int, mixed>
- Get the OR filters for this query
- getRows() : int
- Get the rows to return
- getSort() : array<string|int, mixed>
- Get the sort fields
- getStart() : int
- Get the offset to start
- getTerms() : array<string|int, mixed>
- Get the search terms
- isHighlight() : bool
- setBoostedFields() : void
- setFilters() : CoreQuery
- setHighlight() : self
- setOrFilters() : self
- Set the or filters for this query
- setRows() : self
- Set the rows to return
- setSort() : self
- Set the sort fields
- setStart() : self
- Set the offset to start
- setTerms() : $this
- Set the search tearms
Properties
$boostedFields
protected
array<string|int, mixed>
$boostedFields
= []
$filters
protected
array<string|int, mixed>
$filters
= []
Filters to use/apply
$highlight
protected
bool
$highlight
= true
$orFilters
protected
array<string|int, mixed>
$orFilters
= []
Filters that are not exclusive
$rows
protected
int
$rows
= 10
Total rows to display
$sort
protected
array<string|int, mixed>
$sort
= []
Sorting settings
$spellcheck
protected
bool
$spellcheck
= true
Enable spellchecking?
$start
protected
int
$start
= 0
Pagination start
$terms
protected
array<string|int, mixed>
$terms
= []
Search terms
Methods
addBoostedField()
public
addBoostedField(mixed $key, mixed $value) : self
Parameters
- $key : mixed
- $value : mixed
Return values
selfaddFilter()
public
addFilter(string $key, string|array<string|int, mixed> $value) : CoreQuery
Parameters
- $key : string
-
Field to apply filter on
- $value : string|array<string|int, mixed>
-
Value(s) to filter on
Return values
CoreQueryaddOrFilter()
Add the or filters in a key-value pair
public
addOrFilter(string $key, string $value) : self
Parameters
- $key : string
- $value : string
Return values
selfaddSort()
Add a sort field and direction
public
addSort(string $field, string $direction) : self
Parameters
- $field : string
- $direction : string
Return values
selfaddTerm()
Each boosted query needs a separate addition! e.g. $this->addTerm('test', ['MyField', 'MyOtherField'], 3) followed by $this->addTerm('otherTest', ['Title'], 5);
public
addTerm(string $term[, array<string|int, mixed> $fields = [] ][, int $boost = 0 ][, float|bool $fuzzy = false ]) : $this
If you want a generic boost on all terms, use addTerm only once, but boost on each field
The fields parameter is used to boost on
Parameters
- $term : string
-
Term to search for
- $fields : array<string|int, mixed> = []
-
fields to boost on
- $boost : int = 0
-
Boost value
- $fuzzy : float|bool = false
-
True or a value to the maximum amount of iterations
Return values
$this —For generic boosting, use @addBoostedField($field, $boost), this will add the boost at Index time
getBoostedFields()
public
getBoostedFields() : array<string|int, mixed>
Return values
array<string|int, mixed>getFilters()
public
getFilters() : array<string|int, mixed>
Return values
array<string|int, mixed>getOrFilters()
Get the OR filters for this query
public
getOrFilters() : array<string|int, mixed>
Return values
array<string|int, mixed>getRows()
Get the rows to return
public
getRows() : int
Return values
intgetSort()
Get the sort fields
public
getSort() : array<string|int, mixed>
Return values
array<string|int, mixed>getStart()
Get the offset to start
public
getStart() : int
Return values
intgetTerms()
Get the search terms
public
getTerms() : array<string|int, mixed>
Return values
array<string|int, mixed>isHighlight()
public
isHighlight() : bool
Return values
boolsetBoostedFields()
public
setBoostedFields(array<string|int, mixed> $boostedFields) : void
Parameters
- $boostedFields : array<string|int, mixed>
setFilters()
public
setFilters(array<string|int, mixed> $filters) : CoreQuery
Parameters
- $filters : array<string|int, mixed>
Return values
CoreQuerysetHighlight()
public
setHighlight(bool $highlight) : self
Parameters
- $highlight : bool
Return values
selfsetOrFilters()
Set the or filters for this query
public
setOrFilters(array<string|int, mixed> $filters) : self
Parameters
- $filters : array<string|int, mixed>
Return values
selfsetRows()
Set the rows to return
public
setRows(int $rows) : self
Parameters
- $rows : int
Return values
selfsetSort()
Set the sort fields
public
setSort(array<string|int, mixed> $sort) : self
Parameters
- $sort : array<string|int, mixed>
Return values
selfsetStart()
Set the offset to start
public
setStart(int $start) : self
Parameters
- $start : int
Return values
selfsetTerms()
Set the search tearms
public
setTerms(array<string|int, mixed> $terms) : $this
Parameters
- $terms : array<string|int, mixed>