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

WARNING: API IN FLUX. 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

WARNING: API IN FLUX.

DO NOT USE DIRECTLY.

Use elgg_search() instead.

Definition at line 30 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 56 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
Exceptions
InvalidParameterException

Definition at line 338 of file SearchService.php.

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

Normalize options.

Parameters
array$optionsOptions
Returns
array

Definition at line 126 of file SearchService.php.

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

Normalize query parts.

Parameters
array$optionsOptions
Returns
array

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

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

Prepare ege* options.

Parameters
array$optionsEntity search params
Returns
array

Definition at line 154 of file SearchService.php.

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

Normalizes sort options.

Parameters
array$optionsSearch parameters
Returns
array

Definition at line 297 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
ElggBatch|ElggEntity[]|int|false
Exceptions
InvalidParameterException
See also
elgg_get_entities()

Definition at line 83 of file SearchService.php.


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