Skip to content

Migrate RealTimeGetAPI from @EndPoint to JAX-RS#4181

Open
epugh wants to merge 9 commits intoapache:mainfrom
epugh:copilot/migrate-realtimegetapi-to-jax-rs
Open

Migrate RealTimeGetAPI from @EndPoint to JAX-RS#4181
epugh wants to merge 9 commits intoapache:mainfrom
epugh:copilot/migrate-realtimegetapi-to-jax-rs

Conversation

@epugh
Copy link
Contributor

@epugh epugh commented Mar 3, 2026

Migrates RealTimeGetHandler's V2 API from the legacy @EndPoint/AnnotatedApi pattern to standard JAX-RS annotations, consistent with other V2 APIs. RTG logic stays in RealTimeGetHandler; the new Jersey resource delegates to it. Also upgrades the generated SolrJ client to expose id/ids query params and fixes a gap in the Jersey JSON response path.

API Interface (solr/api)

  • New RealTimeGetApi: @Path(INDEX_PATH_PREFIX + "/get"), @GET getDocuments(@QueryParam("id"), @QueryParam("ids")), returns FlexibleSolrJerseyResponse to capture dynamic RTG fields (doc, response)

Implementation (solr/core)

  • RealTimeGetAPI extends JerseyResource, implements RealTimeGetApi, uses @Inject constructor; delegates to RealTimeGetHandler via solrCore.getRequestHandler("/get")
  • RealTimeGetHandler: replaced AnnotatedApi/getApis() with getJerseyResources() returning RealTimeGetAPI.class

JSON MessageBodyWriter

Previously JAX-RS application/json responses bypassed Solr's QueryResponseWriter pipeline (using Jersey's default Jackson serializer directly), so dynamic fields added by V1 handlers to SolrQueryResponse were invisible to JacksonDataBindResponseParser-based clients. Added JsonMessageBodyWriter — routes JSON responses through JSONResponseWriter + squashIntoSolrResponseWithHeader, consistent with the existing javabin/xml writers.

Generated SolrJ Client

DocumentsApi.GetDocuments (generated from the updated OAS) now exposes setId(String) and setIds(List<String>).

Tests

  • RealTimeGetAPITest: integration test via SolrJettyTestRule; testGetDocumentsByIds uses the generated DocumentsApi.GetDocuments class end-to-end
  • V2ApiIntegrationTest: removed _introspect assertions on JAX-RS endpoints (/select/_introspect, /get/_introspect) — _introspect is not supported on JAX-RS resources; testWTParam/testInvalidWTParamReturnsError now use collection-level /_introspect

Copilot AI and others added 5 commits March 3, 2026 01:28
Co-authored-by: epugh <22395+epugh@users.noreply.github.com>
…Writer; fix V2ApiIntegrationTest introspect tests

Co-authored-by: epugh <22395+epugh@users.noreply.github.com>
@epugh epugh marked this pull request as ready for review March 3, 2026 12:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Migrates the RealTimeGet V2 endpoint from the legacy @EndPoint / AnnotatedApi mechanism to a JAX-RS resource + OpenAPI interface, and ensures JSON responses go through Solr’s response-writer pipeline for dynamic fields.

Changes:

  • Introduces a new JAX-RS RealTimeGetApi interface and a Jersey RealTimeGetAPI resource delegating to RealTimeGetHandler.
  • Adds a JSON MessageBodyWriter to route application/json through JSONResponseWriter (matching javabin/xml behavior).
  • Updates/extends integration testing around the new endpoint and adjusts introspection assertions.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
solr/core/src/java/org/apache/solr/handler/admin/api/RealTimeGetAPI.java New Jersey resource implementation for RTG backed by existing handler
solr/core/src/java/org/apache/solr/handler/RealTimeGetHandler.java Switches from legacy V2 API exposure to Jersey resource exposure
solr/api/src/java/org/apache/solr/client/api/endpoint/RealTimeGetApi.java Adds the JAX-RS/OpenAPI API contract for RTG
solr/core/src/java/org/apache/solr/jersey/MessageBodyWriters.java Adds JSON writer that uses Solr’s JSONResponseWriter pipeline
solr/core/src/java/org/apache/solr/jersey/JerseyApplications.java Registers the new JSON MessageBodyWriter
solr/core/src/test/org/apache/solr/handler/admin/api/RealTimeGetAPITest.java Adds integration coverage for /get via both V2Request and generated SolrJ
solr/core/src/test/org/apache/solr/handler/V2ApiIntegrationTest.java Updates introspect-related assertions to avoid JAX-RS endpoints
changelog/unreleased/migrate-realtimegetapi-to-jax-rs.yml Adds changelog entry for the migration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

epugh and others added 2 commits March 3, 2026 08:09
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@epugh
Copy link
Contributor Author

epugh commented Mar 3, 2026

Locallhy I am getting wrapping in the configSets list with breaks test_zk.bats assert!:

#   "configSets":["_default",
#     "techproducts2"],
#   "responseHeader":{
#     "status":0,
#     "QTime":27}}

@epugh
Copy link
Contributor Author

epugh commented Mar 4, 2026

Locallhy I am getting wrapping in the configSets list with breaks test_zk.bats assert!:

#   "configSets":["_default",
#     "techproducts2"],
#   "responseHeader":{
#     "status":0,
#     "QTime":27}}

In digging more, it was the change to the json mapper stuff that was causing this side effect. I just merged a redo that gets us closer, thoguh parts I still don't love.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants