You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ho...@apache.org on 2012/09/14 01:22:14 UTC
svn commit: r1384597 - in /lucene/dev/trunk/solr: CHANGES.txt
core/src/java/org/apache/solr/handler/component/DebugComponent.java
core/src/java/org/apache/solr/util/SolrPluginUtils.java
Author: hossman
Date: Thu Sep 13 23:22:13 2012
New Revision: 1384597
URL: http://svn.apache.org/viewvc?rev=1384597&view=rev
Log:
SOLR-3569: Fixed debug output on distributed requests when there are no results found
Modified:
lucene/dev/trunk/solr/CHANGES.txt
lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/DebugComponent.java
lucene/dev/trunk/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java
Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1384597&r1=1384596&r2=1384597&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Thu Sep 13 23:22:13 2012
@@ -162,6 +162,8 @@ Bug Fixes
not modify the result set or ranking of 'excluded' documents relative to
not using elevation at all. (Alexey Serba via hossman)
+* SOLR-3569: Fixed debug output on distributed requests when there are no
+ results found. (David Bowen via hossman)
Other Changes
----------------------
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/DebugComponent.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/DebugComponent.java?rev=1384597&r1=1384596&r2=1384597&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/DebugComponent.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/DebugComponent.java Thu Sep 13 23:22:13 2012
@@ -145,7 +145,13 @@ public class DebugComponent extends Sear
}
if (info == null) {
+ // No responses were received from shards. Show local query info.
info = new SimpleOrderedMap<Object>();
+ SolrPluginUtils.doStandardQueryDebug(
+ rb.req, rb.getQueryString(), rb.getQuery(), rb.isDebugQuery(), info);
+ if (rb.isDebugQuery() && rb.getQparser() != null) {
+ rb.getQparser().addDebugInfo(info);
+ }
}
if (rb.isDebugResults()) {
int idx = info.indexOf("explain",0);
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java?rev=1384597&r1=1384596&r2=1384597&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java Thu Sep 13 23:22:13 2012
@@ -231,57 +231,69 @@ public class SolrPluginUtils {
* @return The debug info
* @throws java.io.IOException if there was an IO error
*/
- public static NamedList doStandardDebug(SolrQueryRequest req,
- String userQuery,
- Query query,
- DocList results, boolean dbgQuery, boolean dbgResults)
- throws IOException {
-
- NamedList dbg = null;
-
- dbg = new SimpleOrderedMap();
-
- SolrIndexSearcher searcher = req.getSearcher();
- IndexSchema schema = req.getSchema();
-
- boolean explainStruct
- = req.getParams().getBool(CommonParams.EXPLAIN_STRUCT, false);
-
+ public static NamedList doStandardDebug(
+ SolrQueryRequest req,
+ String userQuery,
+ Query query,
+ DocList results,
+ boolean dbgQuery,
+ boolean dbgResults)
+ throws IOException
+ {
+ NamedList dbg = new SimpleOrderedMap();
+ doStandardQueryDebug(req, userQuery, query, dbgQuery, dbg);
+ doStandardResultsDebug(req, query, results, dbgResults, dbg);
+ return dbg;
+ }
+
+ public static void doStandardQueryDebug(
+ SolrQueryRequest req,
+ String userQuery,
+ Query query,
+ boolean dbgQuery,
+ NamedList dbg)
+ {
if (dbgQuery) {
/* userQuery may have been pre-processed .. expose that */
dbg.add("rawquerystring", req.getParams().get(CommonParams.Q));
dbg.add("querystring", userQuery);
- /* QueryParsing.toString isn't perfect, use it to see converted
+ /* QueryParsing.toString isn't perfect, use it to see converted
* values, use regular toString to see any attributes of the
* underlying Query it may have missed.
*/
- dbg.add("parsedquery", QueryParsing.toString(query, schema));
+ dbg.add("parsedquery", QueryParsing.toString(query, req.getSchema()));
dbg.add("parsedquery_toString", query.toString());
}
-
+ }
+
+ public static void doStandardResultsDebug(
+ SolrQueryRequest req,
+ Query query,
+ DocList results,
+ boolean dbgResults,
+ NamedList dbg) throws IOException
+ {
if (dbgResults) {
- NamedList<Explanation> explain
- = getExplanations(query, results, searcher, schema);
- dbg.add("explain", explainStruct ?
- explanationsToNamedLists(explain) :
- explanationsToStrings(explain));
+ SolrIndexSearcher searcher = req.getSearcher();
+ IndexSchema schema = req.getSchema();
+ boolean explainStruct = req.getParams().getBool(CommonParams.EXPLAIN_STRUCT, false);
+
+ NamedList<Explanation> explain = getExplanations(query, results, searcher, schema);
+ dbg.add("explain", explainStruct
+ ? explanationsToNamedLists(explain)
+ : explanationsToStrings(explain));
String otherQueryS = req.getParams().get(CommonParams.EXPLAIN_OTHER);
if (otherQueryS != null && otherQueryS.length() > 0) {
- DocList otherResults = doSimpleQuery
- (otherQueryS, req, 0, 10);
+ DocList otherResults = doSimpleQuery(otherQueryS, req, 0, 10);
dbg.add("otherQuery", otherQueryS);
- NamedList<Explanation> explainO
- = getExplanations(query, otherResults, searcher, schema);
- dbg.add("explainOther", explainStruct ?
- explanationsToNamedLists(explainO) :
- explanationsToStrings(explainO));
+ NamedList<Explanation> explainO = getExplanations(query, otherResults, searcher, schema);
+ dbg.add("explainOther", explainStruct
+ ? explanationsToNamedLists(explainO)
+ : explanationsToStrings(explainO));
}
}
-
-
- return dbg;
}
public static NamedList<Object> explanationToNamedList(Explanation e) {