This is an automated email from the ASF dual-hosted git repository.

dsmiley pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/branch_9x by this push:
     new bfb6076  SOLR-15944: Tagger: JSON response should use map not array 
(#552)
bfb6076 is described below

commit bfb60760d10ee52fd4fce0dbaf21a78e71dc9e13
Author: David Smiley <[email protected]>
AuthorDate: Fri Jan 21 17:34:56 2022 -0500

    SOLR-15944: Tagger: JSON response should use map not array (#552)
    
    (for each tag)
---
 solr/CHANGES.txt                                                  | 3 +++
 .../java/org/apache/solr/handler/tagger/TaggerRequestHandler.java | 6 +++---
 solr/solr-ref-guide/src/major-changes-in-solr-9.adoc              | 2 ++
 solr/solr-ref-guide/src/tagger-handler.adoc                       | 8 ++++----
 4 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 56daf25..c003d0c 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -544,6 +544,9 @@ Bug Fixes
 
 * SOLR-15842: Async response for backups now correctly aggregates and returns 
information (Houston Putman, Artem Abeleshev, Christine Poerschke)
 
+* SOLR-15944: The Tagger's JSON response format now always uses an object/map 
to represent each tag instead of an
+  array, which didn't make sense. (David Smiley)
+
 ==================  8.11.2 ==================
 
 Bug Fixes
diff --git 
a/solr/core/src/java/org/apache/solr/handler/tagger/TaggerRequestHandler.java 
b/solr/core/src/java/org/apache/solr/handler/tagger/TaggerRequestHandler.java
index 1bb0cc0..e42865b 100644
--- 
a/solr/core/src/java/org/apache/solr/handler/tagger/TaggerRequestHandler.java
+++ 
b/solr/core/src/java/org/apache/solr/handler/tagger/TaggerRequestHandler.java
@@ -57,7 +57,7 @@ import org.apache.solr.common.SolrException;
 import org.apache.solr.common.params.CommonParams;
 import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.util.ContentStream;
-import org.apache.solr.common.util.NamedList;
+import org.apache.solr.common.util.SimpleOrderedMap;
 import org.apache.solr.handler.RequestHandlerBase;
 import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.response.SolrQueryResponse;
@@ -161,7 +161,7 @@ public class TaggerRequestHandler extends 
RequestHandlerBase {
 
     final SolrIndexSearcher searcher = req.getSearcher();
     final FixedBitSet matchDocIdsBS = new FixedBitSet(searcher.maxDoc());
-    final List<NamedList<?>> tags = new ArrayList<>(2000);
+    final List<SimpleOrderedMap<?>> tags = new ArrayList<>(2000);
 
     try {
       Analyzer analyzer = 
req.getSchema().getField(indexedField).getType().getQueryAnalyzer();
@@ -185,7 +185,7 @@ public class TaggerRequestHandler extends 
RequestHandlerBase {
                 endOffset = offsetPair[1];
               }
 
-              NamedList<Object> tag = new NamedList<>();
+              SimpleOrderedMap<Object> tag = new SimpleOrderedMap<>();
               tag.add("startOffset", startOffset);
               tag.add("endOffset", endOffset);
               if (addMatchText)
diff --git a/solr/solr-ref-guide/src/major-changes-in-solr-9.adoc 
b/solr/solr-ref-guide/src/major-changes-in-solr-9.adoc
index d452094..f1a0feb 100644
--- a/solr/solr-ref-guide/src/major-changes-in-solr-9.adoc
+++ b/solr/solr-ref-guide/src/major-changes-in-solr-9.adoc
@@ -105,6 +105,8 @@ The `response` field is now a map, containing information 
about the backup (`sta
 * SOLR-15884: In Backup request responses, the `response` key now uses a map 
to return information instead of a list.
 This is only applicable for users returning information in JSON format, which 
is the default behavior.
 
+* SOLR-15944: The Tagger's JSON response format now always uses an object/map 
to represent each tag instead of an array.
+
 == New Features & Enhancements
 
 * Replica placement plugins
diff --git a/solr/solr-ref-guide/src/tagger-handler.adoc 
b/solr/solr-ref-guide/src/tagger-handler.adoc
index ca9d4a2..4026b68 100644
--- a/solr/solr-ref-guide/src/tagger-handler.adoc
+++ b/solr/solr-ref-guide/src/tagger-handler.adoc
@@ -322,10 +322,10 @@ The response should be this (the QTime may vary):
     "status":0,
     "QTime":1},
   "tagsCount":1,
-  "tags":[[
-      "startOffset",6,
-      "endOffset",19,
-      "ids",["5128581"]]],
+  "tags":[{
+      "startOffset":6,
+      "endOffset":19,
+      "ids":["5128581"]}],
   "response":{"numFound":1,"start":0,"docs":[
       {
         "id":"5128581",

Reply via email to