Class $k.Query
Represents a query
- Defined in: Query.js
- Extends: $k.FolderElement
Constructor Attributes | Constructor Name and Description |
---|---|
$k.Query()
|
Method Summary
Class Detail
$k.Query()
Method Detail
-
Returns the parameters of the query
- Returns:
- {$k.QueryParameter[]}
- See:
- $k.Query#setParameter
-
Returns all elements involved in the query
- Parameters:
- {$k.SemanticElement[]} elements
- Elements to explain. Elements that do not match the query are ignored.
- {object} parameters Optional
- Throws:
- {$k.exception.QueryError}
- When the query could not be solved, e.g. missing parameters
- Returns:
- {$k.SemanticElement[]}
- See:
- $k.Query#setParameter
-
Returns all elements that match the query
var hits = $k.Registry.query("experts").filterElements(persons);
- Parameters:
- {$k.SemanticElement[]} elements
- {object} parameters Optional
- {string} searchString Optional
- Throws:
- {$k.exception.QueryError}
- When the query could not be solved, e.g. missing parameters
- Returns:
- {$k.SemanticElement[]}
- See:
- $k.Query#setParameter
-
Search and return all found semantic elements
var hits = $k.Registry.query("directSearch").findHits("Test");
var hits = $k.Registry.query("compositeSearch").findHits("Test", { context: "portal" });
- Parameters:
- {object} parameters Optional
- {string} searchString Optional
- Throws:
- {$k.exception.QueryError}
- When the query could not be solved, e.g. missing parameters
- Returns:
- {$k.SemanticElement[]}
- See:
- $k.Query#setParameter
-
Search and return all found hits.
var hits = $k.Registry.query("directSearch").findHits("Test*");
- Parameters:
- {object} parameters Optional
- {string} searchString Optional
- Throws:
- {$k.exception.QueryError}
- When the query could not be solved, e.g. missing parameters
- Returns:
- {$k.Hit[]}
- See:
- $k.Query#setParameter
-
{string} name()Returns the name
- Returns:
- {string}
-
{string} searchString()Returns the search string
- Returns:
- {string}
-
setDomains(domains)Restrict the query results to objects/types of the domains
- Parameters:
- {$k.Domain[]} domains
- The domains
-
setParameter(parameterId, value)Set a parameter of the query.
- Parameters:
- {string} parameterId
- 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:
- {$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
- Parameters:
- parameters
- The parameters
- Throws:
- {$k.exception.TypeError}
- When a value is not a suitable parameter
- See:
- $k.Query#setParameter
-
setSearchString(searchString)Set the string to search for
- Parameters:
- {string} searchString