SearchLite 0.2.1
dotnet add package SearchLite --version 0.2.1
NuGet\Install-Package SearchLite -Version 0.2.1
<PackageReference Include="SearchLite" Version="0.2.1" />
paket add SearchLite --version 0.2.1
#r "nuget: SearchLite, 0.2.1"
// 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
- 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}";
}
- 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
});
- 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 | Versions 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. |
-
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.