If we bump the minimum up to PHP8 for version 2, we could add attributes in the Entity definition
#[FullText(index: 'main')]
We could then hook into the doctrine migrations and generate a migration that created the proper index.
Then instead of having
@TsVector(name="fts", fields={"name", "city"})
We could tag the name and city properties with the index name, and generate a migration and changed the index accordingly. The seems like it'd a much better DX.
https://www.postgresql.org/docs/current/ddl-generated-columns.html
full text search seems like a perfect use of generated columns, e.g.
ALTER TABLE se_details ADD COLUMN ts tsvector GENERATED ALWAYS AS (to_tsvector('english', event_narrative)) STORED;
Since the column with automatically sync with the source data.
I got this idea from
https://blog.crunchydata.com/blog/postgres-full-text-search-a-search-engine-in-a-database
If we bump the minimum up to PHP8 for version 2, we could add attributes in the Entity definition
We could then hook into the doctrine migrations and generate a migration that created the proper index.
Then instead of having
We could tag the name and city properties with the index name, and generate a migration and changed the index accordingly. The seems like it'd a much better DX.