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

   ## What
   
   `search` already makes exactly one Solr request per call. This PR fixes how 
the response is handled.
   
   - **`maxScore` was always null.** The query never asked for `score`, and 
Solr only returns `maxScore` and per-document scores when it is asked. 
`SearchResponse` and the `search-collection` prompt both describe `maxScore`, 
and the prompt tells the model to use it as a confidence signal. The query now 
sets `fl=score,*` via `setIncludeScore(true)`. The tool takes no field list, so 
nothing the caller supplies is overridden. Each document now also carries 
`score`.
   - **`getDocs` copied every hit.** Each `SolrDocument` was copied into a new 
`HashMap`, which cost one extra map per hit and scrambled field order. 
`SolrDocument` already implements `Map<String, Object>` over a `LinkedHashMap`, 
so the documents are now returned as they are.
   - **`getFacets` lost Solr's ordering.** Buckets arrive sorted by count 
(`facet.sort=count`) but went into `HashMap`s, so the LLM saw them in random 
order. They now go into `LinkedHashMap`s.
   - **`JsonResponseParser` javadoc.** It said JSON decimals become `Double`. 
They become `Float`, deliberately: SolrJ response classes cast to it 
(`SchemaResponse.getSchemaVersion` reads a `Float`). The javadoc now says so, 
so the next reader doesn't "fix" it and break `get-schema`. We tried exactly 
that in this change, and the schema integration tests caught it.
   
   ## Tests
   
   - `SearchServiceTest`: the captured query requests `score`, and document 
field order and facet bucket order are preserved.
   - `SearchServiceIntegrationTest`: on real Solr, a non-`*:*` query returns a 
positive `maxScore`, and every document has a `score`.
   - `./gradlew build`: 425 tests, 0 failures, 0 skipped.
   
   🤖 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