Repository navigation
Conversation
…ions Luke topTerms/histogram, MoreLikeThis interestingTerms and the SolrCloud moreLikeThis section, the empty-result debug section, managed-resource initArgs, the igain/tlogit sections, Core Admin SPLIT details, plus the internal spellcheck/facet config maps and the grouping shard serializers. The Admin UI Schema Browser now reads Luke topTerms/histogram in both the object and the legacy flat-array form.
|
Automated PR readiness judgements (LLM-generated; may be wrong; not updated on later pushes).
|
interestingTerms changes shape in this PR. The moreLikeThis component example was already stale: the single-node section has been a SimpleOrderedMap, rendered as an object, before this change.
| NamedList<Integer> topFreq = new NamedList<>(); | ||
| NamedList<Integer> allFreq = new NamedList<>(); | ||
| NamedList<Double> analytics = new SimpleOrderedMap<>(); | ||
| NamedList<Integer> topFreq = new SimpleOrderedMap<>(); |
There was a problem hiding this comment.
🤖 AI text below 🤖
Could we leave docFreq as a NamedList in this slice? The producer adds each term’s real frequency to topFreq, then adds each featured term a second time using allFreq.get(...). Nothing populates allFreq, so that second value is null. The old flat response preserves both entries; the new object writes duplicate properties, and a last-wins parser like JSON.parse returns null for the featured term. If we want to convert this section, could we fix the duplicate-producing code first and add a JSON test that checks the featured term’s frequency?
There was a problem hiding this comment.
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> list = new NamedList<>(); | ||
| NamedList<Integer> list = new SimpleOrderedMap<>(); |
There was a problem hiding this comment.
🤖 AI text below 🤖
Could we keep topTerms as a NamedList? The queue holds distinct indexed terms, but the response uses indexedToReadable() as the key. A legacy TrieIntField with 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.
Agreed; indexedToReadable() isn't injective for Trie precision terms. topTerms stays a NamedList, histogram moves (1d3c635).
| for (var i = 0; i < data.topTerms.length; i += 2) { | ||
| var count = data.topTerms[i + 1]; | ||
| var currentGroup = {count: 0}; | ||
| var topTerms = namedListEntries(data.topTerms); |
There was a problem hiding this comment.
🤖 AI text below 🤖
If the Schema Browser keeps accepting object-form topTerms, could we sort the entries by descending count before grouping them? JavaScript enumerates integer-like keys first, even when Luke emitted them in frequency order. Running this helper in Node with {"alpha":50,"21":30,"omega":30,"4":10} gave count groups 10, 30, 50, 30; the equivalent flat response gave 50, 30, 10, with both 30-count terms together. A mixed numeric/text fixture would cover this.
There was a problem hiding this comment.
Reproduced with your fixture. Added a stable sort by descending count before grouping; both forms now give 50:alpha, 30:21+omega, 10:4 (1d3c635).
| * Luke request handler: a field's `histogram` and `topTerms` are objects. The Admin UI's Schema Browser reads both forms. | ||
| * MoreLikeThis handler: `interestingTerms` with `mlt.interestingTerms=details` is an object keyed by term. | ||
| * MoreLikeThis component in SolrCloud: `moreLikeThis` is an object keyed by document, as it already was on a single node. | ||
| * Managed resources (`/schema/analysis/...`): `initArgs` is an object. |
There was a problem hiding this comment.
🤖 AI text below 🤖
Could we remove this bullet from the JSON migration list? The built-in managed word-set and synonym GET handlers already return initArgs through buildMapToStore(), which converts it to a map on the base branch too. The Java type changes here, but clients of those endpoints already receive a JSON object. The same correction applies to the changelog.
There was a problem hiding this comment.
Right, buildMapToStore already converts it. Dropped the bullet and the changelog mention; the Java change stays (1d3c635).
…amedList topTerms keys come from indexedToReadable(), which is not injective for legacy Trie precision terms, and igain adds each featured term to docFreq a second time with a null value (allFreq is never populated), so both can carry repeated keys. The Schema Browser now sorts object-form topTerms by descending count before grouping, since JavaScript enumerates integer-like keys first. Managed-resource initArgs was already a map in the response, so its bullet is dropped from the note and the changelog.
https://issues.apache.org/jira/browse/SOLR-18612
Description
SIP-22 step 5, fourth slice (after #5311 SolrJ, #5326 core init args, #5336 admin/backup responses). This one covers the search-side
solr/coresites where aNamedListis built with keys that never repeat: 22 sites in 14 Java files, plus the one Admin UI screen that read one of them in the flat form.Independent of #5336 (no shared files except the upgrade-note page: both add a "Response Format" section with their own bullets, so whichever merges second gets a one-line merge of the bullet lists).
Solution
Response-visible, each keyed by something unique (term, document key, field name, fixed names):
LukeRequestHandler: a field'shistogram(topTermsstays aNamedList:indexedToReadable()is not injective for legacy Trie precision terms, so readable keys can repeat)MoreLikeThisHandler:interestingTermswithmlt.interestingTerms=detailsMoreLikeThisComponent: the SolrCloudmoreLikeThissection, keyed by document, as single-node already wasSearchHandler: thedebug/explainsection emitted for an empty resultIGainTermsQParserPlugin(featuredTerms;docFreqstays aNamedListbecause the producer adds each featured term a second time with a null value, a pre-existing bug worth its own JIRA),TextLogisticRegressionQParserPlugin(logit)DirectUpdateHandler2.split: the Core AdminSPLITresponse (timing,failed)Internal, never serialized as is: the spellchecker and JSON-facet config conversions (
SpellCheckComponent,FacetParser),SignificantTermsQParserPlugin's working maps, the managed-resourceinitArgs(ManagedResource/RestManager; the response already converts it to a map), and the grouping shard-result serializers (SearchGroupsResultTransformer,TopGroupsResultTransformer), whose output travels between shards as javabin and is read back as aNamedListeither way.Admin UI: the Schema Browser's term-info panel parsed Luke's
topTermsandhistogramby index as a flat[name, value, ...]array, so it rendered nothing once they became objects (this is what broke the Admin UI tests on an earlier, larger version of this change).schema.jsnow reads both forms through one helper and sorts object-formtopTermsby descending count before grouping, since JavaScript enumerates integer-like keys first. The upgrade note says so.AI disclosure: the site classification, the edits, the notes and this description were drafted with Claude Code and reviewed by me.
Tests
No new Java tests: the shape change is the documented intent of this SIP step. Ran the suites covering every changed path:
LukeRequestHandlerTest,LukeRequestHandlerDistribTest,MoreLikeThisHandlerTest,MoreLikeThisComponentTest,DistributedMLTComponentTest,DebugComponentTest,DistributedDebugComponentTest,SpellCheckComponentTest,DistributedSpellCheckComponentTest,SignificantTermsQParserPluginTest,TestDistributedGrouping,SolrIndexSplitterTest,SplitByPrefixTest, therestpackage andTestJsonFacets: 175 tests, all pass. Plus./gradlew check -x test.Coverage gaps, stated plainly:
{!igain}and{!tlogit}have no functional tests insolr/core(they are driven by the streamingfeatures/trainexpressions). The Admin UI browser tests (:solr:webapp:test -Ptests.selenium=true) could not run on my machine because Selenium Manager does not support Linux ARM; the rewrittenschema.jsparser was checked under Node with both input forms and produces identical structures, and the "Admin UI Tests" workflow should be allowed to run on this PR.Checklist
Please review the following and check all that apply:
mainbranch../gradlew check.