Repository navigation
Conversation
doQuery() assumed every response was a SQL result-set and crashed with
an uncaught TypeError ("Cannot read properties of undefined (reading
'docs')") whenever it wasn't - e.g. when the sql module/handler isn't
installed, which returns a 404 JSON body with no "result-set" key. The
UI was then left showing a blank grid with no explanation.
Wrapped the response handling (shared between the success and error
callbacks, since app.js's doNotIntercept interceptor quirk routes most
failures through the success callback too - same root cause as
SOLR-9759) to fall back to showing the raw message via the existing
sqlError display instead of crashing.
There's no v2 API to proactively check whether the sql module/handler is actually loadable (every core nominally registers /sql lazily regardless of whether the module jar is present, so only a real request reveals it's missing) - confirmed by checking for a modules- info or eager-plugin-load API, finding none. So instead: detect the specific ClassNotFoundException-for-SQLHandler shape in the error response and show "the sql module doesn't appear to be enabled" instead of the raw stack trace. Verified against a real build without the sql module (dev-slim) that this is the exact error shape produced. Also hoisted showResult() out of doQuery() so it's available as soon as the controller loads rather than only after the first query attempt - this also makes it directly testable (new testSqlModuleNotEnabledShowsFriendlyMessage calls it via the Angular scope with the captured error shape, since the webapp test classpath always has the sql module and can't reproduce the missing-module case through a real request).
Contributor
Author
|
I made a video of the QUERY verb in action! https://share.descript.com/view/ONLMnrXdlYs |
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.
Description
Demonstrates sending read-only SQL requests using HTTP QUERY without changes to Jetty. The Admin UI SQL screen offers GET, POST, and QUERY, with POST as the default. GET sends
stmtin the URL; POST and QUERY send it in a form-encoded body.Solution
Adds QUERY to Solr's HTTP method handling and the Jetty-backed SolrJ client, defines a JAX-RS
@QUERYannotation, and adds a test-only V2 Jersey endpoint to prove JSON body handling over HTTP/1.1 and HTTP/2. Developer documentation describes when QUERY is appropriate.This is an experiment, not complete public API support. Other SolrJ transports, distributed forwarding, authorization policies, OpenAPI generation, and QUERY caching still need validation.
Dependency: this branch is based on
SOLR-16640. Its diff againstmaincurrently includes the SQL screen's missing-module error handling, clickable documentation link, and techproducts SQL-module enablement. The isolated QUERY demonstration is commit0b81777fef9; those prerequisite changes can be removed from this PR's diff after they land separately.Implemented with Codex assistance.
Tests
HttpQueryIntegrationTestandSolrRequestParserTest../gradlew tidyand./gradlew check -x testpassed.SOLR-16640base was separately validated with its three SQL browser tests andcheck -x test.Checklist