You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2011/06/09 20:00:55 UTC

svn commit: r1134021 [2/2] - in /lucene/dev/branches/fieldtype: ./ lucene/src/java/org/apache/lucene/analysis/ lucene/src/java/org/apache/lucene/document/ lucene/src/java/org/apache/lucene/index/ lucene/src/java/org/apache/lucene/search/ lucene/src/tes...

Modified: lucene/dev/branches/fieldtype/solr/src/java/org/apache/solr/schema/TrieField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype/solr/src/java/org/apache/solr/schema/TrieField.java?rev=1134021&r1=1134020&r2=1134021&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype/solr/src/java/org/apache/solr/schema/TrieField.java (original)
+++ lucene/dev/branches/fieldtype/solr/src/java/org/apache/solr/schema/TrieField.java Thu Jun  9 18:00:54 2011
@@ -109,19 +109,19 @@ public class TrieField extends FieldType
       return (type == TrieTypes.DATE) ? new Date(val.longValue()) : val;
     } else {
       // the following code is "deprecated" and only to support pre-3.2 indexes using the old BinaryField encoding:
-      final byte[] arr = f.getBinaryValue();
-      if (arr==null) return badFieldString(f);
+      final BytesRef bytes = f.binaryValue(null);
+      if (bytes==null) return badFieldString(f);
       switch (type) {
         case INTEGER:
-          return toInt(arr);
+          return toInt(bytes.bytes);
         case FLOAT:
-          return Float.intBitsToFloat(toInt(arr));
+          return Float.intBitsToFloat(toInt(bytes.bytes));
         case LONG:
-          return toLong(arr);
+          return toLong(bytes.bytes);
         case DOUBLE:
-          return Double.longBitsToDouble(toLong(arr));
+          return Double.longBitsToDouble(toLong(bytes.bytes));
         case DATE:
-          return new Date(toLong(arr));
+          return new Date(toLong(bytes.bytes));
         default:
           throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unknown type for trie field: " + f.name());
       }
@@ -432,31 +432,31 @@ public class TrieField extends FieldType
       }
     } else {
       // the following code is "deprecated" and only to support pre-3.2 indexes using the old BinaryField encoding:
-      final byte[] arr = f.getBinaryValue();
-      if (arr==null)
+      final BytesRef bytesRef = f.binaryValue(null);
+      if (bytesRef==null)
         throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Invalid field contents: "+f.name());
       switch (type) {
         case INTEGER:
-          NumericUtils.intToPrefixCoded(toInt(arr), 0, bytes);
+          NumericUtils.intToPrefixCoded(toInt(bytesRef.bytes), 0, bytes);
           break;
         case FLOAT: {
           // WARNING: Code Duplication! Keep in sync with o.a.l.util.NumericUtils!
           // copied from NumericUtils to not convert to/from float two times
           // code in next 2 lines is identical to: int v = NumericUtils.floatToSortableInt(Float.intBitsToFloat(toInt(arr)));
-          int v = toInt(arr);
+          int v = toInt(bytesRef.bytes);
           if (v<0) v ^= 0x7fffffff;
           NumericUtils.intToPrefixCoded(v, 0, bytes);
           break;
         }
         case LONG: //fallthrough!
         case DATE:
-          NumericUtils.longToPrefixCoded(toLong(arr), 0, bytes);
+          NumericUtils.longToPrefixCoded(toLong(bytesRef.bytes), 0, bytes);
           break;
         case DOUBLE: {
           // WARNING: Code Duplication! Keep in sync with o.a.l.util.NumericUtils!
           // copied from NumericUtils to not convert to/from double two times
           // code in next 2 lines is identical to: long v = NumericUtils.doubleToSortableLong(Double.longBitsToDouble(toLong(arr)));
-          long v = toLong(arr);
+          long v = toLong(bytesRef.bytes);
           if (v<0) v ^= 0x7fffffffffffffffL;
           NumericUtils.longToPrefixCoded(v, 0, bytes);
           break;

Modified: lucene/dev/branches/fieldtype/solr/src/test/org/apache/solr/schema/PolyFieldTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype/solr/src/test/org/apache/solr/schema/PolyFieldTest.java?rev=1134021&r1=1134020&r2=1134021&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype/solr/src/test/org/apache/solr/schema/PolyFieldTest.java (original)
+++ lucene/dev/branches/fieldtype/solr/src/test/org/apache/solr/schema/PolyFieldTest.java Thu Jun  9 18:00:54 2011
@@ -88,7 +88,7 @@ public class PolyFieldTest extends SolrT
     //first two fields contain the values, third is just stored and contains the original
     for (int i = 0; i < 3; i++) {
       boolean hasValue = fields[1].tokenStreamValue() != null
-              || fields[1].getBinaryValue() != null
+              || fields[1].binaryValue(null) != null
               || fields[1].stringValue() != null;
       assertTrue("Doesn't have a value: " + fields[1], hasValue);
     }