lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hoss...@apache.org
Subject svn commit: r949889 - in /lucene/solr/branches/branch-1.4: ./ src/java/org/apache/solr/handler/ src/java/org/apache/solr/handler/admin/ src/java/org/apache/solr/request/ src/test/org/apache/solr/handler/admin/
Date Mon, 31 May 2010 23:27:45 GMT
Author: hossman
Date: Mon May 31 23:27:44 2010
New Revision: 949889

URL: http://svn.apache.org/viewvc?rev=949889&view=rev
Log:
merging r883178 from solr/branches/branch-1.5-dev for SOLR-1563

Modified:
    lucene/solr/branches/branch-1.4/   (props changed)
    lucene/solr/branches/branch-1.4/CHANGES.txt
    lucene/solr/branches/branch-1.4/src/java/org/apache/solr/handler/BinaryUpdateRequestHandler.java
  (props changed)
    lucene/solr/branches/branch-1.4/src/java/org/apache/solr/handler/DumpRequestHandler.java
  (props changed)
    lucene/solr/branches/branch-1.4/src/java/org/apache/solr/handler/MoreLikeThisHandler.java
  (props changed)
    lucene/solr/branches/branch-1.4/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java
    lucene/solr/branches/branch-1.4/src/java/org/apache/solr/request/RawResponseWriter.java
  (props changed)
    lucene/solr/branches/branch-1.4/src/test/org/apache/solr/handler/admin/LukeRequestHandlerTest.java

Propchange: lucene/solr/branches/branch-1.4/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 31 23:27:44 2010
@@ -1 +1 @@
-/lucene/solr/trunk:881642,881906,882838,883566,884393,891596,891889,898119,903271,911245,919871,925898
+/lucene/solr/trunk:881642,881906,882838,883178,883566,884393,891596,891889,898119,903271,911245,919871,925898

Modified: lucene/solr/branches/branch-1.4/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/solr/branches/branch-1.4/CHANGES.txt?rev=949889&r1=949888&r2=949889&view=diff
==============================================================================
--- lucene/solr/branches/branch-1.4/CHANGES.txt (original)
+++ lucene/solr/branches/branch-1.4/CHANGES.txt Mon May 31 23:27:44 2010
@@ -95,6 +95,9 @@ Bug Fixes
   it would just fail in unexpected ways.  This has been changed so that it
   will fail with a clear error message on initialization. (hossman)
 
+* SOLR-1563: Binary fields, including trie-based numeric fields, caused null
+  pointer exceptions in the luke request handler. (yonik)
+
 ================== Release 1.4.0 ==================
 Release Date:  See http://lucene.apache.org/solr for the official release date.
 

Propchange: lucene/solr/branches/branch-1.4/src/java/org/apache/solr/handler/BinaryUpdateRequestHandler.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 31 23:27:44 2010
@@ -1 +1 @@
-/lucene/solr/trunk/src/java/org/apache/solr/handler/BinaryUpdateRequestHandler.java:881642,881906,882838,883566,884393,891596,891889,898119,903271,906553,911245,919871,925898
+/lucene/solr/trunk/src/java/org/apache/solr/handler/BinaryUpdateRequestHandler.java:881642,881906,882838,883178,883566,884393,891596,891889,898119,903271,906553,911245,919871,925898

Propchange: lucene/solr/branches/branch-1.4/src/java/org/apache/solr/handler/DumpRequestHandler.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 31 23:27:44 2010
@@ -1 +1 @@
-/lucene/solr/trunk/src/java/org/apache/solr/handler/DumpRequestHandler.java:881642,881906,882838,883566,884393,891596,891889,898119,903271,906553,911245,919871,925898
+/lucene/solr/trunk/src/java/org/apache/solr/handler/DumpRequestHandler.java:881642,881906,882838,883178,883566,884393,891596,891889,898119,903271,906553,911245,919871,925898

Propchange: lucene/solr/branches/branch-1.4/src/java/org/apache/solr/handler/MoreLikeThisHandler.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 31 23:27:44 2010
@@ -1 +1 @@
-/lucene/solr/trunk/src/java/org/apache/solr/handler/MoreLikeThisHandler.java:881642,881906,882838,883566,884393,891596,891889,898119,903271,906553,911245,919871,925898
+/lucene/solr/trunk/src/java/org/apache/solr/handler/MoreLikeThisHandler.java:881642,881906,882838,883178,883566,884393,891596,891889,898119,903271,906553,911245,919871,925898

Modified: lucene/solr/branches/branch-1.4/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/branch-1.4/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java?rev=949889&r1=949888&r2=949889&view=diff
==============================================================================
--- lucene/solr/branches/branch-1.4/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java
(original)
+++ lucene/solr/branches/branch-1.4/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java
Mon May 31 23:27:44 2010
@@ -53,6 +53,7 @@ import org.apache.solr.common.params.Com
 import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.common.util.SimpleOrderedMap;
+import org.apache.solr.common.util.Base64;
 import org.apache.solr.handler.RequestHandlerBase;
 import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.request.SolrQueryResponse;
@@ -240,12 +241,20 @@ public class LukeRequestHandler extends 
       f.add( "type", (ftype==null)?null:ftype.getTypeName() );
       f.add( "schema", getFieldFlags( sfield ) );
       f.add( "flags", getFieldFlags( fieldable ) );
-      
-      Term t = new Term( fieldable.name(), fieldable.stringValue() );
+
+      Term t = new Term(fieldable.name(), ftype!=null ? ftype.storedToIndexed(fieldable)
: fieldable.stringValue());
+
       f.add( "value", (ftype==null)?null:ftype.toExternal( fieldable ) );
+
+      // TODO: this really should be "stored"
       f.add( "internal", fieldable.stringValue() );  // may be a binary number
+
+      byte[] arr = fieldable.getBinaryValue();
+      if (arr != null) {
+        f.add( "binary", Base64.byteArrayToBase64(arr, 0, arr.length));
+      }
       f.add( "boost", fieldable.getBoost() );
-      f.add( "docFreq", reader.docFreq( t ) ); // this can be 0 for non-indexed fields
+      f.add( "docFreq", t.text()==null ? 0 : reader.docFreq( t ) ); // this can be 0 for
non-indexed fields
             
       // If we have a term vector, return that
       if( fieldable.isTermVectorStored() ) {

Propchange: lucene/solr/branches/branch-1.4/src/java/org/apache/solr/request/RawResponseWriter.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 31 23:27:44 2010
@@ -1,2 +1,2 @@
-/lucene/solr/trunk/src/java/org/apache/solr/request/RawResponseWriter.java:881642,881906,882838,883566,884393,891596,891889,898119,903271,911245,919871,925898
+/lucene/solr/trunk/src/java/org/apache/solr/request/RawResponseWriter.java:881642,881906,882838,883178,883566,884393,891596,891889,898119,903271,911245,919871,925898
 /lucene/solr/trunk/src/java/org/apache/solr/response/RawResponseWriter.java:906553

Modified: lucene/solr/branches/branch-1.4/src/test/org/apache/solr/handler/admin/LukeRequestHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/branch-1.4/src/test/org/apache/solr/handler/admin/LukeRequestHandlerTest.java?rev=949889&r1=949888&r2=949889&view=diff
==============================================================================
--- lucene/solr/branches/branch-1.4/src/test/org/apache/solr/handler/admin/LukeRequestHandlerTest.java
(original)
+++ lucene/solr/branches/branch-1.4/src/test/org/apache/solr/handler/admin/LukeRequestHandlerTest.java
Mon May 31 23:27:44 2010
@@ -17,17 +17,25 @@
 
 package org.apache.solr.handler.admin;
 
-import junit.framework.TestCase;
-
-import org.apache.solr.common.util.SimpleOrderedMap;
+import org.apache.solr.util.AbstractSolrTestCase;
 
 /**
  * :TODO: currently only tests some of the utilities in the LukeRequestHandler
  */
-public class LukeRequestHandlerTest extends TestCase {
-  
+public class LukeRequestHandlerTest extends AbstractSolrTestCase {
+
+  @Override
+  public String getSchemaFile() {
+    return "schema12.xml";
+  }
+
+  @Override
+  public String getSolrConfigFile() {
+    return "solrconfig.xml";
+  }
+
   /** tests some simple edge cases */
-  public void testHistogramPowerOfTwoBucket() {
+  public void doTestHistogramPowerOfTwoBucket() {
     assertHistoBucket(1,  1);
     assertHistoBucket(2,  2);
     assertHistoBucket(4,  3);
@@ -45,8 +53,47 @@ public class LukeRequestHandlerTest exte
     assertHistoBucket(MAX_VALID*2, MAX_VALID+1 );
     
   }
+
   private void assertHistoBucket(int expected, int in) {
     assertEquals("histobucket: " + in, expected,
                  LukeRequestHandler.TermHistogram.getPowerOfTwoBucket( in ));
   }
+
+  public void testLuke() {
+    doTestHistogramPowerOfTwoBucket();
+
+    assertU(adoc("id","SOLR1000", "name","Apache Solr",
+      "solr_si", "10",
+      "solr_sl", "10",
+      "solr_sf", "10",
+      "solr_sd", "10",
+      "solr_s", "10",
+      "solr_sI", "10",
+      "solr_sS", "10",
+      "solr_t", "10",
+      "solr_tt", "10",
+      "solr_b", "true",
+      "solr_i", "10",
+      "solr_l", "10",
+      "solr_f", "10",
+      "solr_d", "10",
+      "solr_ti", "10",
+      "solr_tl", "10",
+      "solr_tf", "10",
+      "solr_td", "10",
+      "solr_pi", "10",
+      "solr_pl", "10",
+      "solr_pf", "10",
+      "solr_pd", "10",
+      "solr_dt", "2000-01-01T01:01:01Z",
+      "solr_tdt", "2000-01-01T01:01:01Z",
+      "solr_pdt", "2000-01-01T01:01:01Z"
+    ));
+    assertU(commit());
+
+    // test that Luke can handle all of the field types
+    assertQ(req("qt","/admin/luke", "id","SOLR1000"));
+  }
+
+
 }



Mime
View raw message