Skip to content

Commit 3f75d14

Browse files
committed
Add AnyTagEqualTo and multi-clause support to VectorStoreTextSearch LINQ filtering
- Extend ConvertTextSearchFilterToLinq to handle AnyTagEqualToFilterClause - Add CreateAnyTagEqualToExpression for collection.Contains() operations - Add CreateMultipleClauseExpression for AND logic with Expression.AndAlso - Add 4 comprehensive tests for new filtering capabilities - Add RequiresDynamicCode attributes for AOT compatibility - Maintain backward compatibility with graceful fallback Fixes #10456
1 parent 0ba75b2 commit 3f75d14

File tree

5 files changed

+491
-16
lines changed

5 files changed

+491
-16
lines changed

dotnet/src/SemanticKernel.AotTests/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright (c) Microsoft. All rights reserved.
22

3+
using System.Diagnostics.CodeAnalysis;
34
using SemanticKernel.AotTests.UnitTests.Core.Functions;
45
using SemanticKernel.AotTests.UnitTests.Core.Plugins;
56
using SemanticKernel.AotTests.UnitTests.Search;
@@ -19,6 +20,7 @@ private static async Task<int> Main(string[] args)
1920
return success ? 1 : 0;
2021
}
2122

23+
[UnconditionalSuppressMessage("AOT", "IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.", Justification = "Test application intentionally tests dynamic code paths. VectorStoreTextSearch LINQ filtering requires reflection for dynamic expression building from runtime filter specifications.")]
2224
private static readonly Func<Task>[] s_unitTests =
2325
[
2426
// Tests for functions

dotnet/src/SemanticKernel.AotTests/UnitTests/Search/VectorStoreTextSearchTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright (c) Microsoft. All rights reserved.
22

3+
using System.Diagnostics.CodeAnalysis;
34
using Microsoft.Extensions.DependencyInjection;
45
using Microsoft.Extensions.VectorData;
56
using Microsoft.SemanticKernel;
@@ -10,6 +11,7 @@ namespace SemanticKernel.AotTests.UnitTests.Search;
1011

1112
internal sealed class VectorStoreTextSearchTests
1213
{
14+
[RequiresDynamicCode("Calls Microsoft.SemanticKernel.Data.VectorStoreTextSearch<TRecord>.GetTextSearchResultsAsync(String, TextSearchOptions, CancellationToken)")]
1315
public static async Task GetTextSearchResultsAsync()
1416
{
1517
// Arrange
@@ -37,6 +39,7 @@ public static async Task GetTextSearchResultsAsync()
3739
Assert.AreEqual("test-link", results[0].Link);
3840
}
3941

42+
[RequiresDynamicCode("Calls Microsoft.SemanticKernel.Data.VectorStoreTextSearch<TRecord>.GetTextSearchResultsAsync(String, TextSearchOptions, CancellationToken)")]
4043
public static async Task AddVectorStoreTextSearch()
4144
{
4245
// Arrange

0 commit comments

Comments
 (0)