Update searchVector expression based on rich text fields (#8390)

Search vector fields based on `RICH_TEXT` fields were generated using a
treatment on `RICH_TEXT` fields's `body`
column, to only extract and index the core text.
([PR](https://github.com/twentyhq/twenty/pull/7953))

Actually our RICH_TEXT fields are of datatype `text` in our database,
allowing users to insert non-json values, which breaks the search vector
generation (as it expects json values).

Our vision is unclear for now: for instance we may want to turn
RICH_TEXT into a composite field where the plain text would be stored in
a different column.

So for now, we will (1) treat rich_text data as text, and (2) update the
search vector expressions for the existing workspaces.
This commit is contained in:
Marie
2024-11-08 12:41:11 +01:00
committed by GitHub
parent 813c57fba6
commit 8b5e90aca9
5 changed files with 175 additions and 2 deletions

View File

@ -87,8 +87,6 @@ const getColumnExpression = (
''
)
`;
case FieldMetadataType.RICH_TEXT:
return `COALESCE(jsonb_path_query_array(${quotedColumnName}::jsonb, '$[*].content[*]."text"'::jsonpath)::text, '')`;
default:
return `COALESCE(${quotedColumnName}, '')`;
}