Open
Description
Describe the bug
Performing a HybridSearchAsync
with keywords
results in the error:
The second through last arguments of the 'FullTextScore' function must be literals of type string or object specifying the fuzzy search argument containing a 'term' property which is a string and a 'distance' property which is a number between 0 and 2 (inclusive).
To Reproduce
Steps to reproduce the behavior:
- Create a new
CosmosNoSqlCollection
:
var collection = new <string, MyModel>(
database,
container,
new CosmosNoSqlCollectionOptions
{
PartitionKeyPropertyName = nameof(MyModel.Id)
});
- Use the collection:
collection.HybridSearchAsync(query.Vector, ["test keyword"], top: 5);
- See error included above.
Expected behavior
The search results back without error
Platform
- Language: C#
- Source: Microsoft.SemanticKernel.Connectors.CosmosNoSql, version: 1.57.0-preview
- IDE: Rider
- OS: Linux
Additional context
It seems the code in CosmosNoSqlCollectionQueryBuilder
for BuildSearchQuery
is generating the query to Cosmos like so:
SELECT TOP 10 * FROM c ORDER BY RANK RRF(VectorDistance(c.vector, [1,2,3]), FullTextScore(c.content, ["searchable", "text", "goes" ,"here"]))
When it should it actually generate, i.e. without the brackets [
, ]
:
SELECT TOP 10 * FROM c ORDER BY RANK RRF(VectorDistance(c.vector, [1,2,3]), FullTextScore(c.content, "searchable", "text", "goes" ,"here"))