Skip to content

Support jsonb for HasGeneratedTsVectorColumn #2215

Description

Are there any examples or references of how to use stored tsvector like this documentation here for array types and jsonb types ?: https://www.npgsql.org/efcore/mapping/full-text-search.html?tabs=pg12%2Cv5#method-1-tsvector-column

Activity

  1. roji commented on Jan 12, 2022

    @roji
    Member

    @toklive I'm not sure how tsvector would be compatible with arrays specifically... In any case, I'd recommend looking at general PostgreSQL documentation - if you can define a generated tsvector column over array/jsonb, you should be able to follow the Npgsql instructions as they are.

    Let me know if you run into any blockers which are specifically related to Npgsql (as opposed to PostgreSQL).

  2. added this to the Backlog milestone on Jan 13, 2022
  3. roji commented on Jan 13, 2022

    @roji
    Member

    Thanks for the additional detail. HasGeneratedTsVectorColumn is very simple sugar which creates a generated column with a very specific and simple SQL expression - it definitely does not recognize arrays or generate array_to_tsvector or jsonb_to_tsvector. I'll take a look at adding this.

    However, you can simply set up the generated column yourself, providing whatever SQL you want - see the EF docs for more information (again, HasGeneratedTsVectorColumn basically does this exact thing under the hood).

    Finally, the stack trace you posted above doesn't seem related to any of this - that looks like a report about a malformed connection string. Check exactly what you're using and make sure it's a valid connection string, if you can't figure it out post it here and I'll try to help.

  4. roji commented on Jan 13, 2022

    @roji
    Member

    If I can find a SQL query for the same would be great as I will use the raw SQL with the migration,

    No need for raw SQL in migrations - just use HasComputedColumnSql as per the EF docs.

    As for the actual SQL to use - I don't have any specific experience in full-text search over arrays/json... Try getting the SQL to work based on the PostgreSQL docs, and if you do please post back here.

  5. changed the title [-]Documentation or sample on stored tsvector for arrays and jsonb type columns[/-] [+]Support for array and jsonb for HasComputedColumnSql[/+] on Jan 13, 2022
  6. roji commented on Jan 13, 2022

    @roji
    Member

    That exception still seems partial - the actual message isn't in there.

  7. changed the title [-]Support for array and jsonb for HasComputedColumnSql[/-] [+]Support for array and jsonb for HasGeneratedTsVectorColumn[/+] on Jan 16, 2022
  8. changed the title [-]Support for array and jsonb for HasGeneratedTsVectorColumn[/-] [+]Support jsonb for HasGeneratedTsVectorColumn[/+] on Jan 16, 2022
  9. self-assigned this
    on Jan 16, 2022
  10. modified the milestones: Backlog, 7.0.0 on Jan 16, 2022
  11. added a commit that references this issue on Jan 16, 2022
    fd85aa6
  12. added 2 commits that reference this issue on May 17, 2022
    e26e08e
    8b8bd6d
  13. added a commit that references this issue on May 17, 2022
    4b93f74
  14. added theissue type on Jun 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions