new $k.Query()
Represents a query
Extends
Methods
static$k.Query.forDomain(domain, withoutInheritance) : $k.StructuredQuery
Returns the query for all objects of the domain
Name | Type | Description |
---|---|---|
domain |
$k.Domain |
Domain or internal name of a type |
withoutInheritance |
boolean |
optional
If true do not return objects of subdomains |
- Since:
- 4.1.0
Returns:
Type | Description |
---|---|
$k.StructuredQuery |
static$k.Query.forDomains(domain, withoutInheritance) : $k.StructuredQuery
Returns the query for all objects of the domains
Name | Type | Description |
---|---|---|
domain |
Array.<$k.Domain> |
Domains or internal names of types |
withoutInheritance |
boolean |
optional
If true do not return objects of subdomains |
- Since:
- 4.1.0
Returns:
Type | Description |
---|---|
$k.StructuredQuery |
definedParameters() : Array.<$k.QueryParameter>
Returns the parameters of the query
Returns:
Type | Description |
---|---|
Array.<$k.QueryParameter> |
explainElements(elements, parameters) : Array.<$k.SemanticElement>
Returns elements involved in the query
Name | Type | Description |
---|---|---|
elements |
Array.<$k.SemanticElement> |
Elements to explain. Elements that do not match the query are ignored. |
parameters |
object | optional |
Throws:
Type | Description |
---|---|
$k.exception.QueryError | When the query could not be solved, e.g. missing parameters |
Returns:
Type | Description |
---|---|
Array.<$k.SemanticElement> |
filterElements(elements, parameters, searchString) : Array.<$k.SemanticElement>
Returns all elements that match the query
Name | Type | Description |
---|---|---|
elements |
Array.<$k.SemanticElement> | |
parameters |
object | optional |
searchString |
string | optional |
Throws:
Type | Description |
---|---|
$k.exception.QueryError | When the query could not be solved, e.g. missing parameters |
Returns:
Type | Description |
---|---|
Array.<$k.SemanticElement> |
Example
var hits = $k.Registry.query("experts").filterElements(persons);
findElements(parameters, searchString) : Array.<$k.SemanticElement>
Search and return all found semantic elements
Name | Type | Description |
---|---|---|
parameters |
object | optional |
searchString |
string | optional |
Throws:
Type | Description |
---|---|
$k.exception.QueryError | When the query could not be solved, e.g. missing parameters |
Returns:
Type | Description |
---|---|
Array.<$k.SemanticElement> |
Examples
var hits = $k.Registry.query("directSearch").findElements("Test");
var hits = $k.Registry.query("compositeSearch").findElements("Test", { context: "portal" });
findHits(parameters, searchString) : Array.<$k.Hit>
Search and return all found hits.
Name | Type | Description |
---|---|---|
parameters |
object | optional |
searchString |
string | optional |
Throws:
Type | Description |
---|---|
$k.exception.QueryError | When the query could not be solved, e.g. missing parameters |
Returns:
Type | Description |
---|---|
Array.<$k.Hit> |
Example
var hits = $k.Registry.query("directSearch").findHits("Test*");
fullExplainElements(elements, parameters) : Array.<$k.SemanticElement>
Returns all elements involved in the query
Name | Type | Description |
---|---|---|
elements |
Array.<$k.SemanticElement> |
Elements to full explain. Elements that do not match the query are ignored. |
parameters |
object | optional |
Throws:
Type | Description |
---|---|
$k.exception.QueryError | When the query could not be solved, e.g. missing parameters |
Returns:
Type | Description |
---|---|
Array.<$k.SemanticElement> |
name() : string
Returns the name
Returns:
Type | Description |
---|---|
string |
renderElements(tableConfiguration, keyFilter, detailFilter) : Array.<object>
Search and render found semantic elements using the given table configuration
Name | Type | Description |
---|---|---|
tableConfiguration |
$k.TableConfiguration | |
keyFilter |
object |
optional
Alternative 1: An array of strings defining a filter which property names to include. {"exclude": ["key1", ...]}includes all but the listed properties, while {"include": ["key1", ...]}or ["key1", ...]includes only the listed properties. Non-optional properties are always included Alternative 3: A JSONRenderContext |
detailFilter |
object |
optional
A filter to define the granularity of the JSON structure [ "schema" ]includes json with schema information |
- Since:
- 4.1.0
Throws:
Type | Description |
---|---|
$k.exception.QueryError | When the query could not be solved, e.g. missing parameters |
Returns:
Type | Description |
---|---|
Array.<object> | The rendered objects |
renderHits(tableConfiguration, keyFilter, detailFilter) : Array.<object>
Search and render found hits using the given table configuration
Name | Type | Description |
---|---|---|
tableConfiguration |
$k.TableConfiguration | |
keyFilter |
object |
optional
Alternative 1: An array of strings defining a filter which property names to include. {"exclude": ["key1", ...]}includes all but the listed properties, while {"include": ["key1", ...]}or ["key1", ...]includes only the listed properties. Non-optional properties are always included Alternative 3: A JSONRenderContext |
detailFilter |
object |
optional
A filter to define the granularity of the JSON structure [ "schema" ]includes json with schema information |
- Since:
- 4.1.0
Throws:
Type | Description |
---|---|
$k.exception.QueryError | When the query could not be solved, e.g. missing parameters |
Returns:
Type | Description |
---|---|
Array.<object> | The rendered objects |
searchString() : string
Returns the search string
Returns:
Type | Description |
---|---|
string |
setDomain(domains)
Restrict the query results to objects/types of the domains
Name | Type | Description |
---|---|---|
domains |
$k.Domain |
The domain or internal name of a type |
- Since:
- 4.1.0
setDomains(domains)
Restrict the query results to objects/types of the domains
Name | Type | Description |
---|---|---|
domains |
Array.<$k.Domain> |
The domains or internal names of types |
setFacetFilters(facetFiltersArray)
Set the selected facets and terms for the query
Name | Type | Description |
---|---|---|
facetFiltersArray |
array |
Array with selected facets and terms |
setParameter(parameterId, value)
Set a parameter of the query.
Name | Type | Description |
---|---|---|
parameterId |
string |
The ID of the parameter |
value |
The value of the parameter. The type (string etc.) depends on the parameter. Arrays of values can be passed, too. The value undefined or null disables the parametrized condition. |
Throws:
Type | Description |
---|---|
$k.exception.TypeError | When the value is not suitable for the parameter |
setParameters(parameters)
Set the parameters of the query from the properties of the object
Name | Type | Description |
---|---|---|
parameters |
The parameters |
Throws:
Type | Description |
---|---|
$k.exception.TypeError | When a value is not a suitable parameter |
setSearchString(searchString)
Set the string to search for
Name | Type | Description |
---|---|---|
searchString |
string |