Elgg  Version 6.1
Public Member Functions | List of all members
Elgg\Search\SearchService Class Reference

Search service. More...

Public Member Functions

 __construct (protected Config $config, protected EventsService $events, protected Database $db)
 Constructor. More...
 
 search (array $options=[])
 Returns search results as an array of entities, as a batch, or a count, depending on parameters given. More...
 
 normalizeOptions (array $options=[])
 Normalize options. More...
 
 prepareSearchOptions (array $options=[])
 Prepare ege* options. More...
 
 normalizeQuery (array $options=[])
 Normalize query parts. More...
 
 normalizeSearchFields (array $options=[])
 Normalizes an array of search fields. More...
 
 buildSearchWhereQuery (QueryBuilder $qb, $alias, $fields, $query_parts, $partial_match=true)
 Builds search clause. More...
 

Detailed Description

Search service.

Definition at line 22 of file SearchService.php.

Constructor & Destructor Documentation

Elgg\Search\SearchService::__construct ( protected Config  $config,
protected EventsService  $events,
protected Database  $db 
)

Constructor.

Parameters
\Elgg\Config$configConfig
\Elgg\EventsService$eventsEvents service
Database$dbDatabase

Definition at line 33 of file SearchService.php.

Member Function Documentation

Elgg\Search\SearchService::buildSearchWhereQuery ( QueryBuilder  $qb,
  $alias,
  $fields,
  $query_parts,
  $partial_match = true 
)

Builds search clause.

Parameters
QueryBuilder$qbQuery builder
string$aliasEntity table alias
array$fieldsFields to match against
array$query_partsSearch query
bool$partial_matchAllow partial matches
Returns
CompositeExpression|string

Definition at line 279 of file SearchService.php.

Elgg\Search\SearchService::normalizeOptions ( array  $options = [])

Normalize options.

Parameters
array$optionsOptions
Returns
array

Definition at line 104 of file SearchService.php.

Elgg\Search\SearchService::normalizeQuery ( array  $options = [])

Normalize query parts.

Parameters
array$optionsOptions
Returns
array

Definition at line 153 of file SearchService.php.

Elgg\Search\SearchService::normalizeSearchFields ( array  $options = [])

Normalizes an array of search fields.

Parameters
array$optionsSearch parameters
Returns
array

Definition at line 188 of file SearchService.php.

Elgg\Search\SearchService::prepareSearchOptions ( array  $options = [])

Prepare ege* options.

Parameters
array$optionsEntity search params
Returns
array

Definition at line 132 of file SearchService.php.

Elgg\Search\SearchService::search ( array  $options = [])

Returns search results as an array of entities, as a batch, or a count, depending on parameters given.

Parameters
array$optionsSearch parameters Accepts all options supported by elgg_get_entities()

string $query Search query string $type Entity type. Required if no search type is set string $search_type Custom search type. Required if no type is set array $fields An array of fields to search in string $sort An array containing 'property', 'property_type', 'direction' and 'signed' bool $partial_match Allow partial matches, e.g. find 'elgg' when search for 'el' bool $tokenize Break down search query into tokens, e.g. find 'elgg has been released' when searching for 'elgg released'

Returns
|[]|int|false
Exceptions
DomainException
See also
elgg_get_entities()

Definition at line 61 of file SearchService.php.


The documentation for this class was generated from the following file: