Metadata passed with search requests.
More...
#include <unity/scopes/SearchMetadata.h>
Metadata passed with search requests.
unity::scopes::SearchMetadata::SearchMetadata |
( |
std::string const & |
locale, |
|
|
std::string const & |
form_factor |
|
) |
| |
Create SearchMetadata with the given locale and form factor.
- Parameters
-
locale | locale string, eg. en_EN |
form_factor | form factor name, e.g. phone, desktop, phone-version etc. |
unity::scopes::SearchMetadata::SearchMetadata |
( |
int |
cardinality, |
|
|
std::string const & |
locale, |
|
|
std::string const & |
form_factor |
|
) |
| |
Create SearchMetadata with the given cardinality, locale, and form factor.
- Parameters
-
cardinality | maximum number of search results |
locale | locale string, eg. en_EN |
form_factor | form factor name, e.g. phone, desktop, phone-version etc. |
std::set< std::string > unity::scopes::SearchMetadata::aggregated_keywords |
( |
| ) |
const |
Get the list of scope keywords used to initiate this search request.
- Returns
- The list of scope keywords used to initiate this search request.
int unity::scopes::SearchMetadata::cardinality |
( |
| ) |
const |
Get cardinality.
- Returns
- The maxmium number of search results, or 0 for no limit.
bool unity::scopes::SearchMetadata::contains_hint |
( |
std::string const & |
key | ) |
const |
Check if this SearchMetadata has a hint.
- Parameters
-
- Returns
- True if the hint is set.
bool unity::scopes::SearchMetadata::has_location |
( |
| ) |
const |
Does the SearchMetadata have a location.
- Returns
- True if there is a location property.
VariantMap unity::scopes::SearchMetadata::hints |
( |
| ) |
const |
Get all hints.
- Returns
- Hints dictionary.
- Exceptions
-
unity::NotFoundException | if no hints are available. |
bool unity::scopes::SearchMetadata::is_aggregated |
( |
| ) |
const |
Check if this search request originated from an aggregator scope.
- Returns
- True if this search request originated from an aggregator scope.
Location unity::scopes::SearchMetadata::location |
( |
| ) |
const |
Get location.
- Returns
- Location data representing the current location, including attributes such as city and country.
- Exceptions
-
unity::NotFoundException | if no location data is available. |
Variant & unity::scopes::SearchMetadata::operator[] |
( |
std::string const & |
key | ) |
|
Returns a reference to a hint.
This method can be used to read or set hints. Setting a value of an existing hint overwrites its previous value. Referencing a non-existing hint automatically creates it with a default value of Variant::Type::Null.
- Parameters
-
- Returns
- A reference to the hint.
Variant const & unity::scopes::SearchMetadata::operator[] |
( |
std::string const & |
key | ) |
const |
Returns a const reference to a hint.
This method can be used for read-only access to hints. Referencing a non-existing hint throws unity::InvalidArgumentException.
- Parameters
-
- Returns
- A const reference to the hint.
- Exceptions
-
unity::NotFoundException | if no hint with the given name exists. |
void unity::scopes::SearchMetadata::remove_location |
( |
| ) |
|
Remove location data entirely.
This method does nothing if no location data is present.
void unity::scopes::SearchMetadata::set_aggregated_keywords |
( |
std::set< std::string > const & |
aggregated_keywords | ) |
|
Set the list of scope keywords used to initiate this search request.
- Parameters
-
aggregated_keywords | The list of scope keywords used to initiate this search request. |
void unity::scopes::SearchMetadata::set_cardinality |
( |
int |
cardinality | ) |
|
Set cardinality.
- Parameters
-
cardinality | The maximum number of search results. |
void unity::scopes::SearchMetadata::set_hint |
( |
std::string const & |
key, |
|
|
Variant const & |
value |
|
) |
| |
Sets a hint.
- Parameters
-
key | The name of the hint. |
value | Hint value |
void unity::scopes::SearchMetadata::set_location |
( |
Location const & |
location | ) |
|
The documentation for this class was generated from the following files: