You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d9f0ee0
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: dotnet/src/Connectors/Connectors.AzureCosmosDBNoSQL.UnitTests/AzureCosmosDBNoSQLVectorStoreCollectionQueryBuilderTests.cs
+79-38Lines changed: 79 additions & 38 deletions
Original file line number
Diff line number
Diff line change
@@ -35,16 +35,18 @@ public void BuildSearchQueryByDefaultReturnsValidQueryDefinition()
Assert.Contains("SELECT TOP @top x.test_property_1,x.test_property_2,x.test_property_3,VectorDistance(x.test_property_1, @vector) AS TestScore",queryText);
100
+
Assert.Contains("SELECT TOP 10 x.test_property_1,x.test_property_2,x.test_property_3,VectorDistance(x.test_property_1, @vector) AS TestScore",queryText);
103
101
Assert.Contains("FROM x",queryText);
104
102
Assert.Contains("WHERE x.test_property_2 = @cv0 AND ARRAY_CONTAINS(x.test_property_3, @cv1)",queryText);
105
103
Assert.Contains("ORDER BY VectorDistance(x.test_property_1, @vector)",queryText);
Copy file name to clipboardExpand all lines: dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBNoSQL/AzureCosmosDBNoSQLVectorStoreCollectionQueryBuilder.cs
+29-16Lines changed: 29 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -23,28 +23,38 @@ internal static class AzureCosmosDBNoSQLVectorStoreCollectionQueryBuilder
varvectorDistanceArgumentWithAlias=$"{vectorDistanceArgument} AS {scorePropertyName}";
44
47
48
+
// Passing keywords using a parameter is not yet supported for FullTextScore so doing some crude string sanitization in the mean time to frustrate script injection.
49
+
varsanitizedKeywords=keywordsis not null?keywords.Select(x =>x.Replace("\"","")):null;
50
+
varformattedKeywords=sanitizedKeywordsis not null?$"[\"{string.Join("\", \"",sanitizedKeywords)}\"]":null;
51
+
varfullTextScoreArgument=textPropertyNameis not null&&keywordsis not null?$"FullTextScore({tableVariableName}.{textPropertyName}, {formattedKeywords})":null;
0 commit comments