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(sanity): do not order by _updatedAt when relevance ordering is used with Text Search API search strategy #6537

Merged
merged 3 commits into from
May 2, 2024

Conversation

juice49
Copy link
Contributor

@juice49 juice49 commented May 1, 2024

Description

This branch relates only to global search.

Ordering by relevance ("best match") when using the GROQ Query API search strategy causes the order {direction: 'desc', field: '_updatedAt'} to be applied. This is correct, because the results are subsequently ordered client-side.

However, this is incorrect when using the Text Search API search strategy. The Text Search API yields results ordered by relevance by default, and we do not apply any client-side ordering.

This branch eliminates the incorrectly applied {direction: 'desc', field: '_updatedAt'} ordering when the Text Search API search strategy is used.

What to review

  • order(_updatedAt desc) is still present in the GROQ Query API request when ordering by relevance using the GROQ Query API search strategy.
  • {order: [{"attribute": "_updatedAt", "direction": "desc"}] is not present in the Text Search API request when ordering by relevance using the Text Search API search strategy.

Testing

Added unit tests to packages/sanity/src/core/studio/components/navbar/search/contexts/search/reducer.test.ts.

Copy link

vercel bot commented May 1, 2024

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

Name Status Preview Comments Updated (UTC)
performance-studio ✅ Ready (Inspect) Visit Preview May 2, 2024 8:13am
studio-workshop 🔄 Building (Inspect) Visit Preview 💬 Add feedback May 2, 2024 8:13am
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 2, 2024 8:13am
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 2, 2024 8:13am

Copy link
Contributor

github-actions bot commented May 1, 2024

No changes to documentation

@juice49 juice49 changed the title Fix/sdx 1310 global search relevance order fix(sanity): do not order by _updatedAt when relevance ordering is used with Text Search API search strategy May 1, 2024
Copy link
Contributor

github-actions bot commented May 1, 2024

Component Testing Report Updated May 2, 2024 8:18 AM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 34s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 6s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 26s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 20s 6 3 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 13s 6 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 35s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 3s 14 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 3s 18 0 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 20s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 14s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 21s 9 0 0

Copy link
Contributor

@ricokahler ricokahler left a comment

Choose a reason for hiding this comment

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

nice work!

@juice49 juice49 added this pull request to the merge queue May 2, 2024
Merged via the queue into next with commit 0ede4cf May 2, 2024
39 checks passed
@juice49 juice49 deleted the fix/sdx-1310-global-search-relevance-order branch May 2, 2024 13:00
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

3 participants