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

   ## Summary
   
   `collection/CollectionUtils` holds three lenient number readers for Solr's 
`NamedList` response type: `getLong`, `getFloat` and `getInteger`. Each returns 
the value when it is a `Number`, parses a numeric string, and returns `null` 
when the key is missing or the value won't parse. Nothing in the class is about 
Solr collections. It was named after its only caller, `CollectionService`, 
which uses it for the Luke segment count and the `/admin/metrics` cache and 
handler stats.
   
   The name also shares a simple name with 
`org.springframework.util.CollectionUtils`, which `SearchService` imports for 
`isEmpty(...)`. As a result, the codebase has two unrelated `CollectionUtils` 
classes.
   
   This PR moves the class to the `util` package as `NamedLists` and makes it 
`final`, like `PromptText` and `PromptNames` there. Its test moves alongside it.
   
   ```text
   collection/CollectionUtils.java      ──►  util/NamedLists.java       (final)
   collection/CollectionUtilsTest.java  ──►  util/NamedListsTest.java
   
   // CollectionService.java
   -import static org.apache.solr.mcp.server.collection.CollectionUtils.getLong;
   +import static org.apache.solr.mcp.server.util.NamedLists.getLong;
   ```
   
   The class Javadoc no longer lists "MBeans responses" as a use case. Solr 10 
removed `/admin/mbeans`, and the stats code reads `/admin/metrics`. 
`dev-docs/ARCHITECTURE.md` moves both files to a `util/` entry.
   
   ## Evidence
   
   - `git status` records both moves as renames (`R`), so `git log --follow` 
keeps their history.
   - Outside the Spring class in `SearchService`, `git grep CollectionUtils` 
returns nothing.
   - The method bodies are unchanged, and the 38 assertions in `NamedListsTest` 
are the same as in `CollectionUtilsTest`. That includes the pinned narrowing of 
an out-of-range value to `-1` by `getInteger`.
   
   | | `./gradlew build` |
   |---|---|
   | This branch | BUILD_RESULT_PLACEHOLDER |
   
   ## Merge Danger
   
   **Door:** two-way. It is one commit, and it reverts cleanly.
   
   **Blast Radius:** minimal
   
   - **Breaks callers' compilation:** only for code that imports 
`org.apache.solr.mcp.server.collection.CollectionUtils`. In this repo that is 
`CollectionService`, updated here. An open PR that adds a new call site needs 
the new import after rebasing.
   - **Runtime behavior changes:** 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]

Reply via email to