DMMRSuggestionEngine 0.1.7
dotnet add package DMMRSuggestionEngine --version 0.1.7
NuGet\Install-Package DMMRSuggestionEngine -Version 0.1.7
<PackageReference Include="DMMRSuggestionEngine" Version="0.1.7" />
<PackageVersion Include="DMMRSuggestionEngine" Version="0.1.7" />
<PackageReference Include="DMMRSuggestionEngine" />
paket add DMMRSuggestionEngine --version 0.1.7
#r "nuget: DMMRSuggestionEngine, 0.1.7"
#:package DMMRSuggestionEngine@0.1.7
#addin nuget:?package=DMMRSuggestionEngine&version=0.1.7
#tool nuget:?package=DMMRSuggestionEngine&version=0.1.7
DMMR Suggestion Engine
A high-performance fuzzy search and hybrid suggestion engine for .NET.
DMMR Suggestion Engine combines BK-Tree indexing, N-Gram search, hybrid OpenSearch integration, similarity metrics, and an extensible filter pipeline to deliver fast, relevant, and customizable search suggestions.
Designed for:
- Product Search
- Autocomplete
- Search Suggestions
- Typo Correction
- Recommendation Systems
- Hybrid Search
- AI Search Pipelines
Installation
dotnet add package DMMRSuggestionEngine
Features
- ✅ BK-Tree fuzzy search
- ✅ Character N-Gram indexing
- ✅ Typo-tolerant search
- ✅ Weighted ranking
- ✅ Built-in LRU cache
- ✅ Generic type-safe API
- ✅ Hybrid OpenSearch search
- ✅ ReadOnlySpan optimized algorithms
- ✅ Low memory allocations
- ✅ Extensible filter pipeline
- ✅ Async APIs
- ✅ .NET 9
Quick Start
using DMMRSuggestionEngine;
var engine = new DMMRSuggestionEngine<(int Id, string Name, float Weight)>();
engine.LoadData(
new[]
{
(1, "iPhone 16 Pro Max", 100f),
(2, "Samsung Galaxy S25 Ultra", 80f),
(3, "Motorola Edge 60", 50f)
},
x => x.Name,
x => x.Weight);
var results = engine.Suggest("iphon");
N-Gram Search
The built-in N-Gram index complements BK-Tree search by handling queries such as:
| Query | Result |
|---|---|
Pro Max |
iPhone 16 Pro Max |
Galaxy Samsung |
Samsung Galaxy S25 Ultra |
Motorola E |
Motorola Edge 60 |
Configuration:
engine.NgramConfig.Enabled = true;
engine.NgramConfig.N = 3;
engine.NgramConfig.MinScore = 0.2f;
Hybrid OpenSearch
using DMMRSuggestionEngine.OpenSearch;
using OpenSearch.Client;
var client = new OpenSearchClient(
new ConnectionSettings(
new Uri("http://localhost:9200")));
var hybrid = new DMMROHybridSearchService(
client,
"products");
var results = await hybrid.HybridSearchAsync(
"iphone",
embedding);
Features:
- Local + Distributed Search
- Async Search
- CancellationToken support
- Vector Search
- OpenSearch Integration
Filter Pipeline (v0.1.7)
Hybrid search supports an extensible post-processing pipeline.
Multiple filters can be chained to refine search results.
using DMMRSuggestionEngine.OpenSearch.Filters;
service.AddFilter(new MinWeightFilter(50));
service.AddFilter(new CosineSimilarityFilter(0.40f));
service.AddFilter(new AbortIfEmptyFilter());
var results = await service.HybridSearchAsync(
"laptop",
embedding);
Built-in filters:
| Filter | Purpose |
|---|---|
| CosineSimilarityFilter | Minimum cosine similarity |
| MinWeightFilter | Minimum item weight |
| AbortIfEmptyFilter | Stops the pipeline if no results remain |
| DelegateFilter | Lambda-based custom filter |
Create Your Own Filters
The pipeline is fully extensible.
Simply implement IPostFilter.
public class MyFilter : IPostFilter
{
public List<SuggestionDocument> Apply(
List<SuggestionDocument> results,
SearchContext context,
out bool continueProcessing)
{
continueProcessing = true;
// Custom business rules
return results;
}
}
Register it:
service.AddFilter(new MyFilter());
This makes it easy to implement:
- Inventory filtering
- Category filtering
- Region restrictions
- Customer segmentation
- Logging
- Metrics
- Business rules
- Deduplication
- Any custom post-processing
Performance
Designed for:
- Low latency
- Low allocations
- High throughput
- Large datasets
Typical search latency:
| Dataset | Median |
|---|---|
| 1,000 items | ~0.05 ms |
| 10,000 items | ~0.08 ms |
| 100,000 items | ~0.10 ms |
Main Components
- BK-Tree
- Character N-Gram Index
- Levenshtein Distance
- Cosine Similarity
- Pearson Correlation
- Jaccard Similarity
- Euclidean Distance
- Manhattan Distance
- LRU Cache
- OpenSearch Hybrid Search
- Filter Pipeline
Why DMMR?
Unlike traditional fuzzy search libraries, DMMR combines multiple search strategies into a single engine:
- Fast typo correction
- Partial phrase matching
- Hybrid local/distributed search
- Vector similarity
- Extensible post-processing pipeline
- Performance-oriented implementation
- Minimal allocations
- Generic API
License
MIT
Author
Alessandro Silveira
Software Architect • DevOps Tech Leader • Performance-Oriented Systems Engineer
GitHub:
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net9.0
- OpenSearch.Client (>= 1.8.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.