Skip to content

Latest commit

 

History

History
92 lines (64 loc) · 5.18 KB

File metadata and controls

92 lines (64 loc) · 5.18 KB

Entity Framework Core 10 Preview 4 - Release Notes

Here's a summary of what's new in Entity Framework Core in this preview release:

Entity Framework Core 10 updates:

Full-text search support on Azure Cosmos DB for NoSQL

Azure Cosmos DB now offers support for full-text search. It enables efficient and effective text searches, as well as evaluating the relevance of documents to a given search query. It can be used in combination with vector search to improve the accuracy of responses in some AI scenarios. EF Core 10 is adding support for this feature allowing for modeling the database with full-text search enabled properties and using full-text search functions inside queries targeting Azure Cosmos DB.

Here is a basic EF model configuration enabling full-text search on one of the properties:

public class Blog
{
    ...

    public string Contents { get; set; }
}

public class BloggingContext
{
    ...

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<Blog>(b =>
        {
            b.Property(x => x.Contents).EnableFullTextSearch();
            b.HasIndex(x => x.Contents).IsFullTextIndex();
        });
    }
}

Once the model is configured, we can use full-text search operations in queries using methods provided in EF.Functions:

var cosmosBlogs = await context.Blogs.Where(x => EF.Functions.FullTextContains(x.Contents, "cosmos")).ToListAsync();

The following full-text operations are currently supported: FullTextContains, FullTextContainsAll, FullTextContainsAny, FullTextScore.

For more information on Cosmos full-text search, see the docs.

Hybrid search

EF Core now supports RRF (Reciprocal Rank Fusion) function, which combines vector similarity search and full-text search (i.e. hybrid search). Here is an example query using hybrid search:

float[] myVector = /* generate vector data from text, image, etc. */
var hybrid = await context.Blogs.OrderBy(x => EF.Functions.Rrf(
        EF.Functions.FullTextScore(x.Contents, "database"), 
        EF.Functions.VectorDistance(x.Vector, myVector)))
    .Take(10)
    .ToListAsync();

For more information on Cosmos hybrid search, see the docs.

Vector similarity search exits preview

In EF9 we added experimental support for vector similarity search. In EF Core 10, vector similarity search support is no longer experimental. We have also made some improvements to the feature:

  • EF Core can now generate containers with vector properties defined on owned reference entities. Containers with vector properties defined on owned collections still have to be created by other means. However, they can be used in queries.
  • Model building APIs have been renamed. A vector property can now be configured using the IsVectorProperty method, and vector index can be configured using the IsVectorIndex method.

For more information on Cosmos vector search, see the docs.

Small improvements

  • Translate COALESCE as ISNULL (#34171, contributed by @ranma42).
  • Support for some string functions taking char as arguments (#34999, contributed by @ChrisJollyAU).
  • Support for MAX/MIN/ORDER BY using decimal on SQLite (#35606, contributed by @ranma42).
  • Changed AsyncLocal to ThreadId for better Lazy loader performance (#35835, contributed by @henriquewr).

Everything else in Preview 4

Preview 4 contains: