Core
Write Plugins v1.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

Koncorde #

Available since 1.6.0

Instantiates a new Koncorde engine.


Constructor #

This class constructor takes no argument.


exists #

Returns a boolean telling whether filters exist for an index-collection pair.

Arguments #

exists(index, collection);

ArgumentsTypeDescription
index
string
Index name
collection
string
Collection name

Return #

The exists function returns a boolean telling whether at least one filter exists in the provided index-collection pair.


getFilterIds #

Retrieves the list of filter identifiers registered on an index-collection pair.

Arguments #

getFilterIds(index, collection);

ArgumentsTypeDescription
index
string
Index name
collection
string
Collection name

Return #

The getFilterIds function returns an array of strings, containing the exhaustive list of filter identifiers registered in the provided index-collection pair.


normalize #

Available since 1.1.0

Normalizes filters without storing them.

The result can be directly used with the store function.

Arguments #

normalize(index, collection, filters);

ArgumentsTypeDescription
index
string
Index name
collection
string
Collection name
filters
object
Filters, in Koncorde format

Return #

The normalize function returns a promise resolving to an object with the following properties:

FieldTypeDescription
collection
string
Collection name
id
string
The filter unique identifier
index
string
Index name
normalized
object[]
Normalized/optimized version of the supplied filters

register #

Registers a filter to this Koncorde instance.

This method is equivalent to executing normalize + store.

Arguments #

register(index, collection, filters);

ArgumentsTypeDescription
index
string
Index name
collection
string
Collection name
filters
object
Filters, in Koncorde format

Return #

The register functions returns a promise, resolving to an object with the following attributes:

FieldTypeDescription
id
string
The filter unique identifier
diff
object
If the filter doesn't already exist in the engine, contains the normalized version of the provided filters

remove #

Removes a filter.

Arguments #

remove(filterId);

ArgumentsTypeDescription
filterId
string
Filter unique identifier, obtained either with normalize or register

Return #

The remove function returns a promise, resolved once the filter has been completely removed from Koncorde.


store #

Available since 1.1.0

Stores filters, normalized with the normalize) function.

Arguments #

store(normalized);

ArgumentsTypeDescription
normalized
object
Normalized filters

Return #

The store function returns an object with the following attributes:

FieldTypeDescription
id
string
The filter unique identifier
diff
object
If the filter didn't already exist, contains the normalized version of the provided filters

test #

Tests data and returns the matching filter identifiers.

Arguments #

test(index, collection, data, [documentId]);

ArgumentsTypeDescription
index
string
Index name
collection
string
Collection name
data
object
Data to test
documentId
string
Document unique identifier

Return #

The test function returns an array of strings, which is the exhaustive list of matching filter identifiers.


validate #

Validates the provided filters without storing them.

Arguments #

validate(filters);

ArgumentsTypeDescription
filters
object
Filters, in Koncorde format

Return #

The validate function returns a promise, which is resolved if the filters are well-formed, and rejected otherwise.