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

fix(search): include text type fields in search queries #6895

Merged
merged 1 commit into from
Jun 11, 2024

Conversation

rexxars
Copy link
Member

@rexxars rexxars commented Jun 10, 2024

Description

It seems we do not include fields of type text in the list of fields to search for.
Upon some investigation, it seems like we are traversing the type chain in order to find any type that extends from string. This isn't strictly necessary, as there is a jsonType property that allows us to more easily tell this. The text type does not actually "extend" string in the same way as user-defined types does, so it did not pass the previous check.

This PR changes to use jsonType for determining the string fields.

See #6698

What to review

  • Searching for text in string fields work
  • Searching for text in text fields work
  • Searching for text in portable text fields work

Testing

Added a test to the function that derives weights from types that checks that both text fields and fields of types that extend text are included in the search.

Notes for release

  • Fixes an issue where searching for text within fields of type text (not string) would not yield results

Copy link

vercel bot commented Jun 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 10, 2024 10:28pm
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 10, 2024 10:28pm
test-compiled-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 10, 2024 10:28pm
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 10, 2024 10:28pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 10, 2024 10:28pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Jun 10, 2024 10:28pm

Copy link
Contributor

No changes to documentation

Copy link
Contributor

Component Testing Report Updated Jun 10, 2024 10:32 PM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 36s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 6s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 27s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 31s 11 7 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 14s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 9s 3 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 36s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 17s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 5s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 7s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 21s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 15s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 31s 12 0 0

@rexxars rexxars marked this pull request as ready for review June 10, 2024 22:42
@rexxars rexxars requested a review from a team as a code owner June 10, 2024 22:42
@rexxars rexxars requested review from pedrobonamin and juice49 and removed request for a team and pedrobonamin June 10, 2024 22:42
Copy link
Contributor

@juice49 juice49 left a comment

Choose a reason for hiding this comment

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

Thank you! That makes sense, and works as expected.

@juice49 juice49 added this pull request to the merge queue Jun 11, 2024
Merged via the queue into next with commit 5e505ac Jun 11, 2024
45 checks passed
@juice49 juice49 deleted the fix/SDX-1353/include-text-fields-in-search branch June 11, 2024 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants