-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple Index on same property? #2522
Comments
EF can definitely generate this, but you need to define the name inside HasIndex, and not via HasDatabaseName: builder.Entity<Customer>()
.HasIndex(c => c.Name, "IX_Customers_Namer");
builder.Entity<Customer>()
.HasIndex(c => c.Name, "IX_Customers_Name_GIN")
.HasMethod("GIN")
.HasOperators("gin_trgm_ops"); Let me know if that works for you. I've opened dotnet/EntityFramework.Docs#4081 to add this to the EF docs |
It works like charm. Thanks |
I think this overload of HasIndex is unavailable when using OwnedNavigationBuilder. What are alternatives here? |
@prcdpr can you please open an issue for this on the EF Core repo? In the meantime, you can always create indexes via SQL in your migrations. |
I wanted to create two indexes on the same property. Like one GIN and the other one normal. But EF only generates sql for one index.
I found this issue on efcore repo. But didn't help. Because PostgreSQL supports multiple indexes on the same property. So why can't generate SQL for that?
Is it something I'm doing wrong here? I need both of these indexes. Because GIN helps a lot when running LIKE or ILIKE query(My applicated uses LIKE heavily) and also needs a normal index for the equal query.
The text was updated successfully, but these errors were encountered: