SearchProviderInterface
A standard interface used for describing search engine implementations.
Tags
Table of Contents
- delete() : mixed
- Deletes the business object provided from the search engine index.
- getNumberFound() : int
- Returns the number of matching objects found in the previous search carried out by this provider.
- getRelated() : array<string|int, mixed>
- Gets a list of documents related to the business objects matching the object provided. An array of business objects will be returned (ordered by the search engine).
- index() : mixed
- Adds/updates the business object provided to the search engine index.
- search() : array<string|int, mixed>
- The main search function, you should provide the user's search query as-is and pass it to the search engine. An array of business objects will be returned (ordered by the search engine).
Methods
delete()
Deletes the business object provided from the search engine index.
public
delete(ActiveRecord $sourceObject) : mixed
Parameters
- $sourceObject : ActiveRecord
-
The object to delete from the search index.
Tags
Return values
mixed —getNumberFound()
Returns the number of matching objects found in the previous search carried out by this provider.
public
getNumberFound() : int
Tags
Return values
int —getRelated()
Gets a list of documents related to the business objects matching the object provided. An array of business objects will be returned (ordered by the search engine).
public
getRelated(ActiveRecord $sourceObject[, string $returnType = 'all' ], int $start[, int $limit = 10 ][, string $distinct = '' ]) : array<string|int, mixed>
Parameters
- $sourceObject : ActiveRecord
-
The source object for comparison.
- $returnType : string = 'all'
-
Use this filter to determine that only business objects of a certain class hould be returned (default is to return all classes indexed).
- $start : int
-
Start point for pagination.
- $limit : int = 10
-
The maximum amount to return in the list (for pagination).
- $distinct : string = ''
-
Related items will only be returned that have distinct values in this named field.
Tags
Return values
array<string|int, mixed> —An array of related business objects.
index()
Adds/updates the business object provided to the search engine index.
public
index(ActiveRecord $sourceObject) : mixed
Parameters
- $sourceObject : ActiveRecord
-
The object to add to the search index. The sourceObject should already be stored in the database.
Tags
Return values
mixed —search()
The main search function, you should provide the user's search query as-is and pass it to the search engine. An array of business objects will be returned (ordered by the search engine).
public
search(string $query[, string $returnType = 'all' ], int $start[, int $limit = 10 ], int $createdBy) : array<string|int, mixed>
Parameters
- $query : string
-
The search query.
- $returnType : string = 'all'
-
Use this filter to determine that only business objects of a certain class hould be returned (default is to return all classes indexed).
- $start : int
-
Start point for pagination.
- $limit : int = 10
-
The maximum amount to return in the list (for pagination).
- $createdBy : int
-
Optionally provide the creator ID to restrict search to Tags created by that user.
Tags
Return values
array<string|int, mixed> —An array of matching business objects.