searchBundle method

Future<KnowledgeBundleSearch> searchBundle(
  1. ProjectBundle bundle,
  2. String query, {
  3. int limit = 5,
  4. KnowledgeMetadataFilter? filters,
  5. StaleIndexPolicy stale = StaleIndexPolicy.refuse,
  6. WayfinderCancellation? cancel,
})

Searches the saved index of one bundle, with its own context policy rather than a project's shared ranking. stale and cancel are as for search.

Implementation

Future<KnowledgeBundleSearch> searchBundle(
  ProjectBundle bundle,
  String query, {
  int limit = 5,
  KnowledgeMetadataFilter? filters,
  StaleIndexPolicy stale = StaleIndexPolicy.refuse,
  WayfinderCancellation? cancel,
}) => _admit(
  limit: limit,
  () => _encoding((acquire) async {
    throwIfCancelled(cancel);
    final found = await _searchIndex(
      await _namespace(bundle),
      query,
      limit: limit,
      filters: filters,
      stale: stale,
      cancel: cancel,
      encoder: acquire,
    );
    return KnowledgeBundleSearch(
      bundle,
      found.response,
      freshness: found.freshness,
    );
  }),
);