indexedBox method

IndexedBox<K, T> indexedBox({
  1. required String searchableText(
    1. T
    ),
  2. Analyzer analyzer = Analyzer.prefix,
  3. TextAnalyzer<T>? overrideAnalyzer,
  4. bool matchAllTokens = true,
  5. int tokenCacheCapacity = 512,
  6. bool verifyMatches = false,
  7. int keyComparator(
    1. K a,
    2. K b
    )?,
})

Creates an IndexedBox using this BoxConfig.

  • searchableText: A function that extracts the text to be indexed from each value.
  • analyzer: The Analyzer strategy to use for tokenizing text (default: Analyzer.prefix).
  • overrideAnalyzer: Optionally provide a custom TextAnalyzer for advanced tokenization.
  • matchAllTokens: If true, all tokens must match for a result (default: true).
  • tokenCacheCapacity: Maximum number of tokenized results to cache (default: 512).
  • verifyMatches: If true, verifies that search results actually match the query (default: false).
  • keyComparator: Optional comparator for sorting keys in search results.

Returns a fully configured IndexedBox instance.

Implementation

IndexedBox<K, T> indexedBox({
  required String Function(T) searchableText,
  Analyzer analyzer = Analyzer.prefix,
  TextAnalyzer<T>? overrideAnalyzer,
  bool matchAllTokens = true,
  int tokenCacheCapacity = 512,
  bool verifyMatches = false,
  int Function(K a, K b)? keyComparator,
}) {
  return IndexedBox<K, T>(
    name,
    type: type,
    encryptionCipher: encryptionCipher,
    crashRecovery: crashRecovery,
    path: path,
    collection: collection,
    logger: logger,
    analyzer: analyzer,
    overrideAnalyzer: overrideAnalyzer,
    searchableText: searchableText,
    matchAllTokens: matchAllTokens,
    tokenCacheCapacity: tokenCacheCapacity,
    verifyMatches: verifyMatches,
    keyComparator: keyComparator,
  );
}