Articles

Adding search to your .NET app

Drop the IndxSearchLib NuGet package into a C# project and run your first typo-tolerant search in a few minutes. Updated for Indx 6.

Guide

Indx runs inside your .NET process. There is no search server to run and no analyzer, tokenizer or stemmer to choose: you say which fields are searched, and typos and half-typed words are handled. This guide takes you from an empty project to your first filtered search.

Updated 20 November 2026 for Indx 6.

Install

IndxSearchLib 6.0 is in beta on NuGet, for .NET 10:

dotnet add package IndxSearchLib --prerelease

Load your JSON and say what is searched

Indx works on a JSON array of objects, nested ones included. Init reads the structure and finds the fields. Nothing is searched until you give a field a role.

using Indx.Api;

var engine = new SearchEngine();

using var stream = File.OpenRead("products.json");
engine.Init(stream);

var name = engine.GetField("name")!;
name.WordMatching    = true;                          // its whole words, typos and all
name.PatternMatching = PatternMatchingSetup.Default;  // and inside its words
name.Weight          = 2.0f;                          // counts for more than other fields

var category = engine.GetField("category")!;
category.Filterable = true;
category.Facetable  = true;

A searched field usually gets both roles: whole words, matched as typed or within a typo, and pattern matching inside the words, so part of a word is enough. One typo a word is the default; a field that should forgive more, such as long product names, can allow up to three:

name.Tolerance = Tolerance.ThreeEdits;                       // what the field allows
var query = new Query("hedphnes", 20) { Match = { Tolerance = Tolerance.ThreeEdits } };  // and the search

A field can hold several roles at once: here category both narrows results and counts its values for a filter panel.

Index

Stream the same JSON again to load the records, then build the index:

stream.Position = 0;
engine.Load(stream);
engine.Index();

The engine is ready. From here you can insert, update and delete records one by one, and each change is searchable at once.

var result = engine.Search(new Query("wirless hedphones", 20)); // typos are fine

foreach (var record in result.Records)
    Console.WriteLine(engine.GetJsonDataOfKey(record.DocumentKey));

A search returns keys and scores, not whole documents, so the list stays light; fetch the JSON for the ones you show. result.Count is how many records answer the search, and the facets count the same records.

"wirless hedphones" finds the Wireless Headphones. No tuning, no list of misspellings.

Filter

Filters run inside the search, over the whole dataset. Never filter the returned list yourself: it only holds the rows you asked for, so you would miss matches.

var audio = engine.CreateValueFilter("category", "audio", out _);
var result = engine.Search(new Query("wireless", 20) { Filter = audio });

Or write the whole condition as one expression:

var filter = engine.CreateFilter("category = \"audio\" AND price BETWEEN 0 AND 50", out _);

Next steps

More articles

Indx 6 is here, in beta

Word indexing with up to three typos, ranking you control field by field, and faster, leaner search. IndxSearchLib 6.0 and the Indx server 2.0 are both in beta.

Let your coding agent integrate Indx

A skill, agent-readable docs, and a built-in MCP server. Describe what you want searchable, and your agent does the rest. Updated for Indx 6.