SearchLite 0.2.1

dotnet add package SearchLite --version 0.2.1                
NuGet\Install-Package SearchLite -Version 0.2.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="SearchLite" Version="0.2.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SearchLite --version 0.2.1                
#r "nuget: SearchLite, 0.2.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.
// Install SearchLite as a Cake Addin
#addin nuget:?package=SearchLite&version=0.2.1

// Install SearchLite as a Cake Tool
#tool nuget:?package=SearchLite&version=0.2.1                

SearchLite

SearchLite is a lightweight .NET library for adding full-text search capabilities to SQLite and PostgreSQL databases. It offers a unified, strongly-typed, and async-friendly API, making it easy to index and query documents without the need for a dedicated search engine.

Installation

dotnet add package SearchLite

Quick Start

  1. Define your searchable document:
public class Product : ISearchableDocument
{
    public string Id { get; set; }
    public string Name { get; set; }
    public string Description { get; set; }
    public decimal Price { get; set; }
    public string GetSearchText() => $"{Id} {Name} {Description}";
}
  1. Create a search manager and index your documents:
// For PostgreSQL
var searchManager = new PgSearchManager("your_connection_string");

// For SQLite
var searchManager = new SqliteSearchManager("your_connection_string");

var productIndex = await searchManager.Get<Product>("products", CancellationToken.None);

await productIndex.IndexAsync(new Product 
{
    Id = "1",
    Name = "Gaming Laptop",
    Description = "High-performance gaming laptop with RTX 4080",
    Price = 1999.99m
});
  1. Search for documents:
var request = new SearchRequest<Product>
{
    Query = "gaming laptop",
    Options = new SearchOptions { MaxResults = 10, MinScore = 0.5f }
}.Where(p => p.Price < 2000);

var results = await productIndex.SearchAsync(request);

foreach (var match in results.Matches)
{
    Console.WriteLine($"Found: {match.Document.Name} (Score: {match.Score})");
}

Learn More

For detailed documentation, advanced usage, and contributing guidelines, visit the SearchLite GitHub Repository.


Licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on SearchLite:

Package Downloads
SearchLite.Sqlite

Lightweight full-text search library for SQLite and PostgreSQL databases

SearchLite.Postgres

Lightweight full-text search library for SQLite and PostgreSQL databases

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.2.1 249 2/4/2025
0.2.0 105 2/3/2025
0.1.1 131 1/31/2025
0.1.0 97 1/28/2025
0.0.1 124 1/14/2025