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
[release/9.0-staging] Cosmos Full Text Search support (query part) (#35909)
* Limited port of #35868Fixes#35476Fixes#35853 (need to fix this one, otherwise vector translator will try to translate full text methods and fail)
Description
This PR enables full-text search queries using EF Core 9 when targeting Azure Cosmos Db. This is one of the flagship new features for Cosmos and the aim here is to help with it's adoption. This is very limited port of the full feature we are adding in EF 10 Preview 4. We are only adding querying capabilities: function stubs for FullTextContains, FullTextContainsAll, FullTextContainsAny, FullTextScore and RRF as well as logic translating these signatures to built-in Cosmos functions.
No model building or data manipulation - containers need to be created outside EF (using Cosmos SDK or in the Data Explorer).
Customer impact
Customers will be able to use the upcoming full text search capabilities when working with Azure Cosmos Db without the need to upgrade to EF 10 preview.
How found
Partner team ask.
Regression
No
Testing
Extensively tested on EF 10, manual testing on EF9. End-to-end testing is not possible because we can't create containers programmatically (no support for it inside EF Core itself, and the Cosmos SDK which supports it is currently only available in beta, so we can't take dependency on it). Instead, we created containers and data using EF 10, ported all the query tests from EF 10 and ran them using the EF9 bits.
Risk
Low. Code here is purely additive and actually localized to only a handful of places in the code: validation in ApplyOrdering/AppendOrdering, FTS method translator, parameter inliner and sql generator. Feature is marked as experimental and quirks have been added.
* fix FTContainsAll/Any for constants,
change TFScore signature to accept params,
fixed SqlFunctionExpression to use the new ctor internally,
added mandatory property overrides for FragmentExpression (vector search)
fixed parameter inliner to not match parameter of type string, but only string[] when processing ContainsAll/Any
<value>The entity of type '{entityType}' is mapped as a part of the document mapped to '{missingEntityType}', but there is no tracked entity of this type with the corresponding key value. Consider using 'DbContextOptionsBuilder.EnableSensitiveDataLogging' to see the key values.</value>
Check.DebugAssert(UseOldBehavior35476||orderByScoringFunction||selectExpression.Orderings.All(x =>x.Expressionis not SqlFunctionExpression{IsScoringFunction:true}),
354
+
"Scoring function can only appear as first (and only) ordering, or not at all.");
355
+
344
356
GenerateList(selectExpression.Orderings, e =>Visit(e));
Copy file name to clipboardExpand all lines: src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.InExpressionValuesExpandingExpressionVisitor.cs
0 commit comments