Skip to content
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

Merged
merged 8 commits into from
Oct 23, 2024

Conversation

ijreilly
Copy link
Collaborator

No description provided.

Copy link
Contributor

@greptile-apps greptile-apps bot left a 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 new useSearchRecords 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

@ijreilly ijreilly requested a review from Weiko October 22, 2024 13:35
if (fieldMetadata.type === FieldMetadataType.RELATION) {
continue;
}
const fieldMetadataCollectionGroupByObjectMetadataId =
Copy link
Member

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.

Copy link
Member

@Weiko Weiko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, good job!

@Weiko Weiko enabled auto-merge (squash) October 23, 2024 13:36
@Weiko Weiko disabled auto-merge October 23, 2024 13:49
@Weiko Weiko merged commit 849d7c2 into main Oct 23, 2024
17 of 18 checks passed
@Weiko Weiko deleted the search-vector-for-notes branch October 23, 2024 13:49
charlesBochet pushed a commit that referenced this pull request Nov 8, 2024
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants