From 1967fc3acc75b72532398bfe1ebd97d58539f486 Mon Sep 17 00:00:00 2001 From: westey <164392973+westey-m@users.noreply.github.com> Date: Fri, 4 Apr 2025 14:03:48 +0100 Subject: [PATCH] Add hybrid search options skip validation --- .../VectorSearch/HybridSearchOptions.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/dotnet/src/Connectors/VectorData.Abstractions/VectorSearch/HybridSearchOptions.cs b/dotnet/src/Connectors/VectorData.Abstractions/VectorSearch/HybridSearchOptions.cs index 0711cd0aba43..199862c17a08 100644 --- a/dotnet/src/Connectors/VectorData.Abstractions/VectorSearch/HybridSearchOptions.cs +++ b/dotnet/src/Connectors/VectorData.Abstractions/VectorSearch/HybridSearchOptions.cs @@ -10,6 +10,8 @@ namespace Microsoft.Extensions.VectorData; /// public class HybridSearchOptions { + private int _skip = 0; + /// /// Gets or sets a search filter to use before doing the hybrid search. /// @@ -47,9 +49,22 @@ public class HybridSearchOptions public int Top { get; init; } = 3; /// - /// Gets or sets the number of results to skip before returning results, i.e. the index of the first result to return. + /// Gets or sets the number of results to skip before returning results, that is, the index of the first result to return. /// - public int Skip { get; init; } = 0; + /// Thrown when the value is less than 0. + public int Skip + { + get => this._skip; + init + { + if (value < 0) + { + throw new ArgumentOutOfRangeException(nameof(value), "Skip must be greater than or equal to 0."); + } + + this._skip = value; + } + } /// /// Gets or sets a value indicating whether to include vectors in the retrieval result.