Skip to main content

FinderQuery

Represents a finder query for retrieving items based on specified parameters. This class encapsulates the query logic, caching mechanism, and result management.

Properties​

cache​

cache: boolean = true

Determines whether the query results should be cached.


result​

readonly result: null | ModelIdMap = null

The result of the query, a map of modelIds to localIds. Null if the query has not been executed or has not been cached.

Accessors​

aggregation​

set aggregation(value): void

Sets the aggregation value (AND/OR) for the query and resets the cache if the new value differs.

Parameters​

ParameterType
valueQueryResultAggregation

queries​

set queries(value): void

The query parameters used to find items.

Parameters​

ParameterType
valueItemsQueryParams[]

Methods​

clearCache()​

clearCache(): void

Clears the cached result of the query, forcing a re-evaluation on the next access.

Returns​

void


fromJSON()​

fromJSON(data): FinderQuery

Deserializes a JSON object into a FinderQuery instance.

Parameters​

ParameterTypeDescription
dataSerializedFinderQueryA SerializedFinderQuery object representing the serialized query.

Returns​

FinderQuery

A FinderQuery instance.


test()​

test(config?): Promise <ModelIdMap>

Executes the finder query to retrieve items based on the configured query and optional model IDs.

Parameters​

ParameterTypeDescription
config?QueryTestConfigOptional configuration object.

Returns​

Promise <ModelIdMap>

A promise that resolves to a ModelIdMap containing the search results.


toJSON()​

toJSON(): SerializedFinderQuery

Serializes the finder query into a JSON-compatible format. Converts regular expressions to strings.

Returns​

SerializedFinderQuery

A SerializedFinderQuery object representing the serialized query.