rebuildIndex method

Future<void> rebuildIndex({
  1. bool force = false,
})

Rebuild the HNSW index after adding documents.

Call this after adding one or more documents for optimal search performance. The index enables fast approximate nearest neighbor search. force - If true, rebuilds even if no changes were detected (default: false).

Implementation

Future<void> rebuildIndex({bool force = false}) {
  _indexDebounceTimer
      ?.cancel(); // Cancel any pending auto-rebuild since we are doing it now
  _indexDebounceTimer = null;
  return _ragService.rebuildIndex(
    force: force,
  ); // Service handles dirty check
}