Skip to content

.Net: Add skip validation for hybrid search options #11380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ namespace Microsoft.Extensions.VectorData;
/// </summary>
public class HybridSearchOptions<TRecord>
{
private int _skip = 0;

/// <summary>
/// Gets or sets a search filter to use before doing the hybrid search.
/// </summary>
Expand Down Expand Up @@ -47,9 +49,22 @@ public class HybridSearchOptions<TRecord>
public int Top { get; init; } = 3;

/// <summary>
/// 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.
/// </summary>
public int Skip { get; init; } = 0;
/// <exception cref="ArgumentOutOfRangeException">Thrown when the value is less than 0.</exception>
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;
}
}

/// <summary>
/// Gets or sets a value indicating whether to include vectors in the retrieval result.
Expand Down
Loading