FAISSDocumentStore<T>

Models & Types · AiDotNet.RetrievalAugmentedGeneration.DocumentStores

In-memory, brute-force document store that mimics FAISS-style integer indexing. This is NOT the native FAISS library.

Inheritance: DocumentStoreBase<T> → FAISSDocumentStore<T>

For Beginners

FAISS is Facebook’s ultra-fast vector search library.

Think of it like a specialized phone book for vectors:

  • Each document gets a unique number (index)
  • Vectors are stored separately for faster search
  • Can handle millions of vectors efficiently

This in-memory version is good for:

  • Testing FAISS-style indexing patterns
  • Medium-sized collections (< 100K documents)
  • Prototyping before deploying real FAISS

Real FAISS provides:

  • GPU acceleration for billion-scale search
  • Advanced indexing (IVF, HNSW, Product Quantization)
  • Sub-millisecond search on huge datasets

How It Works

Looking for real FAISS? This type is a dependency-free, pure-managed simulation: every query is an exact O(n) brute-force cosine scan, so it does not deliver FAISS-level ANN throughput. For a genuine native FAISS backend with IVF / HNSW / PQ indexes, reference the opt-in AiDotNet.Storage.Faiss package and use AiDotNet.RetrievalAugmentedGeneration.DocumentStores.FaissDocumentStore<T> (note the Pascal-cased name). This in-memory type is retained for tests, prototyping, and environments where the native FAISS runtime is unavailable.

This implementation provides an in-memory simulation of Facebook AI Similarity Search (FAISS), using integer-based indexing for fast vector lookup. It maintains both document storage and a separate index mapping for optimized retrieval operations.

Constructors

Constructor Summary
FAISSDocumentStore(int initialCapacity) Initializes a new instance of the FAISSDocumentStore class.

Properties

Property Summary
int DocumentCount { get; } Gets the number of documents currently stored.
int VectorDimension { get; } Gets the dimensionality of vectors stored in this index.

Methods

Method Summary
void Clear() Removes all documents from the store and resets all indices.