Search code examples
postgresql.net-coreentity-framework-corenpgsqlef-core-3.0

Why cant I add IsTsVectorExpressionIndex to modulebuilder for EF CORE using postgresql?


I am trying to set up full text search in a .net core 3-web app, using the instructions on NPGSQL website https://www.npgsql.org/efcore/mapping/full-text-search.html?tabs=pg12

In the OnModelCreating-method I set it up according to specifications:

        modelBuilder.Entity<Clinic>()
            .HasIndex(p => new { p.Name, p.SlugUrl })
            .IsTsVectorExpressionIndex("english");

But get the error that IndexBuilder' does not contain a definition for 'IsTsVectorExpressionIndex'.

I tried adding a bunch of nuget-packages, but they dont seem to solve the problem. Creating the index without the TSVector works fine.

Any ideas what Im doing wrong? Packages downloaded:

<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.0" />
<PackageReference Include="Npgsql" Version="4.1.6" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.1.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.1.8" />

Solution

  • IsTsVectorExpressionIndex was only introduced in version 5.0.0 of the provider, which was just released a couple hours ago.