BaseSearchFactory
Base factory to build elastic search requests.
Namespace
IO\Services\ItemSearch\Factories
Type | Name | Value | Description |
---|---|---|---|
|
'asc' |
||
|
'desc' |
||
|
'aggregations' |
||
|
'collapse' |
||
|
'extensions' |
||
|
'filters' |
||
|
'mutators' |
||
|
'pagination' |
||
|
'resultFields' |
||
|
'sorting' |
Type | Name | Description |
---|---|---|
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Methods
public static inherit($searchBuilder, $inheritedProperties = []):BaseSearchFactory
Create a new factory instance based on properties of an existing factory.
Type |
Name |
Description |
|
The search factory to inherit properties from. |
|
|
List of properties to inherit or null to inherit all properties. |
public withMutator($mutator):Factories
Add a mutator
Type |
Name |
Description |
|
public createFilter($filterClass):TypeInterface
Add a filter. Will create a new instance of the filter class if not already created.
Type |
Name |
Description |
|
public withFilter($filter):Factories
Add a filter. Will override existing filter instances.
Type |
Name |
Description |
|
public withResultFields($fields):BaseSearchFactory
Set fields to be contained in search result.
Type |
Name |
Description |
|
Reference to a json file to load fields from or a list of field names. |
public getResultFields()
public withExtension($extensionClass, $extensionParams = []):Factories
Add an extension.
Type |
Name |
Description |
|
Extension class to add. |
|
|
Additional parameters to pass to extensions constructor |
public getExtensions():array
Get all registered extensions
public withAggregation($aggregation):Factories
Add an aggregation
Type |
Name |
Description |
|
public setPage($page, $itemsPerPage):Factories
Set pagination parameters.
Type |
Name |
Description |
|
||
|
public sortBy($field, $order = self::SORTING_ORDER_DESC):Factories
Add sorting parameters
Type |
Name |
Description |
|
The field to order by |
|
|
Direction to order results. Possible values: 'asc' or 'desc' |
public sortByMultiple($sortingList):Factories
Add multiple sorting parameters
Type |
Name |
Description |
|
List of sorting parameters. Each entry should have a 'field' and an 'order' property. |
public setOrder($idList)
Type |
Name |
Description |
|
public groupBy($field):Factories
Group results by field
Type |
Name |
Description |
|
The field to group properties by. |
public build():DocumentSearch
Build the elastic search request.
public prepareSearch($source):DocumentSearch
Build the search instance itself. May be overridden by concrete factories.
Type |
Name |
Description |
|