-
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
Support table splitting with HasGeneratedTsVectorColumn #2391
Comments
You cannot include an entity type directly in HasGeneratedTsVectorColumn - you must reference specific columns you want included. However, unfortunately drilling into an owned entity is also unsupported at the moment - see dotnet/efcore#11336 for a very similar issue for indexes with EF Core (once that's done, we can do the same thing here). The good news is that it's easy to work around this: HasGeneratedTsVectorColumn is nothing but sugar over HasComputedColumnSql. So you can simply configure SearchVector with HasComputedColumn and directly provide the SQL to reference the columns you want. This typically would something like the following: modelBuilder.Entity<Blog>().Property(b => b.TsVector)
.HasComputedColumnSql(@"to_tsvector('english', ""FirstName"", ""Address_Something"")"); I'll leave this open to track adding support to HasGeneratedTsVectorColumn someday. |
Wow, very interesting. Thank you for your quick reply. When using |
@span no, you still need to specify HasIndex if you want an index. HasComputedColumnSql only creates the computed column - it does not create an index for you. |
I am trying to add owned types to my
NpgsqlTsVector
column, but when adding the migration it fails with an argument null exception.Stack trace:
Config (firstname is string, adress is owned type):
I can't find any references or examples where owned types are used for the search column so perhaps this is not supported? Any way to work around it? Perhaps serialize into a json column?
The text was updated successfully, but these errors were encountered: