Options
All
  • Public
  • Public/Protected
  • All
Menu

Allows repetitive quick searches against a specific Flex data. Unlike a LiveQuery, this result set does not subscribe to any updates and therefore receives no events beyond the initial result set.

Use the SyncClient.instantQuery method to create an Instant Query.

Hierarchy

  • EventEmitter
    • InstantQuery

Index

Events

Static Readonly searchResult

searchResult: "searchResult" = 'searchResult'

Fired when a search result is ready.

Parameters:

  1. ItemsSnapshot items - a snapshot of items matching current query expression.
example
instantQuery.on('searchResult', (items) => {
   Object.entries(items).forEach(([key, value]) => {
     console.log('Search result item key:', key);
     console.log('Search result item value:', value);
   });
});

Methods

search

  • search(queryExpression: string): Promise<void>
  • Spawns a new search request. The result will be provided asynchronously via the InstantQuery.searchResult event.

    Parameters

    • queryExpression: string

      A query expression to be executed against the given data index. For more information on the syntax read SyncClient.liveQuery.

    Returns Promise<void>

    A promise that resolves when query result has been received.

subscribe

  • Instantiates a LiveQuery object based on the last known query expression that was passed to the InstantQuery.search method. This LiveQuery will start receiving updates with new results, while current object can be still used to execute repetitive searches.

    Returns Promise<LiveQuery>

    A promise which resolves when the LiveQuery object is ready.

updateIndexName

  • updateIndexName(indexName: string): void
  • Set new index name

    Parameters

    • indexName: string

      New index name to set

    Returns void