Section navigation

Public classSealed VectorQuery

Namespace
Rowles.LeanCorpus.Search.Queries
Assembly
Rowles.LeanCorpus.dll

ANN search over vector data using HNSW when available, with a flat SIMD fallback.

public sealed class VectorQuery : Query, IEquatable<Query>
Inheritance
VectorQuery
Implements
Inherited Members
Extension Methods

Public constructor VectorQuery(string, float[], int, int, int, Query?)

Initialises a new VectorQuery for the given field and query vector.

Public property EfSearch

HNSW search-time candidate pool size (the ef parameter). Larger values increase recall at the cost of latency. Defaults to max(64, 4 * topK).

Public property Field

Gets the single field this query targets, or an empty value for fieldless and multi-field queries.

Public property Filter

Optional pre-filter restricting candidates to documents whose IDs satisfy the predicate.

Public property OversamplingFactor

Exact-rerank oversampling factor. The HNSW shortlist returns topK * OversamplingFactor candidates which are then exactly rescored. Default: 1 (no oversampling).

Public property QueryVector

Gets the query vector used to find approximate nearest neighbours.

Public property TopK

Gets the maximum number of nearest-neighbour results to return.

Public method CosineSimilarity(ReadOnlySpan<float>, ReadOnlySpan<float>)

Computes cosine similarity between two vectors using SIMD where available.

Public method Equals(object?)

Determines whether the specified object is equal to the current object.

Public method GetHashCode()

Serves as the default hash function.

Public method Visit(QueryVisitor)

Visits this query and its children.