search method
Searches Knowledge Graph for entities that match the constraints.
A list of matched entities will be returned in response, which will be in JSON-LD format and compatible with http://schema.org
Request parameters:
ids
- The list of entity id to be used for search instead of query
string. To specify multiple ids in the HTTP request, repeat the parameter
in the URL as in ...?ids=A&ids=B
indent
- Enables indenting of json results.
languages
- The list of language codes (defined in ISO 693) to run the
query with, e.g. 'en'.
limit
- Limits the number of entities to be returned.
prefix
- Enables prefix match against names and aliases of entities
query
- The literal query string for search.
types
- Restricts returned entities with these types, e.g. Person (as
defined in http://schema.org/Person). If multiple types are specified,
returned entities will contain one or more of these types.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a SearchResponse.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client
completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<SearchResponse> search({
core.List<core.String>? ids,
core.bool? indent,
core.List<core.String>? languages,
core.int? limit,
core.bool? prefix,
core.String? query,
core.List<core.String>? types,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
if (ids != null) 'ids': ids,
if (indent != null) 'indent': ['${indent}'],
if (languages != null) 'languages': languages,
if (limit != null) 'limit': ['${limit}'],
if (prefix != null) 'prefix': ['${prefix}'],
if (query != null) 'query': [query],
if (types != null) 'types': types,
if ($fields != null) 'fields': [$fields],
};
const url_ = 'v1/entities:search';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return SearchResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}