From 246954a77b3b2ab99b97a5a2f44fc62bed3e2aa9 Mon Sep 17 00:00:00 2001 From: Shay Rojansky Date: Tue, 4 Mar 2025 20:02:51 +0100 Subject: [PATCH] Rename VectorSearchOptions.NewFilter to Filter And the obsoleted Filter to OldFilter. Continues #10273. --- .../VectorStore_VectorSearch_MultiStore_Common.cs | 2 +- .../Memory/VectorStore_VectorSearch_Simple.cs | 2 +- .../Step2_Vector_Search.cs | 2 +- .../AzureAISearchVectorStoreRecordCollectionTests.cs | 4 ++-- ...sDBNoSQLVectorStoreCollectionQueryBuilderTests.cs | 6 +++--- .../InMemoryVectorStoreRecordCollectionTests.cs | 2 +- .../AzureAISearchVectorStoreRecordCollection.cs | 12 ++++++------ ...zureCosmosDBMongoDBVectorStoreRecordCollection.cs | 6 +++--- ...CosmosDBNoSQLVectorStoreCollectionQueryBuilder.cs | 6 +++--- .../InMemoryVectorStoreRecordCollection.cs | 6 +++--- .../MongoDBVectorStoreRecordCollection.cs | 6 +++--- .../PineconeVectorStoreRecordCollection.cs | 2 +- .../PostgresVectorStoreCollectionSqlBuilder.cs | 2 +- .../PostgresVectorStoreRecordCollection.cs | 4 ++-- .../QdrantVectorStoreRecordCollection.cs | 6 +++--- .../RedisVectorStoreCollectionSearchMapping.cs | 6 +++--- .../SqliteVectorStoreRecordCollection.cs | 10 +++++----- ...eaviateVectorStoreRecordCollectionQueryBuilder.cs | 6 +++--- .../QdrantVectorStoreRecordCollectionTests.cs | 2 +- .../RedisHashSetVectorStoreRecordCollectionTests.cs | 2 +- .../RedisJsonVectorStoreRecordCollectionTests.cs | 2 +- ...teVectorStoreRecordCollectionQueryBuilderTests.cs | 6 +++--- .../VectorSearch/VectorSearchFilter.cs | 2 +- .../VectorSearch/VectorSearchOptions.cs | 6 +++--- .../AzureAISearchVectorStoreRecordCollectionTests.cs | 6 +++--- ...osmosDBMongoDBVectorStoreRecordCollectionTests.cs | 2 +- ...eCosmosDBNoSQLVectorStoreRecordCollectionTests.cs | 2 +- .../MongoDBVectorStoreRecordCollectionTests.cs | 2 +- .../PineconeVectorStoreRecordCollectionTests.cs | 2 +- .../PostgresVectorStoreRecordCollectionTests.cs | 4 ++-- .../Qdrant/QdrantVectorStoreRecordCollectionTests.cs | 4 ++-- .../RedisHashSetVectorStoreRecordCollectionTests.cs | 4 ++-- .../RedisJsonVectorStoreRecordCollectionTests.cs | 4 ++-- .../Sqlite/SqliteVectorStoreRecordCollectionTests.cs | 2 +- .../WeaviateVectorStoreRecordCollectionTests.cs | 4 ++-- .../Data/TextSearch/VectorStoreTextSearch.cs | 2 +- .../Data/VolatileVectorStoreRecordCollection.cs | 4 ++-- .../Data/VolatileVectorStoreRecordCollectionTests.cs | 2 +- .../Filter/BasicFilterTests.cs | 4 ++-- .../VectorDataIntegrationTests/Support/TestStore.cs | 2 +- 40 files changed, 80 insertions(+), 80 deletions(-) diff --git a/dotnet/samples/Concepts/Memory/VectorStore_VectorSearch_MultiStore_Common.cs b/dotnet/samples/Concepts/Memory/VectorStore_VectorSearch_MultiStore_Common.cs index ff492ca58304..435fdfcdfd85 100644 --- a/dotnet/samples/Concepts/Memory/VectorStore_VectorSearch_MultiStore_Common.cs +++ b/dotnet/samples/Concepts/Memory/VectorStore_VectorSearch_MultiStore_Common.cs @@ -70,7 +70,7 @@ public async Task IngestDataAndSearchAsync(string collectionName, Func g.Category == "External Definitions" }); + searchResult = await collection.VectorizedSearchAsync(searchVector, new() { Top = 3, Filter = g => g.Category == "External Definitions" }); resultRecords = await searchResult.Results.ToListAsync(); output.WriteLine("Search string: " + searchString); diff --git a/dotnet/samples/Concepts/Memory/VectorStore_VectorSearch_Simple.cs b/dotnet/samples/Concepts/Memory/VectorStore_VectorSearch_Simple.cs index 5119881c3bda..9a43c01aeb43 100644 --- a/dotnet/samples/Concepts/Memory/VectorStore_VectorSearch_Simple.cs +++ b/dotnet/samples/Concepts/Memory/VectorStore_VectorSearch_Simple.cs @@ -70,7 +70,7 @@ public async Task ExampleAsync() // Search the collection using a vector search with pre-filtering. searchString = "What is Retrieval Augmented Generation"; searchVector = await textEmbeddingGenerationService.GenerateEmbeddingAsync(searchString); - searchResult = await collection.VectorizedSearchAsync(searchVector, new() { Top = 3, NewFilter = g => g.Category == "External Definitions" }); + searchResult = await collection.VectorizedSearchAsync(searchVector, new() { Top = 3, Filter = g => g.Category == "External Definitions" }); resultRecords = await searchResult.Results.ToListAsync(); Console.WriteLine("Search string: " + searchString); diff --git a/dotnet/samples/GettingStartedWithVectorStores/Step2_Vector_Search.cs b/dotnet/samples/GettingStartedWithVectorStores/Step2_Vector_Search.cs index 9b7e889b25dd..2eda86863a60 100644 --- a/dotnet/samples/GettingStartedWithVectorStores/Step2_Vector_Search.cs +++ b/dotnet/samples/GettingStartedWithVectorStores/Step2_Vector_Search.cs @@ -71,7 +71,7 @@ public async Task SearchAnInMemoryVectorStoreWithFilteringAsync() new() { Top = 1, - NewFilter = g => g.Category == "AI" + Filter = g => g.Category == "AI" }); var searchResultItems = await searchResult.Results.ToListAsync(); diff --git a/dotnet/src/Connectors/Connectors.AzureAISearch.UnitTests/AzureAISearchVectorStoreRecordCollectionTests.cs b/dotnet/src/Connectors/Connectors.AzureAISearch.UnitTests/AzureAISearchVectorStoreRecordCollectionTests.cs index eb240f91d9aa..b919f00dc1fd 100644 --- a/dotnet/src/Connectors/Connectors.AzureAISearch.UnitTests/AzureAISearchVectorStoreRecordCollectionTests.cs +++ b/dotnet/src/Connectors/Connectors.AzureAISearch.UnitTests/AzureAISearchVectorStoreRecordCollectionTests.cs @@ -574,7 +574,7 @@ public async Task CanSearchWithVectorAndFilterAsync() { Top = 5, Skip = 3, - Filter = filter, + OldFilter = filter, VectorPropertyName = nameof(MultiPropsModel.Vector1) }, this._testCancellationToken); @@ -616,7 +616,7 @@ public async Task CanSearchWithTextAndFilterAsync() { Top = 5, Skip = 3, - Filter = filter, + OldFilter = filter, VectorPropertyName = nameof(MultiPropsModel.Vector1) }, this._testCancellationToken); diff --git a/dotnet/src/Connectors/Connectors.AzureCosmosDBNoSQL.UnitTests/AzureCosmosDBNoSQLVectorStoreCollectionQueryBuilderTests.cs b/dotnet/src/Connectors/Connectors.AzureCosmosDBNoSQL.UnitTests/AzureCosmosDBNoSQLVectorStoreCollectionQueryBuilderTests.cs index 37aa005777d5..db55fca4baeb 100644 --- a/dotnet/src/Connectors/Connectors.AzureCosmosDBNoSQL.UnitTests/AzureCosmosDBNoSQLVectorStoreCollectionQueryBuilderTests.cs +++ b/dotnet/src/Connectors/Connectors.AzureCosmosDBNoSQL.UnitTests/AzureCosmosDBNoSQLVectorStoreCollectionQueryBuilderTests.cs @@ -37,7 +37,7 @@ public void BuildSearchQueryByDefaultReturnsValidQueryDefinition() .EqualTo("TestProperty2", "test-value-2") .AnyTagEqualTo("TestProperty3", "test-value-3"); - var searchOptions = new VectorSearchOptions { Filter = filter, Skip = 5, Top = 10 }; + var searchOptions = new VectorSearchOptions { OldFilter = filter, Skip = 5, Top = 10 }; // Act var queryDefinition = AzureCosmosDBNoSQLVectorStoreCollectionQueryBuilder.BuildSearchQuery( @@ -86,7 +86,7 @@ public void BuildSearchQueryWithoutOffsetReturnsQueryDefinitionWithTopParameter( .EqualTo("TestProperty2", "test-value-2") .AnyTagEqualTo("TestProperty3", "test-value-3"); - var searchOptions = new VectorSearchOptions { Filter = filter, Top = 10 }; + var searchOptions = new VectorSearchOptions { OldFilter = filter, Top = 10 }; // Act var queryDefinition = AzureCosmosDBNoSQLVectorStoreCollectionQueryBuilder.BuildSearchQuery( @@ -131,7 +131,7 @@ public void BuildSearchQueryWithInvalidFilterThrowsException() var filter = new VectorSearchFilter().EqualTo("non-existent-property", "test-value-2"); - var searchOptions = new VectorSearchOptions { Filter = filter, Skip = 5, Top = 10 }; + var searchOptions = new VectorSearchOptions { OldFilter = filter, Skip = 5, Top = 10 }; // Act & Assert Assert.Throws(() => diff --git a/dotnet/src/Connectors/Connectors.InMemory.UnitTests/InMemoryVectorStoreRecordCollectionTests.cs b/dotnet/src/Connectors/Connectors.InMemory.UnitTests/InMemoryVectorStoreRecordCollectionTests.cs index bbf5c9611e32..d48730696fce 100644 --- a/dotnet/src/Connectors/Connectors.InMemory.UnitTests/InMemoryVectorStoreRecordCollectionTests.cs +++ b/dotnet/src/Connectors/Connectors.InMemory.UnitTests/InMemoryVectorStoreRecordCollectionTests.cs @@ -338,7 +338,7 @@ public async Task CanSearchWithVectorAndFilterAsync(bool useDefinition, TK var filter = filterType == "Equality" ? new VectorSearchFilter().EqualTo("Data", $"data {testKey2}") : new VectorSearchFilter().AnyTagEqualTo("Tags", $"tag {testKey2}"); var actual = await sut.VectorizedSearchAsync( new ReadOnlyMemory(new float[] { 1, 1, 1, 1 }), - new() { IncludeVectors = true, Filter = filter, IncludeTotalCount = true }, + new() { IncludeVectors = true, OldFilter = filter, IncludeTotalCount = true }, this._testCancellationToken); // Assert diff --git a/dotnet/src/Connectors/Connectors.Memory.AzureAISearch/AzureAISearchVectorStoreRecordCollection.cs b/dotnet/src/Connectors/Connectors.Memory.AzureAISearch/AzureAISearchVectorStoreRecordCollection.cs index 67ed7e58a96e..d011d5a6c127 100644 --- a/dotnet/src/Connectors/Connectors.Memory.AzureAISearch/AzureAISearchVectorStoreRecordCollection.cs +++ b/dotnet/src/Connectors/Connectors.Memory.AzureAISearch/AzureAISearchVectorStoreRecordCollection.cs @@ -340,9 +340,9 @@ public virtual Task> VectorizedSearchAsync // Build filter object. var filter = internalOptions switch { - { Filter: not null, NewFilter: not null } => throw new ArgumentException("Either Filter or NewFilter can be specified, but not both"), - { Filter: VectorSearchFilter legacyFilter } => AzureAISearchVectorStoreCollectionSearchMapping.BuildLegacyFilterString(legacyFilter, this._propertyReader.JsonPropertyNamesMap), - { NewFilter: Expression> newFilter } => new AzureAISearchFilterTranslator().Translate(newFilter, this._propertyReader.StoragePropertyNamesMap), + { OldFilter: not null, Filter: not null } => throw new ArgumentException("Either Filter or OldFilter can be specified, but not both"), + { OldFilter: VectorSearchFilter legacyFilter } => AzureAISearchVectorStoreCollectionSearchMapping.BuildLegacyFilterString(legacyFilter, this._propertyReader.JsonPropertyNamesMap), + { Filter: Expression> newFilter } => new AzureAISearchFilterTranslator().Translate(newFilter, this._propertyReader.StoragePropertyNamesMap), _ => null }; #pragma warning restore CS0618 @@ -395,9 +395,9 @@ public virtual Task> VectorizableTextSearchAsync(st // Build filter object. var filter = internalOptions switch { - { Filter: not null, NewFilter: not null } => throw new ArgumentException("Either Filter or NewFilter can be specified, but not both"), - { Filter: VectorSearchFilter legacyFilter } => AzureAISearchVectorStoreCollectionSearchMapping.BuildLegacyFilterString(legacyFilter, this._propertyReader.JsonPropertyNamesMap), - { NewFilter: Expression> newFilter } => new AzureAISearchFilterTranslator().Translate(newFilter, this._propertyReader.StoragePropertyNamesMap), + { OldFilter: not null, Filter: not null } => throw new ArgumentException("Either Filter or OldFilter can be specified, but not both"), + { OldFilter: VectorSearchFilter legacyFilter } => AzureAISearchVectorStoreCollectionSearchMapping.BuildLegacyFilterString(legacyFilter, this._propertyReader.JsonPropertyNamesMap), + { Filter: Expression> newFilter } => new AzureAISearchFilterTranslator().Translate(newFilter, this._propertyReader.StoragePropertyNamesMap), _ => null }; #pragma warning restore CS0618 diff --git a/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBMongoDB/AzureCosmosDBMongoDBVectorStoreRecordCollection.cs b/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBMongoDB/AzureCosmosDBMongoDBVectorStoreRecordCollection.cs index 95d4df05400f..794495cd1548 100644 --- a/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBMongoDB/AzureCosmosDBMongoDBVectorStoreRecordCollection.cs +++ b/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBMongoDB/AzureCosmosDBMongoDBVectorStoreRecordCollection.cs @@ -275,11 +275,11 @@ public virtual async Task> VectorizedSearchAsync throw new ArgumentException("Either Filter or NewFilter can be specified, but not both"), - { Filter: VectorSearchFilter legacyFilter } => AzureCosmosDBMongoDBVectorStoreCollectionSearchMapping.BuildFilter( + { OldFilter: not null, Filter: not null } => throw new ArgumentException("Either Filter or OldFilter can be specified, but not both"), + { OldFilter: VectorSearchFilter legacyFilter } => AzureCosmosDBMongoDBVectorStoreCollectionSearchMapping.BuildFilter( legacyFilter, this._storagePropertyNames), - { NewFilter: Expression> newFilter } => new AzureCosmosDBMongoDBFilterTranslator().Translate(newFilter, this._storagePropertyNames), + { Filter: Expression> newFilter } => new AzureCosmosDBMongoDBFilterTranslator().Translate(newFilter, this._storagePropertyNames), _ => null }; #pragma warning restore CS0618 diff --git a/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBNoSQL/AzureCosmosDBNoSQLVectorStoreCollectionQueryBuilder.cs b/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBNoSQL/AzureCosmosDBNoSQLVectorStoreCollectionQueryBuilder.cs index 1b0e7dcb8a7f..4a5d2ec901fe 100644 --- a/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBNoSQL/AzureCosmosDBNoSQLVectorStoreCollectionQueryBuilder.cs +++ b/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBNoSQL/AzureCosmosDBNoSQLVectorStoreCollectionQueryBuilder.cs @@ -49,9 +49,9 @@ public static QueryDefinition BuildSearchQuery( // Build filter object. var (whereClause, filterParameters) = searchOptions switch { - { Filter: not null, NewFilter: not null } => throw new ArgumentException("Either Filter or NewFilter can be specified, but not both"), - { Filter: VectorSearchFilter legacyFilter } => BuildSearchFilter(legacyFilter, storagePropertyNames), - { NewFilter: Expression> newFilter } => new AzureCosmosDBNoSqlFilterTranslator().Translate(newFilter, storagePropertyNames), + { OldFilter: not null, Filter: not null } => throw new ArgumentException("Either Filter or OldFilter can be specified, but not both"), + { OldFilter: VectorSearchFilter legacyFilter } => BuildSearchFilter(legacyFilter, storagePropertyNames), + { Filter: Expression> newFilter } => new AzureCosmosDBNoSqlFilterTranslator().Translate(newFilter, storagePropertyNames), _ => (null, []) }; #pragma warning restore CS0618 // VectorSearchFilter is obsolete diff --git a/dotnet/src/Connectors/Connectors.Memory.InMemory/InMemoryVectorStoreRecordCollection.cs b/dotnet/src/Connectors/Connectors.Memory.InMemory/InMemoryVectorStoreRecordCollection.cs index 03fe957cca07..b330c873fdbd 100644 --- a/dotnet/src/Connectors/Connectors.Memory.InMemory/InMemoryVectorStoreRecordCollection.cs +++ b/dotnet/src/Connectors/Connectors.Memory.InMemory/InMemoryVectorStoreRecordCollection.cs @@ -240,9 +240,9 @@ public async Task> VectorizedSearchAsync(T var allValues = this.GetCollectionDictionary().Values.Cast(); var filteredRecords = internalOptions switch { - { Filter: not null, NewFilter: not null } => throw new ArgumentException("Either Filter or NewFilter can be specified, but not both"), - { Filter: VectorSearchFilter legacyFilter } => InMemoryVectorStoreCollectionSearchMapping.FilterRecords(legacyFilter, allValues), - { NewFilter: Expression> newFilter } => allValues.AsQueryable().Where(newFilter), + { OldFilter: not null, Filter: not null } => throw new ArgumentException("Either Filter or OldFilter can be specified, but not both"), + { OldFilter: VectorSearchFilter legacyFilter } => InMemoryVectorStoreCollectionSearchMapping.FilterRecords(legacyFilter, allValues), + { Filter: Expression> newFilter } => allValues.AsQueryable().Where(newFilter), _ => allValues }; #pragma warning restore CS0618 // VectorSearchFilter is obsolete diff --git a/dotnet/src/Connectors/Connectors.Memory.MongoDB/MongoDBVectorStoreRecordCollection.cs b/dotnet/src/Connectors/Connectors.Memory.MongoDB/MongoDBVectorStoreRecordCollection.cs index 0aa57579b7d7..6b86db514047 100644 --- a/dotnet/src/Connectors/Connectors.Memory.MongoDB/MongoDBVectorStoreRecordCollection.cs +++ b/dotnet/src/Connectors/Connectors.Memory.MongoDB/MongoDBVectorStoreRecordCollection.cs @@ -278,9 +278,9 @@ public virtual async Task> VectorizedSearchAsync throw new ArgumentException("Either Filter or NewFilter can be specified, but not both"), - { Filter: VectorSearchFilter legacyFilter } => MongoDBVectorStoreCollectionSearchMapping.BuildLegacyFilter(legacyFilter, this._storagePropertyNames), - { NewFilter: Expression> newFilter } => new MongoDBFilterTranslator().Translate(newFilter, this._storagePropertyNames), + { OldFilter: not null, Filter: not null } => throw new ArgumentException("Either Filter or OldFilter can be specified, but not both"), + { OldFilter: VectorSearchFilter legacyFilter } => MongoDBVectorStoreCollectionSearchMapping.BuildLegacyFilter(legacyFilter, this._storagePropertyNames), + { Filter: Expression> newFilter } => new MongoDBFilterTranslator().Translate(newFilter, this._storagePropertyNames), _ => null }; #pragma warning restore CS0618 diff --git a/dotnet/src/Connectors/Connectors.Memory.Pinecone/PineconeVectorStoreRecordCollection.cs b/dotnet/src/Connectors/Connectors.Memory.Pinecone/PineconeVectorStoreRecordCollection.cs index 1db3d86fbf16..6e44feda9334 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Pinecone/PineconeVectorStoreRecordCollection.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Pinecone/PineconeVectorStoreRecordCollection.cs @@ -262,7 +262,7 @@ public virtual async Task> VectorizedSearchAsync( #pragma warning disable CS0618 // VectorSearchFilter is obsolete var (where, parameters) = (oldFilter: legacyFilter, newFilter) switch { - (not null, not null) => throw new ArgumentException("Either Filter or NewFilter can be specified, but not both"), + (not null, not null) => throw new ArgumentException("Either Filter or OldFilter can be specified, but not both"), (not null, null) => GenerateLegacyFilterWhereClause(schema, tableName, propertyReader.RecordDefinition.Properties, legacyFilter, startParamIndex: 2), (null, not null) => new PostgresFilterTranslator().Translate(propertyReader.StoragePropertyNamesMap, newFilter, startParamIndex: 2), _ => (Clause: string.Empty, Parameters: []) diff --git a/dotnet/src/Connectors/Connectors.Memory.Postgres/PostgresVectorStoreRecordCollection.cs b/dotnet/src/Connectors/Connectors.Memory.Postgres/PostgresVectorStoreRecordCollection.cs index bea84dce1b06..81cdf1e1cc88 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Postgres/PostgresVectorStoreRecordCollection.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Postgres/PostgresVectorStoreRecordCollection.cs @@ -290,9 +290,9 @@ public virtual Task> VectorizedSearchAsync pgVector, searchOptions.Top, #pragma warning disable CS0618 // VectorSearchFilter is obsolete - searchOptions.Filter, + searchOptions.OldFilter, #pragma warning restore CS0618 // VectorSearchFilter is obsolete - searchOptions.NewFilter, + searchOptions.Filter, searchOptions.Skip, searchOptions.IncludeVectors, cancellationToken) diff --git a/dotnet/src/Connectors/Connectors.Memory.Qdrant/QdrantVectorStoreRecordCollection.cs b/dotnet/src/Connectors/Connectors.Memory.Qdrant/QdrantVectorStoreRecordCollection.cs index 5cb529ad08e3..401740a0e7a4 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Qdrant/QdrantVectorStoreRecordCollection.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Qdrant/QdrantVectorStoreRecordCollection.cs @@ -478,9 +478,9 @@ public virtual async Task> VectorizedSearchAsync throw new ArgumentException("Either Filter or NewFilter can be specified, but not both"), - { Filter: VectorSearchFilter legacyFilter } => QdrantVectorStoreCollectionSearchMapping.BuildFromLegacyFilter(legacyFilter, this._propertyReader.StoragePropertyNamesMap), - { NewFilter: Expression> newFilter } => new QdrantFilterTranslator().Translate(newFilter, this._propertyReader.StoragePropertyNamesMap), + { OldFilter: not null, Filter: not null } => throw new ArgumentException("Either Filter or OldFilter can be specified, but not both"), + { OldFilter: VectorSearchFilter legacyFilter } => QdrantVectorStoreCollectionSearchMapping.BuildFromLegacyFilter(legacyFilter, this._propertyReader.StoragePropertyNamesMap), + { Filter: Expression> newFilter } => new QdrantFilterTranslator().Translate(newFilter, this._propertyReader.StoragePropertyNamesMap), _ => new Filter() }; #pragma warning restore CS0618 // Type or member is obsolete diff --git a/dotnet/src/Connectors/Connectors.Memory.Redis/RedisVectorStoreCollectionSearchMapping.cs b/dotnet/src/Connectors/Connectors.Memory.Redis/RedisVectorStoreCollectionSearchMapping.cs index ea78a9e798c0..f7663e0e7e44 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Redis/RedisVectorStoreCollectionSearchMapping.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Redis/RedisVectorStoreCollectionSearchMapping.cs @@ -62,9 +62,9 @@ public static Query BuildQuery(byte[] vectorBytes, VectorSearchOptions< #pragma warning disable CS0618 // Type or member is obsolete var filter = options switch { - { Filter: not null, NewFilter: not null } => throw new ArgumentException("Either Filter or NewFilter can be specified, but not both"), - { Filter: VectorSearchFilter legacyFilter } => BuildLegacyFilter(legacyFilter, storagePropertyNames), - { NewFilter: Expression> newFilter } => new RedisFilterTranslator().Translate(newFilter, storagePropertyNames), + { OldFilter: not null, Filter: not null } => throw new ArgumentException("Either Filter or OldFilter can be specified, but not both"), + { OldFilter: VectorSearchFilter legacyFilter } => BuildLegacyFilter(legacyFilter, storagePropertyNames), + { Filter: Expression> newFilter } => new RedisFilterTranslator().Translate(newFilter, storagePropertyNames), _ => "*" }; #pragma warning restore CS0618 // Type or member is obsolete diff --git a/dotnet/src/Connectors/Connectors.Memory.Sqlite/SqliteVectorStoreRecordCollection.cs b/dotnet/src/Connectors/Connectors.Memory.Sqlite/SqliteVectorStoreRecordCollection.cs index e3c2431491c3..e91b1db1bf84 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Sqlite/SqliteVectorStoreRecordCollection.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Sqlite/SqliteVectorStoreRecordCollection.cs @@ -195,22 +195,22 @@ public virtual Task> VectorizedSearchAsync if (searchOptions.Filter is not null) { - if (searchOptions.NewFilter is not null) + if (searchOptions.Filter is not null) { - throw new ArgumentException("Either Filter or NewFilter can be specified, but not both"); + throw new ArgumentException("Either Filter or OldFilter can be specified, but not both"); } // Old filter, we translate it to a list of SqliteWhereCondition, and merge these into the conditions we already have - var filterConditions = this.GetFilterConditions(searchOptions.Filter, this._dataTableName); + var filterConditions = this.GetFilterConditions(searchOptions.OldFilter, this._dataTableName); if (filterConditions is { Count: > 0 }) { conditions.AddRange(filterConditions); } } - else if (searchOptions.NewFilter is not null) + else if (searchOptions.Filter is not null) { - (extraWhereFilter, extraParameters) = new SqliteFilterTranslator().Translate(this._propertyReader.StoragePropertyNamesMap, searchOptions.NewFilter); + (extraWhereFilter, extraParameters) = new SqliteFilterTranslator().Translate(this._propertyReader.StoragePropertyNamesMap, searchOptions.Filter); } #pragma warning restore CS0618 // VectorSearchFilter is obsolete diff --git a/dotnet/src/Connectors/Connectors.Memory.Weaviate/WeaviateVectorStoreRecordCollectionQueryBuilder.cs b/dotnet/src/Connectors/Connectors.Memory.Weaviate/WeaviateVectorStoreRecordCollectionQueryBuilder.cs index e665e7e85e08..1b38e708ab9f 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Weaviate/WeaviateVectorStoreRecordCollectionQueryBuilder.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Weaviate/WeaviateVectorStoreRecordCollectionQueryBuilder.cs @@ -36,13 +36,13 @@ public static string BuildSearchQuery( #pragma warning disable CS0618 // VectorSearchFilter is obsolete var filter = searchOptions switch { - { Filter: not null, NewFilter: not null } => throw new ArgumentException("Either Filter or NewFilter can be specified, but not both"), - { Filter: VectorSearchFilter legacyFilter } => BuildLegacyFilter( + { OldFilter: not null, Filter: not null } => throw new ArgumentException("Either Filter or OldFilter can be specified, but not both"), + { OldFilter: VectorSearchFilter legacyFilter } => BuildLegacyFilter( legacyFilter, jsonSerializerOptions, keyPropertyName, storagePropertyNames), - { NewFilter: Expression> newFilter } => new WeaviateFilterTranslator().Translate(newFilter, storagePropertyNames), + { Filter: Expression> newFilter } => new WeaviateFilterTranslator().Translate(newFilter, storagePropertyNames), _ => null }; #pragma warning restore CS0618 diff --git a/dotnet/src/Connectors/Connectors.Qdrant.UnitTests/QdrantVectorStoreRecordCollectionTests.cs b/dotnet/src/Connectors/Connectors.Qdrant.UnitTests/QdrantVectorStoreRecordCollectionTests.cs index 666efcc4647b..3d071066ae2b 100644 --- a/dotnet/src/Connectors/Connectors.Qdrant.UnitTests/QdrantVectorStoreRecordCollectionTests.cs +++ b/dotnet/src/Connectors/Connectors.Qdrant.UnitTests/QdrantVectorStoreRecordCollectionTests.cs @@ -561,7 +561,7 @@ public async Task CanSearchWithVectorAndFilterAsync(bool useDefinition, bo // Act. var actual = await sut.VectorizedSearchAsync( new ReadOnlyMemory(new[] { 1f, 2f, 3f, 4f }), - new() { IncludeVectors = true, Filter = filter, Top = 5, Skip = 2 }, + new() { IncludeVectors = true, OldFilter = filter, Top = 5, Skip = 2 }, this._testCancellationToken); // Assert. diff --git a/dotnet/src/Connectors/Connectors.Redis.UnitTests/RedisHashSetVectorStoreRecordCollectionTests.cs b/dotnet/src/Connectors/Connectors.Redis.UnitTests/RedisHashSetVectorStoreRecordCollectionTests.cs index fb15d0031c2b..117d3d1fcd4b 100644 --- a/dotnet/src/Connectors/Connectors.Redis.UnitTests/RedisHashSetVectorStoreRecordCollectionTests.cs +++ b/dotnet/src/Connectors/Connectors.Redis.UnitTests/RedisHashSetVectorStoreRecordCollectionTests.cs @@ -451,7 +451,7 @@ public async Task CanSearchWithVectorAndFilterAsync(bool useDefinition, bool inc new() { IncludeVectors = includeVectors, - Filter = filter, + OldFilter = filter, Top = 5, Skip = 2 }); diff --git a/dotnet/src/Connectors/Connectors.Redis.UnitTests/RedisJsonVectorStoreRecordCollectionTests.cs b/dotnet/src/Connectors/Connectors.Redis.UnitTests/RedisJsonVectorStoreRecordCollectionTests.cs index 6cfe1f17960e..49daf149c6e3 100644 --- a/dotnet/src/Connectors/Connectors.Redis.UnitTests/RedisJsonVectorStoreRecordCollectionTests.cs +++ b/dotnet/src/Connectors/Connectors.Redis.UnitTests/RedisJsonVectorStoreRecordCollectionTests.cs @@ -471,7 +471,7 @@ public async Task CanSearchWithVectorAndFilterAsync(bool useDefinition) new() { IncludeVectors = true, - Filter = filter, + OldFilter = filter, Top = 5, Skip = 2 }); diff --git a/dotnet/src/Connectors/Connectors.Weaviate.UnitTests/WeaviateVectorStoreRecordCollectionQueryBuilderTests.cs b/dotnet/src/Connectors/Connectors.Weaviate.UnitTests/WeaviateVectorStoreRecordCollectionQueryBuilderTests.cs index a0fa8b4f0ae0..1ee9d928599a 100644 --- a/dotnet/src/Connectors/Connectors.Weaviate.UnitTests/WeaviateVectorStoreRecordCollectionQueryBuilderTests.cs +++ b/dotnet/src/Connectors/Connectors.Weaviate.UnitTests/WeaviateVectorStoreRecordCollectionQueryBuilderTests.cs @@ -140,7 +140,7 @@ public void BuildSearchQueryWithFilterReturnsValidQuery() Skip = 2, Top = 3, VectorPropertyName = "DescriptionEmbedding", - Filter = new VectorSearchFilter() + OldFilter = new VectorSearchFilter() .EqualTo("HotelName", "Test Name") .AnyTagEqualTo("Tags", "t1") }; @@ -171,7 +171,7 @@ public void BuildSearchQueryWithInvalidFilterValueThrowsException() Skip = 2, Top = 3, VectorPropertyName = "DescriptionEmbedding", - Filter = new VectorSearchFilter().EqualTo("HotelName", new TestFilterValue()) + OldFilter = new VectorSearchFilter().EqualTo("HotelName", new TestFilterValue()) }; // Act & Assert @@ -196,7 +196,7 @@ public void BuildSearchQueryWithNonExistentPropertyInFilterThrowsException() Skip = 2, Top = 3, VectorPropertyName = "DescriptionEmbedding", - Filter = new VectorSearchFilter().EqualTo("NonExistentProperty", "value") + OldFilter = new VectorSearchFilter().EqualTo("NonExistentProperty", "value") }; // Act & Assert diff --git a/dotnet/src/Connectors/VectorData.Abstractions/VectorSearch/VectorSearchFilter.cs b/dotnet/src/Connectors/VectorData.Abstractions/VectorSearch/VectorSearchFilter.cs index 9d167fcb160b..731031ae6706 100644 --- a/dotnet/src/Connectors/VectorData.Abstractions/VectorSearch/VectorSearchFilter.cs +++ b/dotnet/src/Connectors/VectorData.Abstractions/VectorSearch/VectorSearchFilter.cs @@ -14,7 +14,7 @@ namespace Microsoft.Extensions.VectorData; /// to request that the underlying service filter the search results. /// All clauses are combined with and. /// -[Obsolete("Use VectorSearchOptions.NewFilter instead of VectorSearchOptions.Filter")] +[Obsolete("Use VectorSearchOptions.Filter instead of VectorSearchOptions.OldFilter")] public sealed class VectorSearchFilter { /// The filter clauses to and together. diff --git a/dotnet/src/Connectors/VectorData.Abstractions/VectorSearch/VectorSearchOptions.cs b/dotnet/src/Connectors/VectorData.Abstractions/VectorSearch/VectorSearchOptions.cs index 65d9c6e157c2..6ac552651379 100644 --- a/dotnet/src/Connectors/VectorData.Abstractions/VectorSearch/VectorSearchOptions.cs +++ b/dotnet/src/Connectors/VectorData.Abstractions/VectorSearch/VectorSearchOptions.cs @@ -13,13 +13,13 @@ public class VectorSearchOptions /// /// Gets or sets a search filter to use before doing the vector search. /// - [Obsolete("Use NewFilter instead")] - public VectorSearchFilter? Filter { get; init; } + [Obsolete("Use Filter instead")] + public VectorSearchFilter? OldFilter { get; init; } /// /// Gets or sets a search filter to use before doing the vector search. /// - public Expression>? NewFilter { get; init; } + public Expression>? Filter { get; init; } /// /// Gets or sets the name of the vector property to search on. diff --git a/dotnet/src/IntegrationTests/Connectors/Memory/AzureAISearch/AzureAISearchVectorStoreRecordCollectionTests.cs b/dotnet/src/IntegrationTests/Connectors/Memory/AzureAISearch/AzureAISearchVectorStoreRecordCollectionTests.cs index f7fb10081c76..09e47ca8c61d 100644 --- a/dotnet/src/IntegrationTests/Connectors/Memory/AzureAISearch/AzureAISearchVectorStoreRecordCollectionTests.cs +++ b/dotnet/src/IntegrationTests/Connectors/Memory/AzureAISearch/AzureAISearchVectorStoreRecordCollectionTests.cs @@ -68,7 +68,7 @@ public async Task ItCanCreateACollectionUpsertGetAndSearchAsync(bool useRecordDe new() { IncludeVectors = true, - Filter = new VectorSearchFilter().EqualTo("HotelName", "MyHotel Upsert-1") + OldFilter = new VectorSearchFilter().EqualTo("HotelName", "MyHotel Upsert-1") }); // Assert @@ -351,7 +351,7 @@ await fixture.EmbeddingGenerator.GenerateEmbeddingAsync("A great hotel"), { IncludeVectors = includeVectors, VectorPropertyName = "DescriptionEmbedding", - Filter = filter, + OldFilter = filter, }); // Assert. @@ -390,7 +390,7 @@ public async Task ItCanSearchWithVectorizableTextAndFiltersAsync() new() { VectorPropertyName = "DescriptionEmbedding", - Filter = filter, + OldFilter = filter, }); // Assert. diff --git a/dotnet/src/IntegrationTests/Connectors/Memory/AzureCosmosDBMongoDB/AzureCosmosDBMongoDBVectorStoreRecordCollectionTests.cs b/dotnet/src/IntegrationTests/Connectors/Memory/AzureCosmosDBMongoDB/AzureCosmosDBMongoDBVectorStoreRecordCollectionTests.cs index 7f471405b8c9..f873991177d3 100644 --- a/dotnet/src/IntegrationTests/Connectors/Memory/AzureCosmosDBMongoDB/AzureCosmosDBMongoDBVectorStoreRecordCollectionTests.cs +++ b/dotnet/src/IntegrationTests/Connectors/Memory/AzureCosmosDBMongoDB/AzureCosmosDBMongoDBVectorStoreRecordCollectionTests.cs @@ -409,7 +409,7 @@ public async Task VectorizedSearchReturnsValidResultsWithFilterAsync() // Act var actual = await sut.VectorizedSearchAsync(new ReadOnlyMemory([30f, 31f, 32f, 33f]), new() { - Filter = new VectorSearchFilter().EqualTo(nameof(AzureCosmosDBMongoDBHotel.HotelName), "My Hotel key2") + OldFilter = new VectorSearchFilter().EqualTo(nameof(AzureCosmosDBMongoDBHotel.HotelName), "My Hotel key2") }); // Assert diff --git a/dotnet/src/IntegrationTests/Connectors/Memory/AzureCosmosDBNoSQL/AzureCosmosDBNoSQLVectorStoreRecordCollectionTests.cs b/dotnet/src/IntegrationTests/Connectors/Memory/AzureCosmosDBNoSQL/AzureCosmosDBNoSQLVectorStoreRecordCollectionTests.cs index 3864a48288ef..546b957c68ae 100644 --- a/dotnet/src/IntegrationTests/Connectors/Memory/AzureCosmosDBNoSQL/AzureCosmosDBNoSQLVectorStoreRecordCollectionTests.cs +++ b/dotnet/src/IntegrationTests/Connectors/Memory/AzureCosmosDBNoSQL/AzureCosmosDBNoSQLVectorStoreRecordCollectionTests.cs @@ -343,7 +343,7 @@ public async Task VectorizedSearchReturnsValidResultsWithFilterAsync(VectorSearc // Act var actual = await sut.VectorizedSearchAsync(new ReadOnlyMemory([30f, 31f, 32f, 33f]), new() { - Filter = filter, + OldFilter = filter, Top = 4, }); diff --git a/dotnet/src/IntegrationTests/Connectors/Memory/MongoDB/MongoDBVectorStoreRecordCollectionTests.cs b/dotnet/src/IntegrationTests/Connectors/Memory/MongoDB/MongoDBVectorStoreRecordCollectionTests.cs index 3f88b10eef4b..c8cab7cb477e 100644 --- a/dotnet/src/IntegrationTests/Connectors/Memory/MongoDB/MongoDBVectorStoreRecordCollectionTests.cs +++ b/dotnet/src/IntegrationTests/Connectors/Memory/MongoDB/MongoDBVectorStoreRecordCollectionTests.cs @@ -410,7 +410,7 @@ public async Task VectorizedSearchReturnsValidResultsWithFilterAsync() // Act var actual = await sut.VectorizedSearchAsync(new ReadOnlyMemory([30f, 31f, 32f, 33f]), new() { - Filter = new VectorSearchFilter().EqualTo(nameof(MongoDBHotel.HotelName), "My Hotel key2") + OldFilter = new VectorSearchFilter().EqualTo(nameof(MongoDBHotel.HotelName), "My Hotel key2") }); // Assert diff --git a/dotnet/src/IntegrationTests/Connectors/Memory/Pinecone/PineconeVectorStoreRecordCollectionTests.cs b/dotnet/src/IntegrationTests/Connectors/Memory/Pinecone/PineconeVectorStoreRecordCollectionTests.cs index 7e19c73128d0..9b68eaf8d863 100644 --- a/dotnet/src/IntegrationTests/Connectors/Memory/Pinecone/PineconeVectorStoreRecordCollectionTests.cs +++ b/dotnet/src/IntegrationTests/Connectors/Memory/Pinecone/PineconeVectorStoreRecordCollectionTests.cs @@ -375,7 +375,7 @@ public async Task VectorizedSearchWithFilterAsync(bool collectionFromVectorStore // Act. var filter = new VectorSearchFilter().EqualTo(nameof(PineconeHotel.HotelCode), 42); - var actual = await hotelRecordCollection.VectorizedSearchAsync(searchVector, new() { Top = 1, Filter = filter }); + var actual = await hotelRecordCollection.VectorizedSearchAsync(searchVector, new() { Top = 1, OldFilter = filter }); var searchResults = await actual.Results.ToListAsync(); Assert.Single(searchResults); var searchResultRecord = searchResults.First().Record; diff --git a/dotnet/src/IntegrationTests/Connectors/Memory/Postgres/PostgresVectorStoreRecordCollectionTests.cs b/dotnet/src/IntegrationTests/Connectors/Memory/Postgres/PostgresVectorStoreRecordCollectionTests.cs index 6a479f0b10bf..58f3492074a6 100644 --- a/dotnet/src/IntegrationTests/Connectors/Memory/Postgres/PostgresVectorStoreRecordCollectionTests.cs +++ b/dotnet/src/IntegrationTests/Connectors/Memory/Postgres/PostgresVectorStoreRecordCollectionTests.cs @@ -387,7 +387,7 @@ public async Task VectorizedSearchWithEqualToFilterReturnsValidResultsAsync() { IncludeVectors = false, Top = 5, - Filter = new([ + OldFilter = new([ new EqualToFilterClause("HotelRating", 2.5f) ]) }); @@ -420,7 +420,7 @@ public async Task VectorizedSearchWithAnyTagFilterReturnsValidResultsAsync() { IncludeVectors = false, Top = 5, - Filter = new([ + OldFilter = new([ new AnyTagEqualToFilterClause("Tags", "tag2") ]) }); diff --git a/dotnet/src/IntegrationTests/Connectors/Memory/Qdrant/QdrantVectorStoreRecordCollectionTests.cs b/dotnet/src/IntegrationTests/Connectors/Memory/Qdrant/QdrantVectorStoreRecordCollectionTests.cs index 940687525238..667e713e844f 100644 --- a/dotnet/src/IntegrationTests/Connectors/Memory/Qdrant/QdrantVectorStoreRecordCollectionTests.cs +++ b/dotnet/src/IntegrationTests/Connectors/Memory/Qdrant/QdrantVectorStoreRecordCollectionTests.cs @@ -68,7 +68,7 @@ public async Task ItCanCreateACollectionUpsertGetAndSearchAsync(bool hasNamedVec var vector = await fixture.EmbeddingGenerator.GenerateEmbeddingAsync("A great hotel"); var actual = await sut.VectorizedSearchAsync( vector, - new() { Filter = new VectorSearchFilter().EqualTo("HotelCode", 30).AnyTagEqualTo("Tags", "t2") }); + new() { OldFilter = new VectorSearchFilter().EqualTo("HotelCode", 30).AnyTagEqualTo("Tags", "t2") }); // Assert var collectionExistResult = await sut.CollectionExistsAsync(); @@ -396,7 +396,7 @@ public async Task ItCanSearchWithFilterAsync(bool useRecordDefinition, string co vector, new() { - Filter = filter + OldFilter = filter }); // Assert. diff --git a/dotnet/src/IntegrationTests/Connectors/Memory/Redis/RedisHashSetVectorStoreRecordCollectionTests.cs b/dotnet/src/IntegrationTests/Connectors/Memory/Redis/RedisHashSetVectorStoreRecordCollectionTests.cs index 61018b2b7589..91723c852047 100644 --- a/dotnet/src/IntegrationTests/Connectors/Memory/Redis/RedisHashSetVectorStoreRecordCollectionTests.cs +++ b/dotnet/src/IntegrationTests/Connectors/Memory/Redis/RedisHashSetVectorStoreRecordCollectionTests.cs @@ -67,7 +67,7 @@ public async Task ItCanCreateACollectionUpsertGetAndSearchAsync(bool useRecordDe var actual = await sut .VectorizedSearchAsync( new ReadOnlyMemory(new[] { 30f, 31f, 32f, 33f }), - new() { Filter = new VectorSearchFilter().EqualTo("HotelCode", 1), IncludeVectors = true }); + new() { OldFilter = new VectorSearchFilter().EqualTo("HotelCode", 1), IncludeVectors = true }); // Assert var collectionExistResult = await sut.CollectionExistsAsync(); @@ -321,7 +321,7 @@ public async Task ItCanSearchWithFloat32VectorAndFilterAsync(string filterType, new() { IncludeVectors = includeVectors, - Filter = filter + OldFilter = filter }); // Assert diff --git a/dotnet/src/IntegrationTests/Connectors/Memory/Redis/RedisJsonVectorStoreRecordCollectionTests.cs b/dotnet/src/IntegrationTests/Connectors/Memory/Redis/RedisJsonVectorStoreRecordCollectionTests.cs index a12d710d9446..266948738ef6 100644 --- a/dotnet/src/IntegrationTests/Connectors/Memory/Redis/RedisJsonVectorStoreRecordCollectionTests.cs +++ b/dotnet/src/IntegrationTests/Connectors/Memory/Redis/RedisJsonVectorStoreRecordCollectionTests.cs @@ -66,7 +66,7 @@ public async Task ItCanCreateACollectionUpsertGetAndSearchAsync(bool useRecordDe var getResult = await sut.GetAsync("Upsert-10", new GetRecordOptions { IncludeVectors = true }); var actual = await sut.VectorizedSearchAsync( new ReadOnlyMemory(new[] { 30f, 31f, 32f, 33f }), - new() { Filter = new VectorSearchFilter().EqualTo("HotelCode", 10) }); + new() { OldFilter = new VectorSearchFilter().EqualTo("HotelCode", 10) }); // Assert var collectionExistResult = await sut.CollectionExistsAsync(); @@ -348,7 +348,7 @@ public async Task ItCanSearchWithFloat32VectorAndFilterAsync(string filterType) // Act var actual = await sut.VectorizedSearchAsync( vector, - new() { IncludeVectors = true, Filter = filter }); + new() { IncludeVectors = true, OldFilter = filter }); // Assert var searchResults = await actual.Results.ToListAsync(); diff --git a/dotnet/src/IntegrationTests/Connectors/Memory/Sqlite/SqliteVectorStoreRecordCollectionTests.cs b/dotnet/src/IntegrationTests/Connectors/Memory/Sqlite/SqliteVectorStoreRecordCollectionTests.cs index c0dbb5fcf680..f799fd26eaa8 100644 --- a/dotnet/src/IntegrationTests/Connectors/Memory/Sqlite/SqliteVectorStoreRecordCollectionTests.cs +++ b/dotnet/src/IntegrationTests/Connectors/Memory/Sqlite/SqliteVectorStoreRecordCollectionTests.cs @@ -423,7 +423,7 @@ public async Task VectorizedSearchReturnsValidResultsWithFilterAsync() // Act var searchResults = await sut.VectorizedSearchAsync(new ReadOnlyMemory([30f, 31f, 32f, 33f]), new() { - Filter = new VectorSearchFilter().EqualTo(nameof(SqliteHotel.HotelName), "My Hotel key2") + OldFilter = new VectorSearchFilter().EqualTo(nameof(SqliteHotel.HotelName), "My Hotel key2") }); var results = await searchResults.Results.ToListAsync(); diff --git a/dotnet/src/IntegrationTests/Connectors/Memory/Weaviate/WeaviateVectorStoreRecordCollectionTests.cs b/dotnet/src/IntegrationTests/Connectors/Memory/Weaviate/WeaviateVectorStoreRecordCollectionTests.cs index bd6348932937..494967b21fc7 100644 --- a/dotnet/src/IntegrationTests/Connectors/Memory/Weaviate/WeaviateVectorStoreRecordCollectionTests.cs +++ b/dotnet/src/IntegrationTests/Connectors/Memory/Weaviate/WeaviateVectorStoreRecordCollectionTests.cs @@ -300,7 +300,7 @@ public async Task VectorizedSearchReturnsValidResultsWithFilterAsync(VectorSearc // Act var actual = await sut.VectorizedSearchAsync(new ReadOnlyMemory([30f, 31f, 32f, 33f]), new() { - Filter = filter, + OldFilter = filter, Top = 4, }); @@ -345,7 +345,7 @@ public async Task VectorizedSearchReturnsValidResultsWithFilterAndDifferentDataT // Act var actual = await sut.VectorizedSearchAsync(new ReadOnlyMemory([40f, 40f, 40f, 40f]), new() { - Filter = filter, + OldFilter = filter, Top = 4, }); diff --git a/dotnet/src/SemanticKernel.Core/Data/TextSearch/VectorStoreTextSearch.cs b/dotnet/src/SemanticKernel.Core/Data/TextSearch/VectorStoreTextSearch.cs index 42781b1c5483..68ae09c883d5 100644 --- a/dotnet/src/SemanticKernel.Core/Data/TextSearch/VectorStoreTextSearch.cs +++ b/dotnet/src/SemanticKernel.Core/Data/TextSearch/VectorStoreTextSearch.cs @@ -200,7 +200,7 @@ private async Task> ExecuteVectorSearchAsync(string var vectorSearchOptions = new VectorSearchOptions { #pragma warning disable CS0618 // VectorSearchFilter is obsolete - Filter = searchOptions.Filter?.FilterClauses is not null ? new VectorSearchFilter(searchOptions.Filter.FilterClauses) : null, + OldFilter = searchOptions.Filter?.FilterClauses is not null ? new VectorSearchFilter(searchOptions.Filter.FilterClauses) : null, #pragma warning restore CS0618 // VectorSearchFilter is obsolete Skip = searchOptions.Skip, Top = searchOptions.Top, diff --git a/dotnet/src/SemanticKernel.Core/Data/VolatileVectorStoreRecordCollection.cs b/dotnet/src/SemanticKernel.Core/Data/VolatileVectorStoreRecordCollection.cs index e94f321eed4a..b6e5454dc4d6 100644 --- a/dotnet/src/SemanticKernel.Core/Data/VolatileVectorStoreRecordCollection.cs +++ b/dotnet/src/SemanticKernel.Core/Data/VolatileVectorStoreRecordCollection.cs @@ -238,12 +238,12 @@ public async Task> VectorizedSearchAsync(T } // Filter records using the provided filter before doing the vector comparison. - if (internalOptions.NewFilter is not null) + if (internalOptions.Filter is not null) { throw new NotSupportedException("LINQ-based filtering is not supported with VolatileVectorStore, use Microsoft.SemanticKernel.Connectors.InMemory instead"); } - var filteredRecords = VolatileVectorStoreCollectionSearchMapping.FilterRecords(internalOptions.Filter, this.GetCollectionDictionary().Values); + var filteredRecords = VolatileVectorStoreCollectionSearchMapping.FilterRecords(internalOptions.OldFilter, this.GetCollectionDictionary().Values); // Compare each vector in the filtered results with the provided vector. var results = filteredRecords.Select((record) => diff --git a/dotnet/src/SemanticKernel.UnitTests/Data/VolatileVectorStoreRecordCollectionTests.cs b/dotnet/src/SemanticKernel.UnitTests/Data/VolatileVectorStoreRecordCollectionTests.cs index edd169a725ff..b93c00952705 100644 --- a/dotnet/src/SemanticKernel.UnitTests/Data/VolatileVectorStoreRecordCollectionTests.cs +++ b/dotnet/src/SemanticKernel.UnitTests/Data/VolatileVectorStoreRecordCollectionTests.cs @@ -338,7 +338,7 @@ public async Task CanSearchWithVectorAndFilterAsync(bool useDefinition, TK var filter = filterType == "Equality" ? new VectorSearchFilter().EqualTo("Data", $"data {testKey2}") : new VectorSearchFilter().AnyTagEqualTo("Tags", $"tag {testKey2}"); var actual = await sut.VectorizedSearchAsync( new ReadOnlyMemory(new float[] { 1, 1, 1, 1 }), - new() { IncludeVectors = true, Filter = filter, IncludeTotalCount = true }, + new() { IncludeVectors = true, OldFilter = filter, IncludeTotalCount = true }, this._testCancellationToken); // Assert diff --git a/dotnet/src/VectorDataIntegrationTests/VectorDataIntegrationTests/Filter/BasicFilterTests.cs b/dotnet/src/VectorDataIntegrationTests/VectorDataIntegrationTests/Filter/BasicFilterTests.cs index 138f3863a5d4..0f87d2ae7c5d 100644 --- a/dotnet/src/VectorDataIntegrationTests/VectorDataIntegrationTests/Filter/BasicFilterTests.cs +++ b/dotnet/src/VectorDataIntegrationTests/VectorDataIntegrationTests/Filter/BasicFilterTests.cs @@ -235,7 +235,7 @@ protected virtual async Task TestFilterAsync( new ReadOnlyMemory([1, 2, 3]), new() { - NewFilter = filter, + Filter = filter, Top = fixture.TestData.Count }); @@ -270,7 +270,7 @@ protected virtual async Task TestLegacyFilterAsync( new ReadOnlyMemory([1, 2, 3]), new() { - Filter = legacyFilter, + OldFilter = legacyFilter, Top = fixture.TestData.Count }); diff --git a/dotnet/src/VectorDataIntegrationTests/VectorDataIntegrationTests/Support/TestStore.cs b/dotnet/src/VectorDataIntegrationTests/VectorDataIntegrationTests/Support/TestStore.cs index 3facbed3c916..bff2f583633e 100644 --- a/dotnet/src/VectorDataIntegrationTests/VectorDataIntegrationTests/Support/TestStore.cs +++ b/dotnet/src/VectorDataIntegrationTests/VectorDataIntegrationTests/Support/TestStore.cs @@ -84,7 +84,7 @@ public virtual async Task WaitForDataAsync( Top = recordCount, // In some databases (Azure AI Search), the data shows up but the filtering index isn't yet updated, // so filtered searches show empty results. Add a filter to the seed data check below. - NewFilter = filter + Filter = filter }); var count = await results.Results.CountAsync(); if (count == recordCount)