redis-vl-dotnet

Core Features

This section is the canonical overview for the core Redis-backed library surface.

Main workflow areas

The core package centers on these feature groups:

  • SearchSchema and IndexDefinition for defining index names, prefixes, storage type, and fields

  • field definitions for text, tag, numeric, geo, and vector indexing

  • SearchIndex for index creation, inspection, listing, clearing, rediscovery, and dropping

  • document lifecycle and partial updates for JSON and HASH CRUD flows

  • structured query objects for filter, text, count, vector, hybrid, multi-vector, and aggregation workflows

  • higher-level caches and workflows for embeddings reuse, semantic response reuse, semantic routing, and chat-history retrieval

Schema and index docs

Topic What it covers

SearchSchema

How schema metadata and field collections fit together, including JSON versus HASH storage behavior.

IndexDefinition

Index naming, prefixes, key separators, stopwords, and advanced FT.CREATE flags exposed by the library.

Field definitions

Supported field types plus the validation rules behind sortable, NOINDEX, UNF, and vector attributes.

YAML schema loading

SearchSchema.FromYaml and SearchSchema.FromYamlFile, accepted YAML shape, and validation behavior.

Index lifecycle

CreateAsync, ExistsAsync, InfoAsync, ListAsync, FromExistingAsync, ClearAsync, and DropAsync.

Document lifecycle

LoadJsonAsync, LoadHashAsync, fetch-by-id and fetch-by-key calls, delete flows, and cleanup behavior for JSON and HASH documents.

Partial updates

JsonPartialUpdate and HashPartialUpdate, update-by-id versus update-by-key, key resolution, and validation constraints.

Query and aggregation docs

Topic What it covers

FilterQuery

Structured RediSearch filtering with Filter.Tag, Filter.Numeric, Filter.Text, Filter.Geo, projections, paging, and batch iteration.

TextQuery

Full-text search strings, return-field projections, typed mapping, and text-search batch helpers.

CountQuery

Count-only requests that reuse the filter DSL without fetching documents.

VectorQuery

KNN search, topK windows, runtime EF_RUNTIME tuning, score aliases, and typed vector result mapping.

VectorRangeQuery

Radius-style vector search with distance thresholds, paging, and range runtime options.

HybridQuery

Combined text-plus-vector search where a text predicate narrows semantic search candidates.

AggregateHybridQuery

Vector + text filtering with aggregation pipelines, load fields, reducers, sort clauses, and runtime tuning.

MultiVectorQuery

Weighted search across multiple vector fields with deterministic score combination and shared projections.

Aggregation workflows

AggregationQuery, AggregationApply, AggregationGroupBy, reducers, pagination, typed row mapping, and aggregate batching.

Cache and workflow docs

Topic What it covers

EmbeddingsCache

Exact-input embedding reuse with SHA-256-based keys, optional namespaces, and TTL-driven expiration.

SemanticCache

Semantic response reuse with vector thresholds, optional metadata, filterable fields, and vectorizer-based overloads.

SemanticRouter

Route registration and nearest-route lookup for AI-adjacent request routing workflows.

MessageHistory

Session-scoped append-only chat history with recency retrieval and optional role filters.

SemanticMessageHistory

Recency plus semantic retrieval inside one session with configurable vector thresholds.

Primary example

The primary runnable example for this area is /examples/JsonStorageExample. It demonstrates:

  • loading a schema from YAML

  • creating a JSON-backed index with overwrite semantics

  • listing indexes and rediscovering one with SearchIndex.FromExistingAsync

  • loading, fetching, partially updating, clearing, and dropping JSON documents

Pair it with /examples/VectorSearchExample when you need the HASH-backed view of update, fetch, and cleanup flows.

The primary runnable references for query coverage are:

  • /examples/JsonStorageExample for filter, text, count, batching, and standard aggregation

  • /examples/VectorSearchExample for vector, hybrid aggregate, multi-vector, paging windows, and runtime vector options

Storage behavior

The library supports both JSON and HASH storage models:

  • StorageType.Json uses RedisJSON paths and requires RedisJSON plus RediSearch.

  • StorageType.Hash uses Redis hashes and requires RediSearch only.

Choose the storage type in IndexDefinition, then use the matching SearchIndex APIs. JSON flows call methods such as LoadJsonAsync and FetchJsonByIdAsync; HASH flows call LoadHashAsync and FetchHashByIdAsync.

Query pagination is shared across the search APIs, and typed result mapping is designed to let callers work with strongly typed documents or projections instead of parsing raw Redis arrays directly.