searchChunked method

Stream<QueryResult> searchChunked(
  1. {Query query,
  2. Reach reach = Reach.server}
)

Searches documents and returns the snapshots in chunks, which means that the snapshots don't have to be kept to the memory at the same time.

Optional argument queryString defines a query string. The syntax is based on Lucene query syntax. For a description of the syntax, see SearchQueryParser.

Optional argument filter defines a filter.

If both queryString and filter are non-null, the database will receive an AndFilter that contains both the parsed filter and the other filter.

Optional argument skip defines how many snapshots to skip in the beginning. The default value is 0.

You should usually give optional argument take, which defines the maximum number of snapshots in the results.

An example:

final stream = database.searchChunked(
  query: Query.parse(
    'cat OR dog',
    skip: 0,
    take: 1,
  ),
);

Implementation

Stream<QueryResult> searchChunked({
  Query query,
  Reach reach = Reach.server,
}) async* {
  // TODO: Real implementation
  final all = await search(
    query: query,
    reach: reach,
  );
  yield (all);
}