Skip to content

Apache Lucene open-source search software

SOLR-5492: Return the replica that actually served the query in shards.info response

Shalin Shekhar Mangarb1a7190dbbc9
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 50ecba43086..4039571ddbc 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -103,6 +103,9 @@ New Features
This is intended to eventually replace the Suggester support through the
SpellCheckComponent. (Areek Zillur, Varun Thacker via shalin)
+* SOLR-5492: Return the replica that actually served the query in shards.info
+ response. (shalin)
+
Bug Fixes
----------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java b/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
index cdd5b2d3c6b..0a020569a66 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
@@ -813,11 +813,15 @@ public class QueryComponent extends SearchComponent
StringWriter trace = new StringWriter();
t.printStackTrace(new PrintWriter(trace));
nl.add("trace", trace.toString() );
+ if (srsp.getShardAddress() != null) {
+ nl.add("shardAddress", srsp.getShardAddress());
+ }
}
else {
docs = (SolrDocumentList)srsp.getSolrResponse().getResponse().get("response");
nl.add("numFound", docs.getNumFound());
nl.add("maxScore", docs.getMaxScore());
+ nl.add("shardAddress", srsp.getShardAddress());
}
if(srsp.getSolrResponse()!=null) {
nl.add("time", srsp.getSolrResponse().getElapsedTime());