mirror of https://github.com/apache/lucene.git
SOLR-3569: Fixed debug output on distributed requests when there are no results found
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1384597 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
45931b0fec
commit
bf73201486
|
@ -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
|
||||
----------------------
|
||||
|
|
|
@ -145,7 +145,13 @@ public class DebugComponent extends SearchComponent
|
|||
}
|
||||
|
||||
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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue