Skip to content

Commit

Permalink
Fix missing HybridSearch in copy method of SearchOptions (#46425)
Browse files Browse the repository at this point in the history
Fix missing HybridSearch in copy SearchOptions
  • Loading branch information
nielsheeren authored Oct 7, 2024
1 parent 7275c78 commit a70001f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ private static void Copy(SearchOptions source, SearchOptions destination)
destination.QuerySpeller = source.QuerySpeller;
destination.SemanticSearch = source.SemanticSearch;
destination.VectorSearch = source.VectorSearch;
destination.HybridSearch = source.HybridSearch;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,11 @@ public void SearchOptionsCanBeCopied()
Queries = { new VectorizedQuery(VectorSearchEmbeddings.SearchVectorizeDescription) { KNearestNeighborsCount = 3, Fields = { "DescriptionVector", "CategoryVector" } } },
FilterMode = VectorFilterMode.PostFilter
};
source.HybridSearch = new HybridSearch()
{
MaxTextRecallSize = 50,
CountAndFacetMode = HybridCountAndFacetMode.CountRetrievableResults
};
SearchOptions clonedSearchOptions = source.Clone();

CollectionAssert.AreEquivalent(source.Facets, clonedSearchOptions.Facets); // A non-null collection with multiple items
Expand All @@ -1048,6 +1053,8 @@ public void SearchOptionsCanBeCopied()
Assert.AreEqual(source.SemanticSearch.MaxWait, clonedSearchOptions.SemanticSearch.MaxWait);
Assert.AreEqual(source.VectorSearch.Queries, clonedSearchOptions.VectorSearch.Queries);
Assert.AreEqual(source.VectorSearch.FilterMode, clonedSearchOptions.VectorSearch.FilterMode);
Assert.AreEqual(source.HybridSearch.MaxTextRecallSize, clonedSearchOptions.HybridSearch.MaxTextRecallSize);
Assert.AreEqual(source.HybridSearch.CountAndFacetMode, clonedSearchOptions.HybridSearch.CountAndFacetMode);
}

/* TODO: Enable these Track 1 tests when we have support for index creation
Expand Down

0 comments on commit a70001f

Please sign in to comment.