VapeCache.Features.Search 1.2.22

dotnet add package VapeCache.Features.Search --version 1.2.22
                    
NuGet\Install-Package VapeCache.Features.Search -Version 1.2.22
                    
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="VapeCache.Features.Search" Version="1.2.22" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="VapeCache.Features.Search" Version="1.2.22" />
                    
Directory.Packages.props
<PackageReference Include="VapeCache.Features.Search" />
                    
Project file
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 VapeCache.Features.Search --version 1.2.22
                    
#r "nuget: VapeCache.Features.Search, 1.2.22"
                    
#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 VapeCache.Features.Search@1.2.22
                    
#: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=VapeCache.Features.Search&version=1.2.22
                    
Install as a Cake Addin
#tool nuget:?package=VapeCache.Features.Search&version=1.2.22
                    
Install as a Cake Tool

VapeCache.Features.Search

Typed RediSearch helpers for HASH-backed VapeCache search projections.

Install

dotnet add package VapeCache.Features.Search

What This Package Is For

  • denormalized HASH documents that RediSearch can index efficiently
  • typed TEXT, TAG, and NUMERIC schemas
  • query-building helpers for exact-match and range-heavy workloads
  • search-result cache key/tag conventions that work with VapeCache.Features.Invalidation

Use this package for projection search, not as a generic document database:

  1. Write the authoritative order/cart/session state with the right Redis data type.
  2. Maintain a small HASH projection for the searchable slice.
  3. Index that HASH prefix with RediSearch.
  4. Cache hot query-result pages in VapeCache using search tags/zones.
  5. Invalidate those result pages instantly with policy-driven invalidation when the projection changes.

For the grocery receipt-check use case, that means indexing receipt/order summary projections, not every cart mutation as a giant blob.

Example

builder.Services.AddVapeCache(builder.Configuration);
builder.Services.AddVapeCacheInvalidation();
builder.Services.AddVapeCacheSearch();

builder.Services.AddSingleton<IRedisHashSearchDocumentMapper<ReceiptSearchDocument>, ReceiptSearchDocumentMapper>();
public sealed record ReceiptSearchDocument(
    string OrderId,
    string ShopperId,
    string StoreId,
    string ReceiptStatus,
    decimal Subtotal,
    long CheckedOutTicks,
    string SearchText);

public sealed class ReceiptSearchDocumentMapper : IRedisHashSearchDocumentMapper<ReceiptSearchDocument>
{
    public RedisSearchIndexDefinition Index { get; } = new(
        indexName: "idx:grocery:receipts",
        documentKeyPrefix: "receipt:search:doc:",
        fields:
        [
            RedisSearchFieldDefinition.Tag("orderId", sortable: true),
            RedisSearchFieldDefinition.Tag("shopperId"),
            RedisSearchFieldDefinition.Tag("storeId"),
            RedisSearchFieldDefinition.Tag("receiptStatus"),
            RedisSearchFieldDefinition.Numeric("subtotal", sortable: true),
            RedisSearchFieldDefinition.Numeric("checkedOutTicks", sortable: true),
            RedisSearchFieldDefinition.Text("searchText", weight: 2.0)
        ]);

    public string GetDocumentId(ReceiptSearchDocument document) => document.OrderId;

    public IReadOnlyList<RedisSearchHashFieldValue> MapFields(ReceiptSearchDocument document) =>
    [
        new("orderId", document.OrderId),
        new("shopperId", document.ShopperId),
        new("storeId", document.StoreId),
        new("receiptStatus", document.ReceiptStatus),
        new("subtotal", document.Subtotal.ToString(System.Globalization.CultureInfo.InvariantCulture)),
        new("checkedOutTicks", document.CheckedOutTicks.ToString(System.Globalization.CultureInfo.InvariantCulture)),
        new("searchText", document.SearchText)
    ];
}
var store = app.Services.GetRequiredService<IRedisHashSearchDocumentStore<ReceiptSearchDocument>>();
await store.EnsureIndexAsync(ct);

var query = new RedisSearchQueryBuilder()
    .Tag("shopperId", shopperId)
    .Tag("receiptStatus", "cleared")
    .NumericRange("checkedOutTicks", min: DateTime.UtcNow.AddHours(-2).Ticks)
    .Build(offset: 0, count: 20);

var ids = await store.SearchIdsAsync(query, ct);

Compatibility Contract

  • This package is optimized for Redis HASH projections plus RediSearch indexes.
  • It is meant for operational search and lookup workloads, not full OLAP or arbitrary document querying.
  • Result-page caching and invalidation are first-class; backend storage-format parity with unrelated search systems is not a goal.

Invalidation Integration

public sealed class ReceiptFlaggedInvalidationPolicy : ICacheInvalidationPolicy<ReceiptFlagged>
{
    public ValueTask<CacheInvalidationPlan> BuildPlanAsync(ReceiptFlagged eventData, CancellationToken ct = default)
        => ValueTask.FromResult(new CacheInvalidationPlanBuilder()
            .AddSearchZone("idx:grocery:receipts")
            .AddSearchIndexTag("idx:grocery:receipts")
            .AddSearchScopeTag("idx:grocery:receipts", "shopperId", eventData.ShopperId)
            .AddSearchEntityTag("idx:grocery:receipts", "order", eventData.OrderId)
            .AddSearchDocumentKey(RedisSearchConventions.DocumentKey("receipt:search:doc:", eventData.OrderId))
            .Build());
}

Docs

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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.

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
1.2.22 105 4/26/2026
1.2.21 95 4/26/2026
1.2.20 117 4/13/2026
1.2.19 99 4/12/2026
1.2.18 117 4/2/2026

See GitHub releases and docs/UPGRADE_NOTES.md for release-specific notes.