search method

Set<String>? search(
  1. String query
)

Matches a whitespace-separated case-insensitive query against the latest committed index version.

Returns the matching stable record ids, or null without a query.

Implementation

Set<String>? search(String query) {
  final terms = query
      .trim()
      .toLowerCase()
      .split(RegExp(r'\s+'))
      .where((term) => term.isNotEmpty)
      .toList();
  if (terms.isEmpty) return null;
  return {
    for (final entry in _entries.entries)
      if (terms.every(entry.value.text.contains)) entry.key,
  };
}