SOFTURE.Typesense
0.1.1
dotnet add package SOFTURE.Typesense --version 0.1.1
NuGet\Install-Package SOFTURE.Typesense -Version 0.1.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="SOFTURE.Typesense" Version="0.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SOFTURE.Typesense" Version="0.1.1" />
<PackageReference Include="SOFTURE.Typesense" />
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 SOFTURE.Typesense --version 0.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SOFTURE.Typesense, 0.1.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 SOFTURE.Typesense@0.1.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=SOFTURE.Typesense&version=0.1.1
#tool nuget:?package=SOFTURE.Typesense&version=0.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
SOFTURE.Typesense
Typesense wrapper for .NET with support for strongly typed models, filters, and queries.
Installation
dotnet add package SOFTURE.Typesense
dotnet add package SOFTURE.Typesense.Abstractions
Quick Start
1. Define Document Model
public sealed class ProductDocument : DocumentBase
{
public ProductDocument() : base(collection: "products") { }
public override required string Id { get; set; }
[JsonPropertyName("name")]
public string? Name { get; set; }
[JsonPropertyName("price")]
public decimal Price { get; set; }
[JsonPropertyName("is_active")]
public bool IsActive { get; set; }
[JsonPropertyName("tags")]
public string[]? Tags { get; set; }
}
2. Define Query Model
public sealed class ProductQuery : QueryBase
{
public ProductQuery() : base(collection: "products") { }
[JsonPropertyName("name")]
public string? Name { get; set; }
}
3. Define Filters with Operators
public sealed class ProductFilters : FilterBase
{
public ProductFilters() : base(collection: "products") { }
[JsonPropertyName("is_active")]
public bool? IsActive { get; set; }
[FilterOperator(FilterOperator.LessThan)]
[JsonPropertyName("price")]
public decimal? Price { get; set; }
[FilterOperator(FilterOperator.GreaterThan)]
[JsonPropertyName("quantity")]
public int? Quantity { get; set; }
[FilterOperator(FilterOperator.Range)]
[JsonPropertyName("created_at")]
public (long From, long To)? CreatedAt { get; set; }
[FilterOperator(FilterOperator.NotEquals)]
[JsonPropertyName("excluded_ids")]
public string[]? ExcludedIds { get; set; }
[JsonPropertyName("tags")]
public string[]? Tags { get; set; }
}
4. Define Sorting
public sealed class ProductSort : SortBase
{
public ProductSort() : base(collection: "products") { }
public ProductSort WithName(SortDirection direction)
{
Add("name", direction);
return this;
}
public ProductSort WithPrice(SortDirection direction)
{
Add("price", direction);
return this;
}
}
5. Configure Collection
public sealed class ProductConfig : ICollectionConfiguration
{
public ProductConfig()
{
Configurations.ConfigureCollection<ProductDocument, ProductQuery, ProductFilters>(
collectionName: "products",
fields:
[
new Field("name", FieldType.String, facet: false, optional: false, index: true, sort: true),
new Field("price", FieldType.Float, facet: false, optional: false, index: true, sort: true),
new Field("is_active", FieldType.Bool, facet: true),
new Field("tags", FieldType.StringArray, facet: true, optional: true)
],
defaultSortingField: "name"
);
}
public List<CollectionConfiguration> Configurations { get; } = [];
}
6. Usage
await documentClient.ImportDocuments(products, batchSize: 100);
var query = new ProductQuery { Name = "iPhone" };
var filters = new ProductFilters
{
IsActive = true,
Price = 1000,
Tags = ["electronics", "smartphones"]
};
var sort = new ProductSort()
.WithPrice(SortDirection.Asc)
.WithName(SortDirection.Desc);
var result = await documentClient.Search<ProductDocument, ProductQuery, ProductFilters, ProductSort>(
query: query,
filters: filters,
sortBy: sort
);
Available Filter Operators
- Default - Equals (
=) FilterOperator.NotEquals- Not equals (:!=)FilterOperator.LessThan- Less than (:<)FilterOperator.LessThanOrEquals- Less than or equals (:<=)FilterOperator.GreaterThan- Greater than (:>)FilterOperator.GreaterThanOrEquals- Greater than or equals (:>=)FilterOperator.Range- Range (:[]) - requires tuple(From, To)
Field Configuration Parameters
facet(default: false) - Fields withtruecan be filtered and groupedindex(default: true) - Set tofalsefor fields that should not be searchablesort(default: false) - Set totruefor fields that can be sortedoptional(default: false) - Whether the field is optional
License
See LICENSE file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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 was computed. 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.
-
net6.0
- SOFTURE.Common.HealthCheck (>= 0.1.3)
- SOFTURE.Settings (>= 0.1.1)
- SOFTURE.Typesense.Abstractions (>= 0.1.1)
- Typesense (>= 7.36.0)
-
net8.0
- SOFTURE.Common.HealthCheck (>= 0.1.3)
- SOFTURE.Settings (>= 0.1.1)
- SOFTURE.Typesense.Abstractions (>= 0.1.1)
- Typesense (>= 7.36.0)
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 |
|---|---|---|
| 0.1.1 | 44 | 11/10/2025 |
| 0.1.0 | 37 | 11/10/2025 |
| 0.0.15 | 144 | 11/6/2025 |
| 0.0.14 | 131 | 11/5/2025 |
| 0.0.13 | 141 | 11/5/2025 |
| 0.0.12 | 305 | 9/7/2024 |
| 0.0.11 | 149 | 9/7/2024 |
| 0.0.10 | 148 | 9/3/2024 |
| 0.0.9 | 146 | 9/3/2024 |
| 0.0.8 | 147 | 9/2/2024 |
| 0.0.7 | 142 | 9/2/2024 |
| 0.0.6 | 157 | 8/20/2024 |
| 0.0.5 | 146 | 8/20/2024 |
| 0.0.4 | 197 | 8/15/2024 |
| 0.0.3 | 168 | 8/12/2024 |
| 0.0.2 | 153 | 8/12/2024 |
| 0.0.1 | 145 | 8/12/2024 |
See https://github.com/SOFTURE/TYPESENSE/blob/master/CHANGELOG.md for release notes.