new $k.Cause(quality, causeProperties)
Creates a new cause
Name | Type | Description |
---|---|---|
quality |
number |
optional
Quality of the cause |
causeProperties |
object |
optional
Properties of the cause |
Throws:
Type | Description |
---|---|
$k.exception.InvalidValue | If the quality is not between 0 and 1 Provides additional details about a hit returned by a query |
Methods
properties()
Returns all properties (restricted to those that can be converted to objects)
- Since:
- 5.3.0
property(name)
Returns the value of the named property, or undefined if the property does not exist
Name | Type | Description |
---|---|---|
name |
string |
Throws:
Type | Description |
---|---|
$k.exception.TypeError | If the name is not a string |
$k.exception.InvalidValue | If the value of the property cannot be converted to an object |
quality() : number
Returns the quality of the cause, a number between 0 (worst quality) and 1 (best quality)
Returns:
Type | Description |
---|---|
number |
setProperties(properties)
Set the properties of the cause
Name | Type | Description |
---|---|---|
properties |
object |
Throws:
Type | Description |
---|---|
$k.exception.InvalidValue | If the value is not a valid property value |
setProperty(name, value)
Set the value of the named property
Name | Type | Description |
---|---|---|
name |
string | |
value |
Throws:
Type | Description |
---|---|
$k.exception.TypeError | If the name is not a string |
$k.exception.InvalidValue | If the value is not a valid property value |
setQuality(quality)
Set the quality, a number between 0 and 1
Name | Type | Description |
---|---|---|
quality |
number |
Throws:
Type | Description |
---|---|
$k.exception.InvalidValue | If the quality is not between 0 and 1 |
setType(type)
Set the type
Name | Type | Description |
---|---|---|
type |
string |
Throws:
Type | Description |
---|---|
RangeError | If this is a system-defined cause |
type() : string
Returns the type of the cause, e.g. 'semantic'
Returns:
Type | Description |
---|---|
string |