Class $k.Hit
Provides details about a topic returned by a query. Each hit has a quality between 0 (worst quality) and 1 (best quality). Additional details are attached as causes.
- Defined in: Hit.js
Constructor Attributes | Constructor Name and Description |
---|---|
$k.Hit(semanticElement, quality)
Creates a new hit
|
Method Summary
Class Detail
$k.Hit(semanticElement, quality)
Creates a new hit
- Parameters:
- {$k.SemanticElement} semanticElement
- Semantic element of the hit
- {number} quality
- Quality of the hit. If undefined, 1 will be set as quality
- Throws:
- {$k.exception.InvalidValue}
- If the quality is not between 0 and 1
- {$k.exception.TypeError}
- If the argument is not a semantic element
Method Detail
-
addCause(cause)Add a cause
- Parameters:
- {$k.Cause} cause
-
Returns the cause of this hit with the given type, or undefined if no or more than one cause exists
- Parameters:
- type
- Returns:
- {$k.Cause[]}
-
Returns the causes of this hit
- Returns:
- {$k.Cause[]}
-
Returns the causes of this hit with the given type
- Parameters:
- type
- Returns:
- {$k.Cause[]}
-
The semantic element associated with this hit
- Returns:
- {$k.SemanticElement}
-
{number} quality()Returns the quality of the hit, a number between 0 (worst quality) and 1 (best quality)
- Returns:
- {number}
-
setElement(semanticElement)Set the semantic element associated with this hit
- Parameters:
- {$k.SemanticElement} semanticElement
- Semantic element of the hit
- Throws:
- {$k.exception.TypeError}
- If the argument is not a semantic element
-
setQuality(quality)Set the quality, a number between 0 and 1
- Parameters:
- {number} quality
- Throws:
- {$k.exception.InvalidValue}
- If the quality is not between 0 and 1