getStats method

Future<DatabaseStats> getStats()

Implementation

Future<DatabaseStats> getStats() async {
  final totalDocs = documentBox.count();
  final totalChunks = chunkBox.count();
  // This is an approximation of content length
  final allDocs = documentBox.getAll();
  final totalContentLength = allDocs.fold<int>(0, (sum, doc) => sum + doc.content.length);

  return DatabaseStats(
    totalDocuments: totalDocs,
    documentsWithEmbeddings: totalChunks, // Represents chunks with embeddings
    totalContentLength: totalContentLength,
  );
}