ManticoreSearch.Provider 1.3.1

dotnet add package ManticoreSearch.Provider --version 1.3.1
                    
NuGet\Install-Package ManticoreSearch.Provider -Version 1.3.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ManticoreSearch.Provider" Version="1.3.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ManticoreSearch.Provider" Version="1.3.1" />
                    
Directory.Packages.props
<PackageReference Include="ManticoreSearch.Provider" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ManticoreSearch.Provider --version 1.3.1
                    
#r "nuget: ManticoreSearch.Provider, 1.3.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ManticoreSearch.Provider@1.3.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ManticoreSearch.Provider&version=1.3.1
                    
Install as a Cake Addin
#tool nuget:?package=ManticoreSearch.Provider&version=1.3.1
                    
Install as a Cake Tool

ManticoreProvider

Manticore Search – easy-to-use open-source fast database for search

Initial release of ManticoreSearch.Provider providing API integration with ManticoreSearch for .NET applications. This version includes features for full-text search, autocomplete, fuzzy search, basic CRUD operations, support for custom queries and filters, and flexible indexing and query expansion options. Designed to simplify ManticoreSearch integration in .NET projects.

Note: If you find errors or bugs in the library, please write in the issues section

Usage

Creating an Instance

Create an instance of ManticoreProvider, specifying the base address of Manticore Search. If the address is not specified, http://localhost:9308 will be used by default.

var provider = new ManticoreProvider(); // defaults to http://localhost:9308
// or
var provider = new ManticoreProvider("http://your-manticore-address");

Executing SQL Queries

To execute an SQL query, use the Sql method or its asynchronous variant SqlAsync:

string result = provider.Sql("SELECT * FROM your_index");
// or
string resultAsync = await provider.SqlAsync("SELECT * FROM your_index");

Inserting Documents

To insert documents into the index, use the Insert method or InsertAsync:

var request = new ModificationRequest<TestIndex>
{
    Index = "test_index",
    Id = 10,
    Document = new TestIndex
    {
        Title = "Test Document",
        Content = "This is a test content" ,
        Price = 19.99f,
    }
};

var result = await provider.InsertAsync(request);

Bulking Documents

To perform bulk upload of documents use Bulk method or BulkAsync:

var bulkRequests = new List<BulkInsertRequest<TestIndex>>
{
    new (new ModificationRequest<TestIndex>
    {
        Index = "test_index",
        Id = 1001,
        Document = new TestIndex
        {
            Title = "Bulk Test Document 2",
            Content = "Content for bulk test 2",
            Price = 20.99f
        }
    }),
    new (new ModificationRequest<TestIndex>
    {
        Index = "test_index",
        Id = 1002,
        Document = new TestIndex
        {
            Title = "Bulk Test Document 3",
            Content = "Content for bulk test 3",
            Price = 30.99f
        }
    })
};

var result = await provider.BulkAsync(bulkRequests);

Replacement of Documents

To replace documents, use Replace method or ReplaceAsync:

var replaceRequest = new ModificationRequest<TestIndex>
{
    Index = "test_index",
    Id = 3000,
    Document = new TestIndex
    {
        Title = "Updated Title",
        Content = "Updated Content",
        Price = 19.99f
    }
};

var result = await provider.ReplaceAsync(replaceRequest);

Bulk Replacement of Documents

To perform a bulk document replacement, use BulkReplace method or BulkReplaceAsync:

var bulkRequests = new List<BulkReplaceRequest<TestIndex>>
{
    new (new ModificationRequest<TestIndex>
    {
        Index = "test_index",
        Id = 1,
        Document = new TestIndex
        {
            Title = "Updated Document 1",
            Content = "Updated content for document 1",
            Price = 25.99f,
            Category = "updated"
        }
    }),
    new (new ModificationRequest<TestIndex>
    {
        Index = "test_index",
        Id = 2,
        Document = new TestIndex
        {
            Title = "Updated Document 2",
            Content = "Updated content for document 2",
            Price = 35.99f,
            Category = "updated"
        }
    })
};

var result = await provider.BulkReplaceAsync(bulkRequests);

Updating Documents

To update documents, use Update method or UpdateAsync:

var doc = new UpdateRequest<Products>
{
    Index = "products",
    Document = new Products
    {
        Title = "book"
    },
    Query = new Query
    {
        Equals = new Dictionary<string, object>
        {
            { "price", 25 }
        }
    }
};

var result = provider.Update(doc);

Bulk Updating Documents

To update documents, use BulkUpdate method or BulkUpdateAsync:

var insertRequest = new ModificationRequest<TestIndex>
{
    Index = "test_index",
    Id = 13,
    Document = new TestIndex
    {
        Title = "Title",
        Content = "Content"
    }
};

await provider.InsertAsync(insertRequest);

var bulkRequests = new List<BulkUpdateRequest<TestIndex>>
{
    {
        new BulkUpdateRequest<TestIndex>
        {
            Update = new UpdateRequest<TestIndex>
            {
                Index = "test_index",
                Id = 13,
                Document = new TestIndex
                {
                    Title = "First Update",
                    Content = "First content"
                }
            }
        }
    }
};

var result = await provider.BulkUpdateAsync(bulkRequests);

Search by Documents

To search documents, use Search method or SearchAsync:

var searchRequest = new SearchRequest(
    index: "test_index",
    query: new Query
    {
        Match = new Dictionary<string, object>
        {
            { "content", new { query = "comprehensive test" } }
        }
    },
    source: new { includes = new List<string> { "id", "title", "content" } },
    profile: true,
    limit: 20,
    offset: 5,
    size: 15,
    from: 0,
    maxMatches: 100,
    sort: new List<object> { new { content = "desc" } },
    options: new OptionDetails
    {
        MaxMatches = 1000,
        Ranker = RankerOption.Bm25,
        Threads = 4
    },
    highlight: new HighlightOptions
    {
        BeforeMatch = "<b>",
        AfterMatch = "</b>",
        Limit = 3
    },
    trackScores: true
);

var result = await provider.SearchAsync(searchRequest);

Deleting Documents

To delete documents, use Delete method or DeleteAsync:

var request = new DeleteRequest
{
    Index = "products",
    Query = new Query
    {
        Equals = new Dictionary<string, object>
        {
            { "title", "book" }
        }
    }
};

var result = await provider.DeleteAsync(doc);

Bulk Deletion of Documents

To perform bulk deletion of documents use BulkDelete method or BulkDeleteAsync:

var request = new List<BulkDeleteRequest>
{
    {
        new BulkDeleteRequest
        {
            Delete = new DeleteRequest
            {
                Index = "test_index",
                Id = 1
            }
        }
    },
    {
        new BulkDeleteRequest
        {
            Delete = new DeleteRequest
            {
                Index = "test_index",
                Id = 2
            }
        }
    }
};

var result = await provider.BulkDeleteAsync(request);

Working with Percolators

To index and search using percolators, use the IndexPercolate, Percolate, GetPercolate and UpdatePercolate methods and their asynchronous versions:

var percolate = new PercolateRequest<Products>
{
    Query = new PercolateRequestQuery<Products>
    {
        Percolate = new PercolateDocument<Products>
        {
            Documents =
            [
                new Products
                {
                    Title = "chocolate"
                },
                new Products
                {
                    Title = "banana"
                }
            ]
        }
    }
};

var result = await provider.PercolateAsync(percolate, "mypq");

Autocomplete request

Retrieves autocomplete suggestions based on the provided autocomplete query. Use the Autocomplete or AutocompleteAsync methods:

var request = new AutocompleteRequest
{
    Index = "articles",
    Query = "Tr"
};

var result = await provider.AutocompleteAsync(request);

Mapping request

Defines a new table structure in Manticore search engine using the specified mapping properties, mimicking Elasticsearch-like table definitions. Use the UseMapping or UseMappingAsync methods:

var request = new MappingRequest
{
    Properties = new Dictionary<string, MappingField>
    {
        { "exercise", new MappingField { Type = MappingFieldType.Keyword } },
        { "working_weight", new MappingField { Type = MappingFieldType.Integer } },
        { "weight_limit", new MappingField { Type = MappingFieldType.Integer } }
    }
};

var result = await provider.UseMappingAsync(request, "training");

Exceptions

  • AutocompleteException — on Autocomplete request error.
  • BulkException — on Bulk request error.
  • DeleteException — on Delete request error.
  • MappingException — on Mapping request error.
  • ModificationException — on Modification request error.
  • PercolateException — on Percolate request error.
  • SearchException — on Search request error.
  • SqlException — on SQL request error.
  • UpdateException — on Update request error.

Cleanup

Remember to release resources by calling the Dispose method when you are done using ManticoreProvider.

provider.Dispose();
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.3.1 4 9/8/2025
1.3.0 89 9/5/2025
1.2.4 124 9/4/2025
1.2.3 172 5/6/2025
1.2.2 171 2/7/2025
1.2.1 147 11/5/2024

service collection extensions