adityamparikh opened a new pull request, #324:
URL: https://github.com/apache/solr-mcp/pull/324

   ## Summary
   
   Refactors the server's service classes for readability: long methods are 
split into named helpers, duplicated code is shared, magic values become 
constants, and broad `catch (Exception)` blocks name the types they handle. 
External behaviour does not change. MCP tool names, descriptions and parameter 
names, record components, JSON shapes and the order of validation errors all 
stay the same.
   
   - **collection**
     - `CollectionUtils.getLong`, `getFloat` and `getInteger` were three copies 
of the same code. They now delegate to one generic `getNumber(namedList, key, 
fromNumber, fromText)`.
     - `CollectionService` gains `requestIndexInfo`, `queryAllDocuments` (the 
match-all query was written out twice), `buildMetricsRequest`, 
`findCoreRegistry` and `sharedConfigSet`. The last two return `Optional`.
     - The collection-name completion used to swallow its failure silently. It 
now logs it at debug level.
     - `AliasService` uses one shared blank-argument check.
   - **search**: `SearchService.search()` was about 95 lines. It now calls 
`applyQueryFields`, `applyReturnedFields`, `applyFacets` and `applySort`, then 
`execute`. The bad-request hint logic is pulled out of `withRemediationHint`, 
and the match-all query and facet min count are named constants.
   - **schema**: `addFields` and `addFieldTypes` share one `applySchemaUpdates` 
batch path. The Schema API analyzer keys are constants, the unchecked casts 
live in one place, and the resource handlers catch specific exception types.
   - **indexing**
     - The soft-commit flags and handler paths are named constants. 
`withSoftCommit` and `indexedSummary` are shared helpers, and 
`indexIndividually` is extracted.
     - The `index-data` format mapping is an `IndexTool` enum that lowercases 
with `Locale.ROOT`. The new `IndexToolTest` covers it.
     - `JsonDocumentCreator` and `MarkdownDocumentCreator` get descriptive 
names, named constants, smaller methods, and `@Override` on `create(String)`.
   - **config**: `SolrConfig.normalizeSolrUrl` is extracted from client 
construction.
   - Corrects Javadoc examples that called accessors which don't exist.
   
   ## Evidence
   
   - `./gradlew build` on JDK 25: 529 tests, 0 failures, 0 skipped. That 
includes the Testcontainers integration tests, Javadoc, and LICENSE/NOTICE 
generation.
   - Sits on #304's commit until #304 merges, so the Solr 10 job runs with its 
fix.
   - `IndexTool` does the same job as #305's `IndexFormat`, and 
`CollectionService` overlaps #310's shared constants. Whichever of these merges 
second gets rebased onto the other's version.
   
   ## Merge Danger
   
   **Door:** two-way
   
   Private refactor inside the service classes. Tool names, parameter names, 
descriptions and response shapes are unchanged.
   
   **Blast Radius:** none
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

  • [PR] refactor: split long serv... adityamparikh (via GitHub) via issues

Reply via email to