Repository navigation
SOLR-18612: solr/core: SimpleOrderedMap for search-side response sections #5365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
f005f98
c052bb6
dd55740
1d3c635
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc | ||
|
|
||
| title: > | ||
| Some search-side response sections whose keys never repeat are now JSON objects regardless of | ||
| json.nl: Luke's per-field histogram and topTerms, MoreLikeThis interestingTerms (details) and the | ||
| SolrCloud moreLikeThis section, managed-resource initArgs, the {!igain} featuredTerms/docFreq and | ||
| {!tlogit} logit sections, the Core Admin SPLIT response, and the debug section of an empty result. | ||
| The Admin UI Schema Browser reads both the old and the new form. Clients using json.nl=map or XML | ||
| see the same response shape; SolrJ decodes these sections as SimpleOrderedMap instances, which | ||
| remain NamedList instances. | ||
| type: changed | ||
| authors: | ||
| - name: Ivan Šarić | ||
| nick: isaric | ||
| links: | ||
| - name: SOLR-18612 | ||
| url: https://issues.apache.org/jira/browse/SOLR-18612 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ | |
| import org.apache.lucene.util.SparseFixedBitSet; | ||
| import org.apache.solr.common.params.SolrParams; | ||
| import org.apache.solr.common.util.NamedList; | ||
| import org.apache.solr.common.util.SimpleOrderedMap; | ||
| import org.apache.solr.handler.component.ResponseBuilder; | ||
| import org.apache.solr.request.SolrQueryRequest; | ||
|
|
||
|
|
@@ -147,9 +148,9 @@ public void collect(int doc) throws IOException { | |
|
|
||
| @Override | ||
| public void complete() throws IOException { | ||
| NamedList<Double> analytics = new NamedList<>(); | ||
| NamedList<Integer> topFreq = new NamedList<>(); | ||
| NamedList<Integer> allFreq = new NamedList<>(); | ||
| NamedList<Double> analytics = new SimpleOrderedMap<>(); | ||
| NamedList<Integer> topFreq = new SimpleOrderedMap<>(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤖 AI text below 🤖 Could we leave
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch, and a pre-existing bug: allFreq is never filled, so every featured term gets a second, null entry. Left docFreq as a NamedList in this slice (1d3c635); filed SOLR-18677 for the duplicate entries. |
||
| NamedList<Integer> allFreq = new SimpleOrderedMap<>(); | ||
|
|
||
| rb.rsp.add("featuredTerms", analytics); | ||
| rb.rsp.add("docFreq", topFreq); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤖 AI text below 🤖
Could we keep
topTermsas aNamedList? The queue holds distinct indexed terms, but the response usesindexedToReadable()as the key. A legacyTrieIntFieldwith multiple precision levels can have several indexed terms that all decode to"0", with different document frequencies. The old flat response keeps each entry. JSON clients parsing the new object can only see one. The histogram can still move to a map independently.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed; indexedToReadable() isn't injective for Trie precision terms. topTerms stays a NamedList, histogram moves (1d3c635).