Repository navigation
fix(queries): reject search on attributes without a fulltext index - #13208
Merged
Merged
Conversation
Search queries require a fulltext index on the attribute. The system collection validators never knew about indexes, so a search on any unindexed attribute passed validation and was rejected later inside Database::find() as a QueryException the list endpoints do not catch, surfacing to callers as a 500. Extend the base validator from IndexedQueries and pass the collection's indexes, so the query is rejected during param validation with the attribute named, matching what the user-collection document path already does. Only the synthetic 'search' attribute carries a fulltext index, and it stays valid where a validator allows it.
Contributor
Greptile SummaryThe PR converts database-level query validation failures in three list endpoints into the established
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Reviews (4): Last reviewed commit: "fix(tests): call variables endpoint dire..." | Re-trigger Greptile |
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
abnegate
reviewed
Aug 14, 2026
abnegate
approved these changes
Aug 14, 2026
2 tasks done
This file contains hidden or 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
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.
What
Query::search()on an attribute without a fulltext index returns a 500 instead of a 4xx. Four issues in Sentry, ~3400 events, oldest first seen 2025-05-19.functions.listnameproxy.listRulesdomainsites.listLogsrequestPathfunctions.listVariableskeyWhy
The endpoint query validators do not know about collection indexes, so these searches pass request validation.
Database::find()revalidates them against the stored collection metadata and throwsUtopia\Database\Exception\Query. The endpoints only caught that exception while parsing the query strings, allowing the database exception to escape as a 500.Change
Catch
QueryExceptionaround thefind()andcount()calls and returnGENERAL_QUERY_INVALID, matching the document list endpoint.This PR updates the three affected Appwrite endpoints:
src/Appwrite/Platform/Modules/Functions/Http/Functions/XList.phpsrc/Appwrite/Platform/Modules/Functions/Http/Variables/XList.phpsrc/Appwrite/Platform/Modules/Proxy/Http/Rules/XList.phpsites.listLogsnow lives in the Cloud repository. Its handler was updated on the matchingfix/reject-search-without-fulltext-indexbranch.The dedicated
searchparameter remains unaffected because it searches the indexed syntheticsearchattribute.Tests
Added E2E coverage asserting that each reported query returns HTTP 400 with
general_query_invalid:functions.listsearchingnamefunctions.listVariablessearchingkeyproxy.listRulessearchingdomainsites.listLogssearchingrequestPath(Cloud branch)Checks
composer linton the changed Appwrite handlers and testscomposer analyzeon the changed Appwrite handlers and testsphp -lon the changed Cloud handler and testThe E2E tests require the Appwrite and Cloud stacks and were not run locally.