-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Implement search for rich text fields and use it for notes #7953
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This pull request implements search functionality for rich text fields, focusing on enhancing search capabilities for notes. Here are the key changes:
- Added support for searching rich text fields in the
is-searchable-field.util.ts
file - Implemented a new search vector field for notes in
note.workspace-entity.ts
- Updated
CommandMenu.tsx
to use the newuseSearchRecords
hook for notes search - Modified
get-ts-vector-column-expression.util.ts
to handle rich text fields using JSON path queries - Adjusted migration sorting logic in
workspace-migration.service.ts
to prioritize TS_VECTOR field creation - Added a new 'searchVector' field ID in
standard-field-ids.ts
for notes
These changes collectively improve the search experience for notes, particularly those with rich text content.
7 file(s) reviewed, 10 comment(s)
Edit PR Review Bot Settings | Greptile
...twenty-server/src/engine/metadata-modules/workspace-migration/workspace-migration.service.ts
Outdated
Show resolved
Hide resolved
...twenty-server/src/engine/metadata-modules/workspace-migration/workspace-migration.service.ts
Outdated
Show resolved
Hide resolved
...twenty-server/src/engine/metadata-modules/workspace-migration/workspace-migration.service.ts
Outdated
Show resolved
Hide resolved
...twenty-server/src/engine/metadata-modules/workspace-migration/workspace-migration.service.ts
Outdated
Show resolved
Hide resolved
...workspace-manager/workspace-migration-builder/factories/workspace-migration-field.factory.ts
Outdated
Show resolved
Hide resolved
...gine/workspace-manager/workspace-sync-metadata/utils/get-ts-vector-column-expression.util.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/modules/note/standard-objects/note.workspace-entity.ts
Show resolved
Hide resolved
packages/twenty-server/src/modules/note/standard-objects/note.workspace-entity.ts
Show resolved
Hide resolved
if (fieldMetadata.type === FieldMetadataType.RELATION) { | ||
continue; | ||
} | ||
const fieldMetadataCollectionGroupByObjectMetadataId = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grouping field migrations by object so we can have a unique migration per object with all fields keeping order of insertion. This is helping because searchVector column needs to be created after the ones that are used in the expression so we need to have a reliable way to keep the correct order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, good job!
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](#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.
No description provided.