![]() |
VOOZH | about |
dotnet add package SOFTURE.Typesense.Abstractions --version 0.1.2
NuGet\Install-Package SOFTURE.Typesense.Abstractions -Version 0.1.2
<PackageReference Include="SOFTURE.Typesense.Abstractions" Version="0.1.2" />
<PackageVersion Include="SOFTURE.Typesense.Abstractions" Version="0.1.2" />Directory.Packages.props
<PackageReference Include="SOFTURE.Typesense.Abstractions" />Project file
paket add SOFTURE.Typesense.Abstractions --version 0.1.2
#r "nuget: SOFTURE.Typesense.Abstractions, 0.1.2"
#:package SOFTURE.Typesense.Abstractions@0.1.2
#addin nuget:?package=SOFTURE.Typesense.Abstractions&version=0.1.2Install as a Cake Addin
#tool nuget:?package=SOFTURE.Typesense.Abstractions&version=0.1.2Install as a Cake Tool
Typesense wrapper for .NET with support for strongly typed models, filters, and queries.
dotnet add package SOFTURE.Typesense
dotnet add package SOFTURE.Typesense.Abstractions
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; }
}
public sealed class ProductQuery : QueryBase
{
public ProductQuery() : base(collection: "products") { }
[JsonPropertyName("name")]
public string? Name { get; set; }
}
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; }
}
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;
}
}
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; } = [];
}
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
);
=)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)facet (default: false) - Fields with true can be filtered and groupedindex (default: true) - Set to false for fields that should not be searchablesort (default: false) - Set to true for fields that can be sortedoptional (default: false) - Whether the field is optionalSee file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 1 NuGet packages that depend on SOFTURE.Typesense.Abstractions:
| Package | Downloads |
|---|---|
|
SOFTURE.Typesense
SOFTURE - Typesense |
This package is not used by any popular GitHub repositories.
See https://github.com/SOFTURE/TYPESENSE/blob/master/CHANGELOG.md for release notes.