SearchService
Search service.
Constants¶
CAPABILITY_ADVANCED_FULLTEXT ¶
Capability flag for advanced fulltext feature for use with {@see ::supports()}.
|
|
Advance full text is a feature making to possible by current engine to parse advance full text expressions.
Tags
CAPABILITY_AGGREGATIONS ¶
Capability flag for aggregation feature for use with {@see ::supports()}.
|
|
CAPABILITY_CUSTOM_FIELDS ¶
Capability flag for custom fields feature for use with {@see ::supports()}.
|
|
Custom fields is the capability for search engines to 1. allow you to extend the search index via plugins to generate custom fields, like a different representation (format, ...) of an existing field or similar. And 2. allow you on some search criteria to specify this custom field to rather query on that instead of the default field generated by the system.
CAPABILITY_FACETS ¶
Capability flag for facets feature for use with {@see ::supports()}.
|
|
Faceted search: https://en.wikipedia.org/wiki/Faceted_search
Note: Even if search engine tells you this is supported, beware:
- It might not support all facets, by design it will only return facets for facet builders the search engine supports.
- Some of the faceting features are still work in progress in API and won't be further matured before in 7 .x releases
CAPABILITY_SCORING ¶
Capability flag for scoring feature for use with {@see ::supports()}.
|
|
Scoring, a search feature telling you how well one search hit scores compared to other items in the search result. When this is supported you can expect search engine to populate SearchHit->score and SearchResult->maxScore properties as well as sort by this if no sort clauses are specified.
CAPABILITY_SPELLCHECK ¶
Capability flag for spellcheck feature for use with {@see ::supports()}.
|
|
Spell check within search capabilities refers to ability to suggest better wordings in fulltext search string.
WARNING: This feature is considered experimental given it is not completely designed yet in terms of how it should interact with FullText criterion (singular) which is the most relevant here. Also given how FullText can be part of a more complex criteria it might imply a need to more strictly define where users are supposed to place FullText vs other criteria.
CAPABILITY_SUGGEST ¶
Capability flag for suggest feature for use with {@see ::supports()}.
|
|
WARNING: This feature is considered experimental given it is not completely clear what it is supposed to do. Feature might be deprecated in the future.
Methods¶
findContent() ¶
Finds content objects for the given query.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$query | Query | - | - |
$languageFilter | array<string|int, mixed> | [] |
Configuration for specifying prioritized languages query will be performed on.
Also used to define which field languages are loaded for the returned content.
Currently supports: |
$filterOnUserPermissions | bool | true |
if true only the objects which the user is allowed to read are returned. |
Return values
Tags
findContentInfo() ¶
Finds contentInfo objects for the given query.
|
|
This method works just like findContent, however does not load the full Content Objects. This means it can be more efficient for use cases where you don't need the full Content. Also including use cases where content will be loaded by separate code, like an ESI based sub requests that takes content ID as input.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$query | Query | - | - |
$languageFilter | array<string|int, mixed> | [] |
Configuration for specifying prioritized languages query will be performed on.
Currently supports: |
$filterOnUserPermissions | bool | true |
if true (default) only the objects which is the user allowed to read are returned. |
Return values
Tags
findLocations() ¶
Finds Locations for the given query.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$query | LocationQuery | - | - |
$languageFilter | array<string|int, mixed> | [] |
Configuration for specifying prioritized languages query will be performed on.
Currently supports: |
$filterOnUserPermissions | bool | true |
if true only the objects which is the user allowed to read are returned. |
Return values
Tags
findSingle() ¶
Performs a query for a single content object.
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$filter | Criterion | - | - |
$languageFilter | array<string|int, mixed> | [] |
Configuration for specifying prioritized languages query will be performed on.
Currently supports: |
$filterOnUserPermissions | bool | true |
if true only the objects which is the user allowed to read are returned. |
Return values
Tags
suggest() ¶
Suggests a list of values for the given prefix.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$prefix | string | - | - |
$fieldPaths | array<string|int, string> | [] | - |
$limit | int | 10 | - |
$filter | Criterion | null | - |
supports() ¶
Query for supported capability of currently configured search engine.
|
|
Will return false if search engine does not implement Capable.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$capabilityFlag | int | - |
One of CAPABILITY_* constants. |
Return values
bool