search abstract method

Future<SearchResult> search(
  1. String query, {
  2. int limit = 20,
  3. int offset = 0,
  4. CancellationToken? cancellationToken,
})

Performs a search operation.

Returns a SearchResult containing items matching the query. The optional limit parameter controls the maximum number of results to return. The offset parameter enables pagination.

The cancellationToken parameter allows cancelling long-running searches when the user types a new query. This prevents memory leaks and race conditions. If cancelled, implementations should return an empty result or throw CancelledException.

This method is called when the user submits a search query. It should perform the actual search logic and return matching items.

Implementation

Future<SearchResult> search(
  String query, {
  int limit = 20,
  int offset = 0,
  CancellationToken? cancellationToken,
});