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

Search service. More...

Public Member Functions

 __construct (Config $config, PluginHooksService $hooks, 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...
 
 prepareSortOptions (array $options=[])
 Normalizes sort options. More...
 
 buildSearchWhereQuery (QueryBuilder $qb, $alias, $fields, $query_parts, $partial_match=true)
 Builds search clause. More...
 

Detailed Description

Search service.

Definition at line 23 of file SearchService.php.

Constructor & Destructor Documentation

Elgg\Search\SearchService::__construct ( Config  $config,
PluginHooksService  $hooks,
Database  $db 
)

Constructor.

Parameters
\Elgg\Config$configConfig
\Elgg\PluginHooksService$hooksHook registration service
Database$dbDatabase

Definition at line 49 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 330 of file SearchService.php.

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

Normalize options.

Parameters
array$optionsOptions
Returns
array

Definition at line 119 of file SearchService.php.

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

Normalize query parts.

Parameters
array$optionsOptions
Returns
array

Definition at line 170 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 205 of file SearchService.php.

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

Prepare ege* options.

Parameters
array$optionsEntity search params
Returns
array

Definition at line 147 of file SearchService.php.

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

Normalizes sort options.

Parameters
array$optionsSearch parameters
Returns
array

Definition at line 293 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
InvalidParameterException
See also
elgg_get_entities()

Definition at line 76 of file SearchService.php.


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