FluxIndex.Storage.PostgreSQL
0.19.0
dotnet add package FluxIndex.Storage.PostgreSQL --version 0.19.0
NuGet\Install-Package FluxIndex.Storage.PostgreSQL -Version 0.19.0
<PackageReference Include="FluxIndex.Storage.PostgreSQL" Version="0.19.0" />
<PackageVersion Include="FluxIndex.Storage.PostgreSQL" Version="0.19.0" />
<PackageReference Include="FluxIndex.Storage.PostgreSQL" />
paket add FluxIndex.Storage.PostgreSQL --version 0.19.0
#r "nuget: FluxIndex.Storage.PostgreSQL, 0.19.0"
#:package FluxIndex.Storage.PostgreSQL@0.19.0
#addin nuget:?package=FluxIndex.Storage.PostgreSQL&version=0.19.0
#tool nuget:?package=FluxIndex.Storage.PostgreSQL&version=0.19.0
FluxIndex
RAG library for .NET 10.0 - Build semantic search and retrieval systems with vector + keyword hybrid search.
Key Features
- Hybrid Search - Vector (semantic) + Keyword (BM25) with automatic strategy selection
- High Performance - Embedding cache (100% faster), batch indexing (24ms/1K chunks)
- Local Reranking - Cross-encoder neural reranking with automatic algorithmic fallback
- Graph Traversal - BFS/DFS, Dijkstra shortest path, PageRank-style importance
- Vector Quantization - Scalar (Int8/Int4), Product Quantization, Binary (32x compression)
- Multiple Storage - SQLite, PostgreSQL with pgvector
- AI Provider Agnostic - Core provides abstract base classes, bring your own embedding service
- Document Processing - PDF/DOCX/TXT via FileFlux, web crawling via WebFlux
- MCP Server - Model Context Protocol for AI assistant integration
- Production Ready - Redis caching, clean architecture, .NET 10.0
Quick Start
dotnet add package FluxIndex.SDK
dotnet add package FluxIndex.Storage.SQLite
using FluxIndex.SDK;
using FluxIndex.Storage.SQLite;
// 1. Setup (InMemory embedding for testing)
// UseSQLite() selects the provider; AddSQLiteStorage() registers it. Both are required —
// Build() throws if you name a store without registering it.
var context = FluxIndexContext.CreateBuilder()
.UseSQLite("fluxindex.db")
.AddSQLiteStorage()
.Build();
// 2. Index
await context.Indexer.IndexDocumentAsync(
"FluxIndex is a RAG library for .NET", "doc-001");
// 3. Search
var results = await context.Retriever.SearchAsync("RAG library", maxResults: 5);
Note (testing embedder): without a registered
IEmbeddingServicethe builder falls back toInMemoryEmbeddingService, whose vectors are deterministic but not semantically meaningful — similarity scores cluster near 0, so with the defaultminScorea search typically returns no results. PassminScore: 0while smoke-testing, and register a real embedding service (below) for meaningful retrieval.
Using Custom Embedding Service
FluxIndex is AI provider-agnostic. Extend EmbeddingServiceBase for your preferred provider:
// Example: LMSupply embedding (local ONNX-based, no API key)
public class LMSupplyEmbedder : EmbeddingServiceBase, IAsyncDisposable
{
private readonly IEmbeddingModel _model;
private LMSupplyEmbedder(IEmbeddingModel model) => _model = model;
public static async Task<LMSupplyEmbedder> CreateAsync(string modelId = "default")
{
var model = await LocalEmbedder.LoadAsync(modelId);
return new LMSupplyEmbedder(model);
}
protected override async Task<float[]> EmbedCoreAsync(string text, CancellationToken ct)
=> await _model.EmbedAsync(text, ct);
public override int GetEmbeddingDimension() => _model.Dimensions;
public override string GetModelName() => _model.ModelId;
public ValueTask DisposeAsync() => _model.DisposeAsync();
}
// Register and use
var context = FluxIndexContext.CreateBuilder()
.UseSQLite("fluxindex.db")
.AddSQLiteStorage()
.ConfigureServices(s => s.AddSingleton<IEmbeddingService>(
LMSupplyEmbedder.CreateAsync().GetAwaiter().GetResult()))
.Build();
MCP Server
FluxIndex provides Model Context Protocol (MCP) server for AI assistant integration.
Available Tools: search, memorize, unmemorize, status
See FluxIndex.MCP for integration details.
Performance
| Operation | Performance | Notes |
|---|---|---|
| Batch Indexing | 24ms/1K chunks | 8-thread parallelism |
| Vector Search | 0.6ms/query | In-memory embeddings |
| Embedding Cache | 100% faster | Eliminates API calls |
| Semantic Cache | <5ms | Redis, 95% similarity |
Full benchmarks: BENCHMARK_RESULTS.md
Package Structure
Moved: File-to-vector synchronization (formerly
FluxIndex.Extensions.FileVault) was extracted to the FluxFeed repository in 0.16.0. InstallFluxFeedfor git-like file tracking / folder-monitoring document ingestion; it feeds into FluxIndex.
Storage capability matrix
Metadata filtering (SearchAsync(..., filters:)) is honored by every store — stores without
native pushdown fall back to a correctness backstop applied before the topK trim. Native pushdown
matters for recall/performance at scale:
| Store | Search metadata filter | DeleteByFilterAsync |
Notes |
|---|---|---|---|
| PostgreSQL | ✅ native (jsonb @>) |
✅ single SQL DELETE | Add a GIN index on Metadata for large collections: CREATE INDEX ON vectors USING gin (metadata jsonb_path_ops); |
| Qdrant | ✅ native (payload filter) | ✅ | Payload indexes created on startup |
| SQLite (sqlite-vec) | ✅ post-KNN with over-fetch | ✅ | vec0 cannot index metadata; KNN window is widened ×3 when filters are present |
| SQLite (in-memory scan) | ✅ pre-trim | ✅ | Full scan store |
| InMemory (SDK) | ✅ pre-trim | ✅ |
Filter semantics: equality on every key/value pair (AND). Values compare by their JSON text
representation ("true", invariant-culture numbers, ordinal strings). The same semantics apply in
the SDK's Retriever, so a value that round-trips through a JSON column still matches the raw value
you filter on.
Filters match chunk metadata. The metadata argument of Indexer.IndexDocumentAsync(content, documentId, metadata) and IndexChunksAsync(chunks, documentId, metadata) is copied onto that
document's chunks for exactly this reason — a chunk's own metadata wins on key collision:
await context.Indexer.IndexDocumentAsync(
"tenant content", "doc-001", new() { ["workspace_id"] = "ws-a" });
var scoped = await context.Retriever.SearchAsync(
"content", filter: new() { ["workspace_id"] = "ws-a" });
await vectorStore.DeleteByFilterAsync(new() { ["workspace_id"] = "ws-a" });
Limitation (keyword leg):
HybridSearchAsync/KeywordSearchAsyncresolve their BM25 leg throughIDocumentRepository, which currently has an in-memory implementation only. With a persistent store the keyword leg therefore sees only documents this process indexed, and after a restart hybrid search effectively degrades to vector-only. Vector search and metadata filtering are unaffected.
Which package do I need?
| Scenario | Packages |
|---|---|
| Embeddings + vector search only (no native deps, no document parsing) | FluxIndex.Core + storage |
| Full RAG pipeline (PDF, DOCX, HWP, web crawling) | FluxIndex.SDK + storage |
| File system monitoring + auto-indexing (document ingestion) | FluxFeed (feeds into FluxIndex) |
| Local AI embedding (ONNX, no API key required) | FluxIndex.Providers.LMSupply |
Minimal setup — bring your own embedding service, no native binaries:
dotnet add package FluxIndex.Core
dotnet add package FluxIndex.Storage.SQLite
Full SDK — includes document processing (PDF, DOCX, HWP, web crawling):
dotnet add package FluxIndex.SDK
dotnet add package FluxIndex.Storage.SQLite
Documentation
- Guide - Quick start and configuration
- Reference - Architecture and API reference
- Advanced RAG - HyDE, Contextual Retrieval, Query Expansion
- Philosophy - Core principles and design philosophy
Examples
- RealQualityTest - LMSupply + SQLite integration
- WebFluxSample - Web crawling with WebFlux
- ChunkingQualityTest - FileFlux chunking analysis
- FileFluxIndexSample - Document indexing workflow
Requirements
- .NET 10.0 or later
- SQLite or PostgreSQL
License
MIT License - see LICENSE file.
Contributing
Contributions are welcome! Please feel free to submit issues and pull requests.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- FluxIndex.Core (>= 0.19.0)
- FluxIndex.SDK (>= 0.19.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.8)
- Microsoft.Extensions.Hosting (>= 10.0.8)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.8)
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 10.0.1)
- Pgvector.EntityFrameworkCore (>= 0.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.19.0 | 6 | 7/18/2026 |
| 0.18.0 | 35 | 7/17/2026 |
| 0.17.1 | 35 | 7/17/2026 |
| 0.17.0 | 104 | 7/3/2026 |
| 0.16.0 | 97 | 7/2/2026 |
| 0.15.0 | 106 | 6/28/2026 |
| 0.14.0 | 108 | 6/19/2026 |
| 0.13.21 | 112 | 6/15/2026 |
| 0.13.20 | 116 | 6/15/2026 |
| 0.13.19 | 102 | 6/9/2026 |
| 0.13.18 | 112 | 6/1/2026 |
| 0.13.16 | 110 | 5/31/2026 |
| 0.13.15 | 117 | 5/28/2026 |
| 0.13.14 | 115 | 5/21/2026 |
| 0.13.13 | 108 | 5/20/2026 |
| 0.13.12 | 123 | 5/19/2026 |
| 0.13.11 | 108 | 5/15/2026 |
| 0.13.10 | 103 | 5/15/2026 |
| 0.13.8 | 114 | 5/12/2026 |
| 0.13.7 | 108 | 5/11/2026 |