$k. Query

new Query()

Represents a query

Extends

Methods

(static) forDomain(domain, withoutInheritanceopt) → {$k.StructuredQuery}

Returns the query for all objects of the domain

Parameters:
NameTypeAttributesDescription
domain$k.Domain

Domain or internal name of a type

withoutInheritanceboolean<optional>

If true do not return objects of subdomains

Since
  • 4.1.0
Returns:
Type: 
$k.StructuredQuery

(static) forDomains(domain, withoutInheritanceopt) → {$k.StructuredQuery}

Returns the query for all objects of the domains

Parameters:
NameTypeAttributesDescription
domainArray.<$k.Domain>

Domains or internal names of types

withoutInheritanceboolean<optional>

If true do not return objects of subdomains

Since
  • 4.1.0
Returns:
Type: 
$k.StructuredQuery

definedParameters() → {Array.<$k.QueryParameter>}

Returns the parameters of the query

Returns:
Type: 
Array.<$k.QueryParameter>

explainElements(elements, parametersopt) → {Array.<$k.SemanticElement>}

Returns elements involved in the query

Parameters:
NameTypeAttributesDescription
elementsArray.<$k.SemanticElement>

Elements to explain. Elements that do not match the query are ignored.

parametersobject<optional>
Throws:

When the query could not be solved, e.g. missing parameters

Type
$k.exception.QueryError
Returns:
Type: 
Array.<$k.SemanticElement>

filterElements(elements, parametersopt, searchStringopt) → {Array.<$k.SemanticElement>}

Returns all elements that match the query

Parameters:
NameTypeAttributesDescription
elementsArray.<$k.SemanticElement>
parametersobject<optional>
searchStringstring<optional>
Throws:

When the query could not be solved, e.g. missing parameters

Type
$k.exception.QueryError
Returns:
Type: 
Array.<$k.SemanticElement>
Example
var hits = $k.Registry.query("experts").filterElements(persons);

findElements(parametersopt, searchStringopt) → {Array.<$k.SemanticElement>}

Search and return all found semantic elements

Parameters:
NameTypeAttributesDescription
parametersobject<optional>
searchStringstring<optional>
Throws:

When the query could not be solved, e.g. missing parameters

Type
$k.exception.QueryError
Returns:
Type: 
Array.<$k.SemanticElement>
Examples
var hits = $k.Registry.query("directSearch").findElements("Test");
var hits = $k.Registry.query("compositeSearch").findElements("Test", { context: "portal" });

findHits(parametersopt, searchStringopt) → {Array.<$k.Hit>}

Search and return all found hits.

Parameters:
NameTypeAttributesDescription
parametersobject<optional>
searchStringstring<optional>
Throws:

When the query could not be solved, e.g. missing parameters

Type
$k.exception.QueryError
Returns:
Type: 
Array.<$k.Hit>
Example
var hits = $k.Registry.query("directSearch").findHits("Test*");

findResultSize(parametersopt, searchStringopt) → {number}

Search and return the number of found semantic elements

Parameters:
NameTypeAttributesDescription
parametersobject<optional>
searchStringstring<optional>
Since
  • 5.3.3
Throws:

When the query could not be solved, e.g. missing parameters

Type
$k.exception.QueryError
Returns:
Type: 
number

fullExplainElements(elements, parametersopt) → {Array.<$k.SemanticElement>}

Returns all elements involved in the query

Parameters:
NameTypeAttributesDescription
elementsArray.<$k.SemanticElement>

Elements to full explain. Elements that do not match the query are ignored.

parametersobject<optional>
Throws:

When the query could not be solved, e.g. missing parameters

Type
$k.exception.QueryError
Returns:
Type: 
Array.<$k.SemanticElement>

name() → {string}

Returns the name

Overrides
Returns:
Type: 
string

parentFolders() → {Array.<$k.Folder>}

Returns the folders that contain this element

Returns:
Type: 
Array.<$k.Folder>

renderElements(tableConfiguration, keyFilteropt, detailFilteropt) → {Array.<object>}

Search and render found semantic elements using the given table configuration

Parameters:
NameTypeAttributesDescription
tableConfiguration$k.TableConfiguration
keyFilterobject<optional>

Alternative 1 (preferred): a $k.JSONRenderContext Alternative 2 (compatibility only): A filter. See $k.JSONRenderContext.prototype.setFilters().

detailFilterobject<optional>

Only used if the key filter is not a $k.JSONRenderContext. See $k.JSONRenderContext.prototype.setLevelsOfDetail()

Since
  • 4.1.0
Deprecated
  • This function is deprecated and might be removed in future releases
Throws:

When the query could not be solved, e.g. missing parameters

Type
$k.exception.QueryError
Returns:

The rendered objects

Type: 
Array.<object>

renderHits(tableConfiguration, keyFilteropt, detailFilteropt) → {Array.<object>}

Search and render found hits using the given table configuration

Parameters:
NameTypeAttributesDescription
tableConfiguration$k.TableConfiguration
keyFilterobject<optional>

Alternative 1 (preferred): a $k.JSONRenderContext Alternative 2 (compatibility only): A filter. See $k.JSONRenderContext.prototype.setFilters().

detailFilterobject<optional>

Only used if the key filter is not a $k.JSONRenderContext. See $k.JSONRenderContext.prototype.setLevelsOfDetail()

Since
  • 4.1.0
Deprecated
  • This function is deprecated and might be removed in future releases
Throws:

When the query could not be solved, e.g. missing parameters

Type
$k.exception.QueryError
Returns:

The rendered objects

Type: 
Array.<object>

searchString() → {string}

Returns the search string

Returns:
Type: 
string

setDomain(domains)

Restrict the query results to objects/types of the domains

Parameters:
NameTypeDescription
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

Parameters:
NameTypeDescription
domainsArray.<$k.Domain>

The domains or internal names of types

setFacetFilters(facetFiltersArray)

Set the selected facets and terms for the query

Parameters:
NameTypeDescription
facetFiltersArrayarray

Array with selected facets and terms

Since
  • 5.1.3

setName(name)

Sets the name of the query

Parameters:
NameTypeDescription
namestring

The name

Version
  • Experimental feature, might be removed at any time
Since
  • 5.3.2

setParameter(parameterId, value)

Set a parameter of the query.

Parameters:
NameTypeDescription
parameterIdstring

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:

When the value is not suitable for the parameter

Type
$k.exception.TypeError

setParameters(parameters)

Set the parameters of the query from the properties of the object

Parameters:
NameTypeDescription
parameters

The parameters

Throws:

When a value is not a suitable parameter

Type
$k.exception.TypeError

setSearchString(searchString)

Set the string to search for

Parameters:
NameTypeDescription
searchStringstring

$k. Query

new Query()

Represents a simple search (fulltext search, semantic search etc.)

Extends

Methods

(static) forDomain(domain, withoutInheritanceopt) → {$k.StructuredQuery}

Returns the query for all objects of the domain

Parameters:
NameTypeAttributesDescription
domain$k.Domain

Domain or internal name of a type

withoutInheritanceboolean<optional>

If true do not return objects of subdomains

Since
  • 4.1.0
Returns:
Type: 
$k.StructuredQuery

(static) forDomains(domain, withoutInheritanceopt) → {$k.StructuredQuery}

Returns the query for all objects of the domains

Parameters:
NameTypeAttributesDescription
domainArray.<$k.Domain>

Domains or internal names of types

withoutInheritanceboolean<optional>

If true do not return objects of subdomains

Since
  • 4.1.0
Returns:
Type: 
$k.StructuredQuery

definedParameters() → {Array.<$k.QueryParameter>}

Returns the parameters of the query

Returns:
Type: 
Array.<$k.QueryParameter>

explainElements(elements, parametersopt) → {Array.<$k.SemanticElement>}

Returns elements involved in the query

Parameters:
NameTypeAttributesDescription
elementsArray.<$k.SemanticElement>

Elements to explain. Elements that do not match the query are ignored.

parametersobject<optional>
Throws:

When the query could not be solved, e.g. missing parameters

Type
$k.exception.QueryError
Returns:
Type: 
Array.<$k.SemanticElement>

filterElements(elements, parametersopt, searchStringopt) → {Array.<$k.SemanticElement>}

Returns all elements that match the query

Parameters:
NameTypeAttributesDescription
elementsArray.<$k.SemanticElement>
parametersobject<optional>
searchStringstring<optional>
Throws:

When the query could not be solved, e.g. missing parameters

Type
$k.exception.QueryError
Returns:
Type: 
Array.<$k.SemanticElement>
Example
var hits = $k.Registry.query("experts").filterElements(persons);

findElements(parametersopt, searchStringopt) → {Array.<$k.SemanticElement>}

Search and return all found semantic elements

Parameters:
NameTypeAttributesDescription
parametersobject<optional>
searchStringstring<optional>
Throws:

When the query could not be solved, e.g. missing parameters

Type
$k.exception.QueryError
Returns:
Type: 
Array.<$k.SemanticElement>
Examples
var hits = $k.Registry.query("directSearch").findElements("Test");
var hits = $k.Registry.query("compositeSearch").findElements("Test", { context: "portal" });

findHits(parametersopt, searchStringopt) → {Array.<$k.Hit>}

Search and return all found hits.

Parameters:
NameTypeAttributesDescription
parametersobject<optional>
searchStringstring<optional>
Throws:

When the query could not be solved, e.g. missing parameters

Type
$k.exception.QueryError
Returns:
Type: 
Array.<$k.Hit>
Example
var hits = $k.Registry.query("directSearch").findHits("Test*");

findResultSize(parametersopt, searchStringopt) → {number}

Search and return the number of found semantic elements

Parameters:
NameTypeAttributesDescription
parametersobject<optional>
searchStringstring<optional>
Since
  • 5.3.3
Throws:

When the query could not be solved, e.g. missing parameters

Type
$k.exception.QueryError
Returns:
Type: 
number

fullExplainElements(elements, parametersopt) → {Array.<$k.SemanticElement>}

Returns all elements involved in the query

Parameters:
NameTypeAttributesDescription
elementsArray.<$k.SemanticElement>

Elements to full explain. Elements that do not match the query are ignored.

parametersobject<optional>
Throws:

When the query could not be solved, e.g. missing parameters

Type
$k.exception.QueryError
Returns:
Type: 
Array.<$k.SemanticElement>

name() → {string}

Returns the name

Overrides
Returns:
Type: 
string

parentFolders() → {Array.<$k.Folder>}

Returns the folders that contain this element

Returns:
Type: 
Array.<$k.Folder>

renderElements(tableConfiguration, keyFilteropt, detailFilteropt) → {Array.<object>}

Search and render found semantic elements using the given table configuration

Parameters:
NameTypeAttributesDescription
tableConfiguration$k.TableConfiguration
keyFilterobject<optional>

Alternative 1 (preferred): a $k.JSONRenderContext Alternative 2 (compatibility only): A filter. See $k.JSONRenderContext.prototype.setFilters().

detailFilterobject<optional>

Only used if the key filter is not a $k.JSONRenderContext. See $k.JSONRenderContext.prototype.setLevelsOfDetail()

Since
  • 4.1.0
Deprecated
  • This function is deprecated and might be removed in future releases
Throws:

When the query could not be solved, e.g. missing parameters

Type
$k.exception.QueryError
Returns:

The rendered objects

Type: 
Array.<object>

renderHits(tableConfiguration, keyFilteropt, detailFilteropt) → {Array.<object>}

Search and render found hits using the given table configuration

Parameters:
NameTypeAttributesDescription
tableConfiguration$k.TableConfiguration
keyFilterobject<optional>

Alternative 1 (preferred): a $k.JSONRenderContext Alternative 2 (compatibility only): A filter. See $k.JSONRenderContext.prototype.setFilters().

detailFilterobject<optional>

Only used if the key filter is not a $k.JSONRenderContext. See $k.JSONRenderContext.prototype.setLevelsOfDetail()

Since
  • 4.1.0
Deprecated
  • This function is deprecated and might be removed in future releases
Throws:

When the query could not be solved, e.g. missing parameters

Type
$k.exception.QueryError
Returns:

The rendered objects

Type: 
Array.<object>

searchString() → {string}

Returns the search string

Returns:
Type: 
string

setDomain(domains)

Restrict the query results to objects/types of the domains

Parameters:
NameTypeDescription
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

Parameters:
NameTypeDescription
domainsArray.<$k.Domain>

The domains or internal names of types

setFacetFilters(facetFiltersArray)

Set the selected facets and terms for the query

Parameters:
NameTypeDescription
facetFiltersArrayarray

Array with selected facets and terms

Since
  • 5.1.3

setName(name)

Sets the name of the query

Parameters:
NameTypeDescription
namestring

The name

Version
  • Experimental feature, might be removed at any time
Since
  • 5.3.2

setParameter(parameterId, value)

Set a parameter of the query.

Parameters:
NameTypeDescription
parameterIdstring

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:

When the value is not suitable for the parameter

Type
$k.exception.TypeError

setParameters(parameters)

Set the parameters of the query from the properties of the object

Parameters:
NameTypeDescription
parameters

The parameters

Throws:

When a value is not a suitable parameter

Type
$k.exception.TypeError

setSearchString(searchString)

Set the string to search for

Parameters:
NameTypeDescription
searchStringstring

$k. Query

new Query()

Represents a simple search (fulltext search, semantic search etc.)

Extends

Methods

(static) forDomain(domain, withoutInheritanceopt) → {$k.StructuredQuery}

Returns the query for all objects of the domain

Parameters:
NameTypeAttributesDescription
domain$k.Domain

Domain or internal name of a type

withoutInheritanceboolean<optional>

If true do not return objects of subdomains

Since
  • 4.1.0
Returns:
Type: 
$k.StructuredQuery

(static) forDomains(domain, withoutInheritanceopt) → {$k.StructuredQuery}

Returns the query for all objects of the domains

Parameters:
NameTypeAttributesDescription
domainArray.<$k.Domain>

Domains or internal names of types

withoutInheritanceboolean<optional>

If true do not return objects of subdomains

Since
  • 4.1.0
Returns:
Type: 
$k.StructuredQuery

definedParameters() → {Array.<$k.QueryParameter>}

Returns the parameters of the query

Returns:
Type: 
Array.<$k.QueryParameter>

explainElements(elements, parametersopt) → {Array.<$k.SemanticElement>}

Returns elements involved in the query

Parameters:
NameTypeAttributesDescription
elementsArray.<$k.SemanticElement>

Elements to explain. Elements that do not match the query are ignored.

parametersobject<optional>
Throws:

When the query could not be solved, e.g. missing parameters

Type
$k.exception.QueryError
Returns:
Type: 
Array.<$k.SemanticElement>

filterElements(elements, parametersopt, searchStringopt) → {Array.<$k.SemanticElement>}

Returns all elements that match the query

Parameters:
NameTypeAttributesDescription
elementsArray.<$k.SemanticElement>
parametersobject<optional>
searchStringstring<optional>
Throws:

When the query could not be solved, e.g. missing parameters

Type
$k.exception.QueryError
Returns:
Type: 
Array.<$k.SemanticElement>
Example
var hits = $k.Registry.query("experts").filterElements(persons);

findElements(parametersopt, searchStringopt) → {Array.<$k.SemanticElement>}

Search and return all found semantic elements

Parameters:
NameTypeAttributesDescription
parametersobject<optional>
searchStringstring<optional>
Throws:

When the query could not be solved, e.g. missing parameters

Type
$k.exception.QueryError
Returns:
Type: 
Array.<$k.SemanticElement>
Examples
var hits = $k.Registry.query("directSearch").findElements("Test");
var hits = $k.Registry.query("compositeSearch").findElements("Test", { context: "portal" });

findHits(parametersopt, searchStringopt) → {Array.<$k.Hit>}

Search and return all found hits.

Parameters:
NameTypeAttributesDescription
parametersobject<optional>
searchStringstring<optional>
Throws:

When the query could not be solved, e.g. missing parameters

Type
$k.exception.QueryError
Returns:
Type: 
Array.<$k.Hit>
Example
var hits = $k.Registry.query("directSearch").findHits("Test*");

findResultSize(parametersopt, searchStringopt) → {number}

Search and return the number of found semantic elements

Parameters:
NameTypeAttributesDescription
parametersobject<optional>
searchStringstring<optional>
Since
  • 5.3.3
Throws:

When the query could not be solved, e.g. missing parameters

Type
$k.exception.QueryError
Returns:
Type: 
number

fullExplainElements(elements, parametersopt) → {Array.<$k.SemanticElement>}

Returns all elements involved in the query

Parameters:
NameTypeAttributesDescription
elementsArray.<$k.SemanticElement>

Elements to full explain. Elements that do not match the query are ignored.

parametersobject<optional>
Throws:

When the query could not be solved, e.g. missing parameters

Type
$k.exception.QueryError
Returns:
Type: 
Array.<$k.SemanticElement>

name() → {string}

Returns the name

Overrides
Returns:
Type: 
string

parentFolders() → {Array.<$k.Folder>}

Returns the folders that contain this element

Returns:
Type: 
Array.<$k.Folder>

renderElements(tableConfiguration, keyFilteropt, detailFilteropt) → {Array.<object>}

Search and render found semantic elements using the given table configuration

Parameters:
NameTypeAttributesDescription
tableConfiguration$k.TableConfiguration
keyFilterobject<optional>

Alternative 1 (preferred): a $k.JSONRenderContext Alternative 2 (compatibility only): A filter. See $k.JSONRenderContext.prototype.setFilters().

detailFilterobject<optional>

Only used if the key filter is not a $k.JSONRenderContext. See $k.JSONRenderContext.prototype.setLevelsOfDetail()

Since
  • 4.1.0
Deprecated
  • This function is deprecated and might be removed in future releases
Throws:

When the query could not be solved, e.g. missing parameters

Type
$k.exception.QueryError
Returns:

The rendered objects

Type: 
Array.<object>

renderHits(tableConfiguration, keyFilteropt, detailFilteropt) → {Array.<object>}

Search and render found hits using the given table configuration

Parameters:
NameTypeAttributesDescription
tableConfiguration$k.TableConfiguration
keyFilterobject<optional>

Alternative 1 (preferred): a $k.JSONRenderContext Alternative 2 (compatibility only): A filter. See $k.JSONRenderContext.prototype.setFilters().

detailFilterobject<optional>

Only used if the key filter is not a $k.JSONRenderContext. See $k.JSONRenderContext.prototype.setLevelsOfDetail()

Since
  • 4.1.0
Deprecated
  • This function is deprecated and might be removed in future releases
Throws:

When the query could not be solved, e.g. missing parameters

Type
$k.exception.QueryError
Returns:

The rendered objects

Type: 
Array.<object>

searchString() → {string}

Returns the search string

Returns:
Type: 
string

setDomain(domains)

Restrict the query results to objects/types of the domains

Parameters:
NameTypeDescription
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

Parameters:
NameTypeDescription
domainsArray.<$k.Domain>

The domains or internal names of types

setFacetFilters(facetFiltersArray)

Set the selected facets and terms for the query

Parameters:
NameTypeDescription
facetFiltersArrayarray

Array with selected facets and terms

Since
  • 5.1.3

setName(name)

Sets the name of the query

Parameters:
NameTypeDescription
namestring

The name

Version
  • Experimental feature, might be removed at any time
Since
  • 5.3.2

setParameter(parameterId, value)

Set a parameter of the query.

Parameters:
NameTypeDescription
parameterIdstring

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:

When the value is not suitable for the parameter

Type
$k.exception.TypeError

setParameters(parameters)

Set the parameters of the query from the properties of the object

Parameters:
NameTypeDescription
parameters

The parameters

Throws:

When a value is not a suitable parameter

Type
$k.exception.TypeError

setSearchString(searchString)

Set the string to search for

Parameters:
NameTypeDescription
searchStringstring