Some checks failed
		
		
	
	build-packages / meilisearch-dotnet-packages (push) Has been cancelled
				
			MeiliSearch .NET Embedded
Overview
MeiliSearch .NET Embedded is a powerful NuGet package that seamlessly integrates MeiliSearch into your .NET applications. It provides a robust wrapper around MeiliSearch, handling process management, health monitoring, and advanced features like index compression - all while maintaining compatibility with the native MeiliSearch SDK.
Key Features
- Embedded MeiliSearch Engine: Run MeiliSearch directly within your application
- Automatic Process Management: Handles startup, shutdown, and health monitoring
- Smart Index Management:
- Create and manage indexes with type safety
- Enable/disable indexes on demand
- Automatic compression for optimized storage
 
- Efficient Document Management:
- Batch processing system with configurable thresholds
- Automatic validation of index availability
 
- Resource Monitoring:
- Track memory and CPU usage
- Monitor storage utilization
- Index-specific metrics
 
- Native SDK Compatibility: Full support for the official MeiliSearch SDK
Installation
Via Package Manager Console
Install-Package meilisearch.NET
Via .NET CLI
dotnet add package meilisearch.NET
Quick Start
1. Basic Setup
Add MeiliSearch service to your dependency injection container:
var builder = Host.CreateApplicationBuilder();
builder.Services.AddMeiliSearchService();
2. Configuration
Configure MeiliSearch in your appsettings.json:
{
  "MeiliSearch": {
    "Port": 7700,
    "UiEnabled": true
  }
}
3. Basic Usage
Define Your Document Model
public class Product : IDocument
{
    public string Id { get; set; }
    public string Name { get; set; }
    public string Description { get; set; }
    public decimal Price { get; set; }
}
Create and Manage Indexes
public class SearchService
{
    private readonly MeiliSearchService _searchService;
    public SearchService(MeiliSearchService searchService)
    {
        _searchService = searchService;
    }
    public async Task InitializeProductIndex()
    {
        // Create index
        await _searchService.CreateIndex<Product>("products");
        // Add documents
        var product = new Product 
        {
            Id = "1",
            Name = "Gaming Laptop",
            Description = "High-performance gaming laptop",
            Price = 1299.99m
        };
        
        _searchService.AddDocument("products", product);
    }
}
Using Native MeiliSearch SDK
await _searchService.SDK("products", async client => 
{
    var index = await client.GetIndex("products");
    var searchResults = await index.SearchAsync<Product>("laptop");
    return searchResults;
});
Advanced Usage
Resource Monitoring
var usage = _searchService.GetResourceUsage();
Console.WriteLine($"Memory Usage: {usage.MemoryUsageBytes} bytes");
Console.WriteLine($"CPU Usage: {usage.CpuPercentage}%");
Console.WriteLine($"Storage Usage: {_searchService.GetTotalStorageUsage()} bytes");
Index Management
// Disable an index (automatically compresses)
await _searchService.SetIndexEnabled("products", false);
// Enable an index (automatically decompresses)
await _searchService.SetIndexEnabled("products", true);
// Get all indexes
var indexes = await _searchService.GetAllIndexes();
Best Practices
- 
Resource Management - Always dispose of the MeiliSearchServicewhen your application shuts down
- Monitor resource usage in production environments
 
- Always dispose of the 
- 
Index Management - Disable unused indexes to save resources
- Use type-safe index creation with generic parameters
 
- 
Document Management - Utilize batch processing for bulk operations
- Handle exceptions when adding documents
 
Performance Considerations
- The batch system automatically manages document additions with a default threshold of 100 documents
- Compressed indexes use less storage but require decompression before use
- Monitor resource usage in production environments
Contributing
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
- Create an issue on GitHub
- Contact us on discord 
- Visit our documentation at meilisearchdotnet.d4m13n.dev
Acknowledgments
- Built on top of the excellent MeiliSearch search engine
- Powered by Ollama for AI capabilities
Description
				
								Release 0.4.0
								
	Latest
							
						
					Languages
				
				
								
								
									C#
								
								84.2%
							
						
							
								
								
									PowerShell
								
								15.8%