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): switch to legacy search if custom GROQ filter contains incompatible operation #6566
Draft
juice49
wants to merge
5
commits into
next
Choose a base branch
from
fix/sdx-1313-hybrid-search
base: next
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+234
−2
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
juice49
changed the title
fix(sanity): switch to legacy search if custom GROQ filter contains s…
fix(sanity): switch to legacy search if custom GROQ filter contains subquery
May 3, 2024
No changes to documentation |
Component Testing Report Updated May 23, 2024 4:07 PM (UTC)
|
juice49
force-pushed
the
fix/sdx-1313-hybrid-search
branch
from
May 3, 2024 16:03
521a822
to
672cdd6
Compare
juice49
changed the title
fix(sanity): switch to legacy search if custom GROQ filter contains subquery
fix(sanity): switch to legacy search if custom GROQ filter contains incompatible operation
May 3, 2024
juice49
force-pushed
the
fix/sdx-1313-hybrid-search
branch
from
May 22, 2024 10:54
02f82f2
to
f7e5fcb
Compare
juice49
force-pushed
the
fix/sdx-1313-hybrid-search
branch
from
May 23, 2024 14:38
f7e5fcb
to
9ee013b
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This branch adopts a hybrid approach for supporting the Text Search API alongside the GROQ Query API. This is applicable for parts of Studio that support custom GROQ filters, such as document lists and reference fields. Studio's filter API allows developers to use any GROQ operation, but unfortunately, the Text Search API does not provide a full GROQ implementation for filtering. Notably, it currently lacks support for dereferences, subqueries, and function calls.
With this change, Studio will fall back to the GROQ Query API if it detects any operation in the filter GROQ that is incompatible with the Text Search API. This makes it possible to enable Text Search API for Studios without the filter configuration leading to errors.
What to review
Testing
packages/sanity/src/core/search/utils/groq.test.ts
.In a Studio that has the Text Search API search strategy enabled, try using a document list or reference field that has an incompatible GROQ filter configured.
You can enable text search API by setting the search.enableLegacySearch Studio configuration property to false.
When navigating Studio, you should see data is generally sourced used the Text Search API (
data/textsearch
).There is an example of an incompatible reference field in the test-studio named
referenceWithSubqueryFilter
. You can find it by navigating to http://localhost:3333/test/structure/input-standard;referenceTest;c5a278ae-f38c-47aa-b95f-f038db7d9c9f and scrolling to the "Subquery filter" field.