lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hoss...@apache.org
Subject svn commit: r950667 - in /lucene/dev/trunk/solr: CHANGES.txt src/common/org/apache/solr/common/params/CommonParams.java src/java/org/apache/solr/util/SolrPluginUtils.java
Date Wed, 02 Jun 2010 17:19:49 GMT
Author: hossman
Date: Wed Jun  2 17:19:48 2010
New Revision: 950667

URL: http://svn.apache.org/viewvc?rev=950667&view=rev
Log:
SOLR-1915 followup - based on feedback in the issue i've renamed the param for controlling
wether the score explanations sre structured, undeprecated the existing toString() format,
and changed it back to being the default

Modified:
    lucene/dev/trunk/solr/CHANGES.txt
    lucene/dev/trunk/solr/src/common/org/apache/solr/common/params/CommonParams.java
    lucene/dev/trunk/solr/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=950667&r1=950666&r2=950667&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Wed Jun  2 17:19:48 2010
@@ -66,15 +66,6 @@ Upgrading from Solr 1.4
   (since it has never worked properly).  Solr will now warn you if
   you attempt to set this configuration option at all. (see SOLR-1846)
 
-* The format of score explanations in the debug section has been
-  changed to represent the structure of the Explanation object in the
-  approprate format based on the ResponseWriter.  In the unlikely
-  event that client code was previously depending on the previous
-  "white space indented plaintext string" format, a
-  "debug.explain.stringFormat=true" param can be added to the request
-  to force the old behavior -- but support for this will be removed in
-  the next release.
-
 Detailed Change List
 ----------------------
 
@@ -171,7 +162,10 @@ New Features
 
 * SOLR-1923: PhoneticFilterFactory now has support for the 
   Caverphone algorithm. (rmuir)
-
+  
+* SOLR-1915: DebugComponent now supports using a NamedList to model
+  Explanation objects in it's responses instead of
+  Explanation.toString  (hossman) 
    
 Optimizations
 ----------------------
@@ -398,9 +392,6 @@ Other Changes
 * SOLR-1846: Eliminate support for the abortOnConfigurationError
   option.  It has never worked very well, and in recent versions of
   Solr hasn't worked at all.  (hossman)
-  
-* SOLR-1915: DebugComponent now uses a NamedList to model Explanation
-  objects in it's responses instead of Explanation.toString  (hossman)
 
 Build
 ----------------------

Modified: lucene/dev/trunk/solr/src/common/org/apache/solr/common/params/CommonParams.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/common/org/apache/solr/common/params/CommonParams.java?rev=950667&r1=950666&r2=950667&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/common/org/apache/solr/common/params/CommonParams.java (original)
+++ lucene/dev/trunk/solr/src/common/org/apache/solr/common/params/CommonParams.java Wed Jun
 2 17:19:48 2010
@@ -62,11 +62,10 @@ public interface CommonParams {
   public static final String DEBUG_QUERY = "debugQuery";
   
   /** 
-   * whether score explanations should be in legacy plain text format 
-   * @deprecated The plain text version will be removed in a future version
+   * boolean indicating whether score explanations should structured (true), 
+   * or plain text (false)
    */
-  @Deprecated
-  public static final String EXPLAIN_AS_STRING = "debug.explain.stringFormat";
+  public static final String EXPLAIN_STRUCT = "debug.explain.structured";
   
   /** another query to explain against */
   public static final String EXPLAIN_OTHER = "explainOther";

Modified: lucene/dev/trunk/solr/src/java/org/apache/solr/util/SolrPluginUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/util/SolrPluginUtils.java?rev=950667&r1=950666&r2=950667&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/java/org/apache/solr/util/SolrPluginUtils.java (original)
+++ lucene/dev/trunk/solr/src/java/org/apache/solr/util/SolrPluginUtils.java Wed Jun  2 17:19:48
2010
@@ -399,9 +399,9 @@ public class SolrPluginUtils {
       SolrIndexSearcher searcher = req.getSearcher();
       IndexSchema schema = req.getSchema();
 
-      boolean legacyExplainStyle 
-        = req.getParams().getBool(CommonParams.EXPLAIN_AS_STRING,false);
-
+      boolean explainStruct
+        = req.getParams().getBool(CommonParams.EXPLAIN_STRUCT,false);
+      
       /* userQuery may have been pre-processes .. expose that */
       dbg.add("rawquerystring", req.getParams().get(CommonParams.Q));
       dbg.add("querystring", userQuery);
@@ -413,18 +413,22 @@ public class SolrPluginUtils {
       dbg.add("parsedquery",QueryParsing.toString(query, schema));
       dbg.add("parsedquery_toString", query.toString());
 
-      dbg.add("explain", legacyExplainStyle ?
-              getExplainList(query, results, searcher, schema) :
-              explanationsToNamedLists(getExplanations(query, results, searcher, schema)));
+      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.getSearcher(), req.getSchema(),0,10);
         dbg.add("otherQuery",otherQueryS);
-        dbg.add("explainOther", legacyExplainStyle ?
-                getExplainList(query, otherResults, searcher, schema) :
-                explanationsToNamedLists(getExplanations(query, otherResults, searcher, schema)));
+        NamedList<Explanation> explainO
+          = getExplanations(query, otherResults, searcher, schema);
+        dbg.add("explainOther", explainStruct ?
+                explanationsToNamedLists(explainO) : 
+                explanationsToStrings(explainO));
       }
     }
 
@@ -489,6 +493,15 @@ public class SolrPluginUtils {
     return explainList;
   }
 
+  private static NamedList<String> explanationsToStrings
+    (NamedList<Explanation> explanations) {
+
+    NamedList<String> out = new SimpleOrderedMap<String>();
+    for (Map.Entry<String,Explanation> entry : explanations) {
+      out.add(entry.getKey(), "\n"+entry.getValue().toString());
+    }
+    return out;
+  }
 
   /**
    * Generates an list of Explanations for each item in a list of docs.
@@ -504,15 +517,8 @@ public class SolrPluginUtils {
                                          SolrIndexSearcher searcher,
                                          IndexSchema schema)
     throws IOException {
-        
-    NamedList<String> outList = new SimpleOrderedMap<String>();
-    NamedList<Explanation> explainList = 
-      getExplanations(query,docs,searcher,schema);
 
-    for (Map.Entry<String,Explanation> entry : explainList) {
-      outList.add(entry.getKey(), "\n"+entry.getValue().toString());
-    }
-    return outList;
+    return explanationsToStrings(getExplanations(query,docs,searcher,schema));
   }
 
   /**



Mime
View raw message