Skip to content

Migrate RealTimeGetAPI from @EndPoint to JAX-RS#4181

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

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

Conversation

@epugh

@epugh epugh commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread solr/core/src/java/org/apache/solr/jersey/JerseyApplications.java Outdated
Comment thread changelog/unreleased/migrate-realtimegetapi-to-jax-rs.yml Outdated
epugh and others added 2 commits March 3, 2026 08:09
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@epugh

epugh commented Mar 3, 2026

Copy link
Copy Markdown
Contributor Author

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

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

@epugh

epugh commented Mar 4, 2026

Copy link
Copy Markdown
Contributor Author

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.

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown

This PR has had no activity for 60 days and is now labeled as stale. Any new activity will remove the stale label. To attract more reviewers, please tag people who might be familiar with the code area and/or notify the dev@solr.apache.org mailing list. To exempt this PR from being marked as stale, make it a draft PR or add the label "exempt-stale". If left unattended, this PR will be closed after another 60 days of inactivity. Thank you for your contribution!

@github-actions github-actions Bot added the stale PR not updated in 60 days label May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat:api stale PR not updated in 60 days tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants