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:
@ -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}, '')`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user