You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sa...@apache.org on 2011/05/30 16:51:37 UTC

svn commit: r1129205 [6/7] - in /lucene/dev/branches/solr2452: ./ dev-tools/eclipse/ dev-tools/idea/.idea/ dev-tools/idea/lucene/contrib/spellchecker/ dev-tools/idea/modules/suggest/ dev-tools/maven/lucene/contrib/ dev-tools/maven/lucene/contrib/spellc...

Modified: lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/request/PerSegmentSingleValuedFaceting.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/request/PerSegmentSingleValuedFaceting.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/request/PerSegmentSingleValuedFaceting.java (original)
+++ lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/request/PerSegmentSingleValuedFaceting.java Mon May 30 14:51:25 2011
@@ -23,9 +23,11 @@ import org.apache.lucene.search.DocIdSet
 import org.apache.lucene.search.DocIdSetIterator;
 import org.apache.lucene.search.FieldCache;
 import org.apache.lucene.search.Filter;
+import org.apache.lucene.util.CharsRef;
 import org.apache.lucene.util.PriorityQueue;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.ReaderUtil;
+import org.apache.lucene.util.UnicodeUtil;
 import org.apache.lucene.util.packed.Direct16;
 import org.apache.lucene.util.packed.Direct32;
 import org.apache.lucene.util.packed.Direct8;
@@ -37,7 +39,6 @@ import org.apache.solr.schema.FieldType;
 import org.apache.solr.search.DocSet;
 import org.apache.solr.search.SolrIndexSearcher;
 import org.apache.solr.util.BoundedTreeSet;
-import org.apache.solr.util.ByteUtils;
 
 import java.io.IOException;
 import java.util.*;
@@ -244,7 +245,7 @@ class PerSegmentSingleValuedFaceting {
         BytesRef prefixRef = new BytesRef(prefix);
         startTermIndex = si.binarySearchLookup(prefixRef, tempBR);
         if (startTermIndex<0) startTermIndex=-startTermIndex-1;
-        prefixRef.append(ByteUtils.bigTerm);
+        prefixRef.append(UnicodeUtil.BIG_TERM);
         // TODO: we could constrain the lower endpoint if we had a binarySearch method that allowed passing start/end
         endTermIndex = si.binarySearchLookup(prefixRef, tempBR);
         assert endTermIndex < 0;
@@ -339,6 +340,8 @@ abstract class FacetCollector {
 
 // This collector expects facets to be collected in index order
 class CountSortedFacetCollector extends FacetCollector {
+  private final CharsRef spare = new CharsRef();
+
   final int offset;
   final int limit;
   final int maxsize;
@@ -360,7 +363,7 @@ class CountSortedFacetCollector extends 
       // NOTE: we use c>min rather than c>=min as an optimization because we are going in
       // index order, so we already know that the keys are ordered.  This can be very
       // important if a lot of the counts are repeated (like zero counts would be).
-      queue.add(new SimpleFacets.CountPair<String,Integer>(term.utf8ToString(), count));
+      queue.add(new SimpleFacets.CountPair<String,Integer>(term.utf8ToChars(spare).toString(), count));
       if (queue.size()>=maxsize) min=queue.last().val;
     }
     return false;
@@ -383,12 +386,13 @@ class CountSortedFacetCollector extends 
 
 // This collector expects facets to be collected in index order
 class IndexSortedFacetCollector extends FacetCollector {
+  private final CharsRef spare = new CharsRef();
+
   int offset;
   int limit;
   final int mincount;
   final NamedList<Integer> res = new NamedList<Integer>();
 
-
   public IndexSortedFacetCollector(int offset, int limit, int mincount) {
     this.offset = offset;
     this.limit = limit>0 ? limit : Integer.MAX_VALUE;
@@ -407,7 +411,7 @@ class IndexSortedFacetCollector extends 
     }
 
     if (limit > 0) {
-      res.add(term.utf8ToString(), count);
+      res.add(term.utf8ToChars(spare).toString(), count);
       limit--;
     }
 

Modified: lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/request/SimpleFacets.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/request/SimpleFacets.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/request/SimpleFacets.java (original)
+++ lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/request/SimpleFacets.java Mon May 30 14:51:25 2011
@@ -21,12 +21,13 @@ import org.apache.lucene.index.*;
 import org.apache.lucene.queryParser.ParseException;
 import org.apache.lucene.search.*;
 import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.CharsRef;
 import org.apache.lucene.util.StringHelper;
+import org.apache.lucene.util.UnicodeUtil;
 import org.apache.lucene.util.packed.Direct16;
 import org.apache.lucene.util.packed.Direct32;
 import org.apache.lucene.util.packed.Direct8;
 import org.apache.lucene.util.packed.PackedInts;
-import org.apache.noggit.CharArr;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.params.FacetParams;
 import org.apache.solr.common.params.RequiredSolrParams;
@@ -41,7 +42,6 @@ import org.apache.solr.core.SolrCore;
 import org.apache.solr.schema.*;
 import org.apache.solr.search.*;
 import org.apache.solr.util.BoundedTreeSet;
-import org.apache.solr.util.ByteUtils;
 import org.apache.solr.util.DateMathParser;
 import org.apache.solr.handler.component.ResponseBuilder;
 import org.apache.solr.util.LongPriorityQueue;
@@ -109,7 +109,7 @@ public class SimpleFacets {
     if (localParams == null) return;
 
     // remove local params unless it's a query
-    if (type != FacetParams.FACET_QUERY) {
+    if (type != FacetParams.FACET_QUERY) { // TODO Cut over to an Enum here
       facetValue = localParams.get(CommonParams.VALUE);
     }
 
@@ -128,7 +128,7 @@ public class SimpleFacets {
     String excludeStr = localParams.get(CommonParams.EXCLUDE);
     if (excludeStr == null) return;
 
-    Map tagMap = (Map)req.getContext().get("tags");
+    Map<?,?> tagMap = (Map<?,?>)req.getContext().get("tags");
     if (tagMap != null && rb != null) {
       List<String> excludeTagList = StrUtils.splitSmart(excludeStr,',');
 
@@ -137,7 +137,7 @@ public class SimpleFacets {
         Object olst = tagMap.get(excludeTag);
         // tagMap has entries of List<String,List<QParser>>, but subject to change in the future
         if (!(olst instanceof Collection)) continue;
-        for (Object o : (Collection)olst) {
+        for (Object o : (Collection<?>)olst) {
           if (!(o instanceof QParser)) continue;
           QParser qp = (QParser)o;
           excludeSet.put(qp.getQuery(), Boolean.TRUE);
@@ -435,7 +435,7 @@ public class SimpleFacets {
     if (prefix!=null) {
       startTermIndex = si.binarySearchLookup(prefixRef, br);
       if (startTermIndex<0) startTermIndex=-startTermIndex-1;
-      prefixRef.append(ByteUtils.bigTerm);
+      prefixRef.append(UnicodeUtil.BIG_TERM);
       endTermIndex = si.binarySearchLookup(prefixRef, br);
       assert endTermIndex < 0;
       endTermIndex = -endTermIndex-1;
@@ -446,8 +446,7 @@ public class SimpleFacets {
 
     final int nTerms=endTermIndex-startTermIndex;
     int missingCount = -1; 
-
-    CharArr spare = new CharArr();
+    final CharsRef charsRef = new CharsRef(10);
     if (nTerms>0 && docs.size() >= mincount) {
 
       // count collection array only needs to be as big as the number of terms we are
@@ -547,10 +546,8 @@ public class SimpleFacets {
           long pair = sorted[i];
           int c = (int)(pair >>> 32);
           int tnum = Integer.MAX_VALUE - (int)pair;
-
-          spare.reset();
-          ft.indexedToReadable(si.lookup(startTermIndex+tnum, br), spare);
-          res.add(spare.toString(), c);
+          ft.indexedToReadable(si.lookup(startTermIndex+tnum, br), charsRef);
+          res.add(charsRef.toString(), c);
         }
       
       } else {
@@ -567,9 +564,8 @@ public class SimpleFacets {
           int c = counts[i];
           if (c<mincount || --off>=0) continue;
           if (--lim<0) break;
-          spare.reset();
-          ft.indexedToReadable(si.lookup(startTermIndex+i, br), spare);
-          res.add(spare.toString(), c);
+          ft.indexedToReadable(si.lookup(startTermIndex+i, br), charsRef);
+          res.add(charsRef.toString(), c);
         }
       }
     }
@@ -657,7 +653,7 @@ public class SimpleFacets {
     }
 
     DocsEnum docsEnum = null;
-    CharArr spare = new CharArr();
+    CharsRef charsRef = new CharsRef(10);
 
     if (docs.size() >= mincount) {
       while (term != null) {
@@ -742,9 +738,8 @@ public class SimpleFacets {
           } else {
             if (c >= mincount && --off<0) {
               if (--lim<0) break;
-              spare.reset();
-              ft.indexedToReadable(term, spare);
-              res.add(spare.toString(), c);
+              ft.indexedToReadable(term, charsRef);
+              res.add(charsRef.toString(), c);
             }
           }
         }
@@ -757,9 +752,8 @@ public class SimpleFacets {
       for (CountPair<BytesRef,Integer> p : queue) {
         if (--off>=0) continue;
         if (--lim<0) break;
-        spare.reset();
-        ft.indexedToReadable(p.key, spare);
-        res.add(spare.toString(), p.val);
+        ft.indexedToReadable(p.key, charsRef);
+        res.add(charsRef.toString(), p.val);
       }
     }
 

Modified: lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/request/UnInvertedField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/request/UnInvertedField.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/request/UnInvertedField.java (original)
+++ lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/request/UnInvertedField.java Mon May 30 14:51:25 2011
@@ -24,7 +24,6 @@ import org.apache.lucene.index.TermsEnum
 import org.apache.lucene.search.TermQuery;
 import org.apache.lucene.search.TermRangeQuery;
 import org.apache.lucene.util.StringHelper;
-import org.apache.noggit.CharArr;
 import org.apache.solr.common.params.FacetParams;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.common.SolrException;
@@ -33,13 +32,14 @@ import org.apache.solr.core.SolrCore;
 import org.apache.solr.schema.FieldType;
 import org.apache.solr.schema.TrieField;
 import org.apache.solr.search.*;
-import org.apache.solr.util.ByteUtils;
 import org.apache.solr.util.LongPriorityQueue;
 import org.apache.solr.util.PrimUtils;
 import org.apache.solr.handler.component.StatsValues;
 import org.apache.solr.handler.component.FieldFacetStats;
+import org.apache.lucene.util.CharsRef;
 import org.apache.lucene.util.OpenBitSet;
 import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.UnicodeUtil;
 
 import java.io.IOException;
 import java.util.HashMap;
@@ -227,13 +227,13 @@ public class UnInvertedField extends Doc
 
       TermsEnum te = getOrdTermsEnum(searcher.getIndexReader());
       if (prefix != null && prefix.length() > 0) {
-        BytesRef prefixBr = new BytesRef(prefix);
+        final BytesRef prefixBr = new BytesRef(prefix);
         if (te.seek(prefixBr, true) == TermsEnum.SeekStatus.END) {
           startTerm = numTermsInField;
         } else {
           startTerm = (int) te.ord();
         }
-        prefixBr.append(ByteUtils.bigTerm);
+        prefixBr.append(UnicodeUtil.BIG_TERM);
         if (te.seek(prefixBr, true) == TermsEnum.SeekStatus.END) {
           endTerm = numTermsInField;
         } else {
@@ -331,8 +331,7 @@ public class UnInvertedField extends Doc
           }
         }
       }
-
-      CharArr spare = new CharArr();
+      final CharsRef charsRef = new CharsRef();
 
       int off=offset;
       int lim=limit>=0 ? limit : Integer.MAX_VALUE;
@@ -408,7 +407,7 @@ public class UnInvertedField extends Doc
         for (int i=sortedIdxStart; i<sortedIdxEnd; i++) {
           int idx = indirect[i];
           int tnum = (int)sorted[idx];
-          String label = getReadableValue(getTermValue(te, tnum), ft, spare);
+          final String label = getReadableValue(getTermValue(te, tnum), ft, charsRef);
           //System.out.println("  label=" + label);
           res.setName(idx - sortedIdxStart, label);
         }
@@ -428,7 +427,7 @@ public class UnInvertedField extends Doc
           if (c<mincount || --off>=0) continue;
           if (--lim<0) break;
 
-          String label = getReadableValue(getTermValue(te, i), ft, spare);
+          final String label = getReadableValue(getTermValue(te, i), ft, charsRef);
           res.add(label, c);
         }
       }
@@ -582,14 +581,12 @@ public class UnInvertedField extends Doc
         }
       }
     }
-
+    final CharsRef charsRef = new CharsRef();
     // add results in index order
-    CharArr spare = new CharArr();
-
     for (i = 0; i < numTermsInField; i++) {
       int c = doNegative ? maxTermCounts[i] - counts[i] : counts[i];
       if (c == 0) continue;
-      String label = getReadableValue(getTermValue(te, i), ft, spare);
+      String label = getReadableValue(getTermValue(te, i), ft, charsRef);
       // TODO: we should avoid this re-parse
       Double value = Double.parseDouble(label);
 
@@ -621,14 +618,8 @@ public class UnInvertedField extends Doc
 
   }
 
-  String getReadableValue(BytesRef termval, FieldType ft, CharArr spare) {
-    if (spare == null) {
-      spare = new CharArr();
-    } else {
-      spare.reset();
-    }
-    ft.indexedToReadable(termval, spare);
-    return spare.toString();    
+  String getReadableValue(BytesRef termval, FieldType ft, CharsRef charsRef) {
+    return ft.indexedToReadable(termval, charsRef).toString();
   }
 
   /** may return a reused BytesRef */

Modified: lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/BoolField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/BoolField.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/BoolField.java (original)
+++ lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/BoolField.java Mon May 30 14:51:25 2011
@@ -19,7 +19,7 @@ package org.apache.solr.schema;
 
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.util.BytesRef;
-import org.apache.noggit.CharArr;
+import org.apache.lucene.util.CharsRef;
 import org.apache.solr.search.QParser;
 import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.function.OrdFieldSource;
@@ -130,13 +130,17 @@ public class BoolField extends FieldType
     return ch=='T' ? "true" : "false";
   }
 
+  private static final CharsRef TRUE = new CharsRef("true");
+  private static final CharsRef FALSE = new CharsRef("false");
+  
   @Override
-  public void indexedToReadable(BytesRef input, CharArr out) {
+  public CharsRef indexedToReadable(BytesRef input, CharsRef charsRef) {
     if (input.length > 0 && input.bytes[input.offset] == 'T') {
-      out.write("true");
+      charsRef.copy(TRUE);
     } else {
-      out.write("false");
+      charsRef.copy(FALSE);
     }
+    return charsRef;
   }
 
   @Override

Modified: lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/DateField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/DateField.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/DateField.java (original)
+++ lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/DateField.java Mon May 30 14:51:25 2011
@@ -23,14 +23,13 @@ import org.apache.lucene.search.Query;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.search.TermRangeQuery;
 import org.apache.lucene.util.BytesRef;
-import org.apache.noggit.CharArr;
+import org.apache.lucene.util.CharsRef;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.util.DateUtil;
 import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.response.TextResponseWriter;
 import org.apache.solr.search.QParser;
 import org.apache.solr.search.function.*;
-import org.apache.solr.util.ByteUtils;
 import org.apache.solr.util.DateMathParser;
 
 import java.io.IOException;
@@ -131,6 +130,8 @@ public class DateField extends FieldType
 
   protected static String NOW = "NOW";
   protected static char Z = 'Z';
+  private static char[] Z_ARRAY = new char[] {Z};
+  
   
   @Override
   public String toInternal(String val) {
@@ -184,7 +185,7 @@ public class DateField extends FieldType
   public Fieldable createField(SchemaField field, Object value, float boost) {
     // Convert to a string before indexing
     if(value instanceof Date) {
-      value = toInternal( (Date)value ) + 'Z';
+      value = toInternal( (Date)value ) + Z;
     }
     return super.createField(field, value, boost);
   }
@@ -199,9 +200,10 @@ public class DateField extends FieldType
   }
 
   @Override
-  public void indexedToReadable(BytesRef input, CharArr out) {
-    ByteUtils.UTF8toUTF16(input, out);
-    out.write(Z);
+  public CharsRef indexedToReadable(BytesRef input, CharsRef charsRef) {
+    input.utf8ToChars(charsRef);
+    charsRef.append(Z_ARRAY, 0, 1);
+    return charsRef;
   }
 
   @Override
@@ -479,10 +481,8 @@ class DateFieldSource extends FieldCache
         if (ord == 0) {
           return null;
         } else {
-          BytesRef br = termsIndex.lookup(ord, new BytesRef());
-          CharArr spare = new CharArr();
-          ft.indexedToReadable(br, spare);
-          return spare.toString();
+          final BytesRef br = termsIndex.lookup(ord, spare);
+          return ft.indexedToReadable(br, spareChars).toString();
         }
       }
 
@@ -492,7 +492,7 @@ class DateFieldSource extends FieldCache
         if (ord == 0) {
           return null;
         } else {
-          BytesRef br = termsIndex.lookup(ord, new BytesRef());
+          final BytesRef br = termsIndex.lookup(ord, new BytesRef());
           return ft.toObject(null, br);
         }
       }

Modified: lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/FieldType.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/FieldType.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/FieldType.java (original)
+++ lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/FieldType.java Mon May 30 14:51:25 2011
@@ -30,8 +30,8 @@ import org.apache.lucene.search.SortFiel
 import org.apache.lucene.search.TermQuery;
 import org.apache.lucene.search.TermRangeQuery;
 import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.CharsRef;
 import org.apache.lucene.util.UnicodeUtil;
-import org.apache.noggit.CharArr;
 import org.apache.solr.analysis.SolrAnalyzer;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrException.ErrorCode;
@@ -39,7 +39,6 @@ import org.apache.solr.response.TextResp
 import org.apache.solr.search.QParser;
 import org.apache.solr.search.Sorting;
 import org.apache.solr.search.function.ValueSource;
-import org.apache.solr.util.ByteUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -167,6 +166,12 @@ public abstract class FieldType extends 
       initArgs.remove("positionIncrementGap");
     }
 
+    final String codec = initArgs.get("codec");
+    if (codec != null) {
+      this.codec = codec;
+      initArgs.remove("codec");
+    }
+
     if (initArgs.size() > 0) {
       throw new RuntimeException("schema fieldtype " + typeName
               + "("+ this.getClass().getName() + ")"
@@ -348,9 +353,9 @@ public abstract class FieldType extends 
   }
 
   public Object toObject(SchemaField sf, BytesRef term) {
-    CharArr ext = new CharArr(term.length);
-    indexedToReadable(term, ext);
-    Fieldable f = createField(sf, ext.toString(), 1.0f);
+    final CharsRef ref = new CharsRef(term.length);
+    indexedToReadable(term, ref);
+    final Fieldable f = createField(sf, ref.toString(), 1.0f);
     return toObject(f);
   }
 
@@ -359,9 +364,10 @@ public abstract class FieldType extends 
     return indexedForm;
   }
 
-  /** Given an indexed term, append the human readable representation to out */
-  public void indexedToReadable(BytesRef input, CharArr out) {
-    ByteUtils.UTF8toUTF16(input, out);
+  /** Given an indexed term, append the human readable representation*/
+  public CharsRef indexedToReadable(BytesRef input, CharsRef output) {
+    input.utf8ToChars(output);
+    return output;
   }
 
   /** Given the stored field, return the human readable representation */
@@ -384,7 +390,7 @@ public abstract class FieldType extends 
 
   /** Given the readable value, return the term value that will match it. */
   public void readableToIndexed(CharSequence val, BytesRef result) {
-    String internal = readableToIndexed(val.toString());
+    final String internal = readableToIndexed(val.toString());
     UnicodeUtil.UTF16toUTF8(internal, 0, internal.length(), result);
   }
 
@@ -538,6 +544,15 @@ public abstract class FieldType extends 
   }
   
   /**
+   * The codec ID used for this field type
+   */
+  protected String codec;
+  
+  public String getCodec() {
+    return codec;
+  }
+  
+  /**
    * calls back to TextResponseWriter to write the field value
    */
   public abstract void write(TextResponseWriter writer, String name, Fieldable f) throws IOException;

Modified: lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/SortableDoubleField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/SortableDoubleField.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/SortableDoubleField.java (original)
+++ lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/SortableDoubleField.java Mon May 30 14:51:25 2011
@@ -19,7 +19,7 @@ package org.apache.solr.schema;
 
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.util.BytesRef;
-import org.apache.noggit.CharArr;
+import org.apache.lucene.util.CharsRef;
 import org.apache.solr.search.MutableValueDouble;
 import org.apache.solr.search.MutableValue;
 import org.apache.solr.search.QParser;
@@ -29,7 +29,6 @@ import org.apache.solr.search.function.D
 import org.apache.solr.search.function.StringIndexDocValues;
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
-import org.apache.solr.util.ByteUtils;
 import org.apache.solr.util.NumberUtils;
 import org.apache.solr.response.TextResponseWriter;
 
@@ -78,9 +77,12 @@ public class SortableDoubleField extends
   }
 
   @Override
-  public void indexedToReadable(BytesRef input, CharArr out) {
+  public CharsRef indexedToReadable(BytesRef input, CharsRef charsRef) {
     // TODO: this could be more efficient, but the sortable types should be deprecated instead
-    out.write( indexedToReadable(ByteUtils.UTF8toUTF16(input)) );
+    input.utf8ToChars(charsRef);
+    final char[] indexedToReadable = indexedToReadable(charsRef.toString()).toCharArray();
+    charsRef.copy(indexedToReadable, 0, indexedToReadable.length);
+    return charsRef;
   }
 
   @Override
@@ -90,9 +92,6 @@ public class SortableDoubleField extends
   }
 }
 
-
-
-
 class SortableDoubleFieldSource extends FieldCacheSource {
   protected double defVal;
 

Modified: lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/SortableFloatField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/SortableFloatField.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/SortableFloatField.java (original)
+++ lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/SortableFloatField.java Mon May 30 14:51:25 2011
@@ -19,7 +19,7 @@ package org.apache.solr.schema;
 
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.util.BytesRef;
-import org.apache.noggit.CharArr;
+import org.apache.lucene.util.CharsRef;
 import org.apache.solr.search.MutableValueFloat;
 import org.apache.solr.search.MutableValue;
 import org.apache.solr.search.QParser;
@@ -29,7 +29,6 @@ import org.apache.solr.search.function.D
 import org.apache.solr.search.function.StringIndexDocValues;
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
-import org.apache.solr.util.ByteUtils;
 import org.apache.solr.util.NumberUtils;
 import org.apache.solr.response.TextResponseWriter;
 
@@ -77,10 +76,11 @@ public class SortableFloatField extends 
     return NumberUtils.SortableStr2floatStr(indexedForm);
   }
 
-  @Override
-  public void indexedToReadable(BytesRef input, CharArr out) {
+  public CharsRef indexedToReadable(BytesRef input, CharsRef charsRef) {
     // TODO: this could be more efficient, but the sortable types should be deprecated instead
-    out.write( indexedToReadable(ByteUtils.UTF8toUTF16(input)) );
+    final char[] indexedToReadable = indexedToReadable(input.utf8ToChars(charsRef).toString()).toCharArray();
+    charsRef.copy(indexedToReadable, 0, indexedToReadable.length);
+    return charsRef;
   }
 
   @Override

Modified: lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/SortableIntField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/SortableIntField.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/SortableIntField.java (original)
+++ lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/SortableIntField.java Mon May 30 14:51:25 2011
@@ -19,7 +19,7 @@ package org.apache.solr.schema;
 
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.util.BytesRef;
-import org.apache.noggit.CharArr;
+import org.apache.lucene.util.CharsRef;
 import org.apache.solr.search.MutableValueInt;
 import org.apache.solr.search.MutableValue;
 import org.apache.solr.search.QParser;
@@ -29,7 +29,6 @@ import org.apache.solr.search.function.D
 import org.apache.solr.search.function.StringIndexDocValues;
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
-import org.apache.solr.util.ByteUtils;
 import org.apache.solr.util.NumberUtils;
 import org.apache.solr.response.TextResponseWriter;
 
@@ -75,10 +74,11 @@ public class SortableIntField extends Fi
     return NumberUtils.SortableStr2int(indexedForm);
   }
 
-  @Override
-  public void indexedToReadable(BytesRef input, CharArr out) {
+  public CharsRef indexedToReadable(BytesRef input, CharsRef charsRef) {
     // TODO: this could be more efficient, but the sortable types should be deprecated instead
-    out.write( indexedToReadable(ByteUtils.UTF8toUTF16(input)) );
+    final char[] indexedToReadable = indexedToReadable(input.utf8ToChars(charsRef).toString()).toCharArray();
+    charsRef.copy(indexedToReadable, 0, indexedToReadable.length);
+    return charsRef;
   }
 
   @Override

Modified: lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/SortableLongField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/SortableLongField.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/SortableLongField.java (original)
+++ lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/SortableLongField.java Mon May 30 14:51:25 2011
@@ -19,7 +19,7 @@ package org.apache.solr.schema;
 
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.util.BytesRef;
-import org.apache.noggit.CharArr;
+import org.apache.lucene.util.CharsRef;
 import org.apache.solr.search.MutableValueLong;
 import org.apache.solr.search.MutableValue;
 import org.apache.solr.search.QParser;
@@ -29,7 +29,6 @@ import org.apache.solr.search.function.D
 import org.apache.solr.search.function.StringIndexDocValues;
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
-import org.apache.solr.util.ByteUtils;
 import org.apache.solr.util.NumberUtils;
 import org.apache.solr.response.TextResponseWriter;
 
@@ -67,10 +66,11 @@ public class SortableLongField extends F
     return NumberUtils.SortableStr2long(indexedForm);
   }
 
-  @Override
-  public void indexedToReadable(BytesRef input, CharArr out) {
+  public CharsRef indexedToReadable(BytesRef input, CharsRef charsRef) {
     // TODO: this could be more efficient, but the sortable types should be deprecated instead
-    out.write( indexedToReadable(ByteUtils.UTF8toUTF16(input)) );
+    final char[] indexedToReadable = indexedToReadable(input.utf8ToChars(charsRef).toString()).toCharArray();
+    charsRef.copy(indexedToReadable, 0, indexedToReadable.length);
+    return charsRef;
   }
   
   @Override

Modified: lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/StrField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/StrField.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/StrField.java (original)
+++ lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/StrField.java Mon May 30 14:51:25 2011
@@ -23,7 +23,6 @@ import org.apache.lucene.util.BytesRef;
 import org.apache.solr.response.TextResponseWriter;
 import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.QParser;
-import org.apache.solr.util.ByteUtils;
 
 import java.util.Map;
 import java.io.IOException;
@@ -54,7 +53,7 @@ public class StrField extends FieldType 
 
   @Override
   public Object toObject(SchemaField sf, BytesRef term) {
-    return ByteUtils.UTF8toUTF16(term);
+    return term.utf8ToString();
   }
 }
 

Modified: lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/StrFieldSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/StrFieldSource.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/StrFieldSource.java (original)
+++ lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/StrFieldSource.java Mon May 30 14:51:25 2011
@@ -18,12 +18,9 @@
 package org.apache.solr.schema;
 
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
-import org.apache.lucene.util.BytesRef;
-import org.apache.noggit.CharArr;
 import org.apache.solr.search.function.DocValues;
 import org.apache.solr.search.function.FieldCacheSource;
 import org.apache.solr.search.function.StringIndexDocValues;
-import org.apache.solr.util.ByteUtils;
 
 import java.io.IOException;
 import java.util.Map;

Modified: lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/TextField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/TextField.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/TextField.java (original)
+++ lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/TextField.java Mon May 30 14:51:25 2011
@@ -34,7 +34,6 @@ import org.apache.lucene.analysis.Analyz
 import org.apache.lucene.util.BytesRef;
 import org.apache.solr.response.TextResponseWriter;
 import org.apache.solr.search.QParser;
-import org.apache.solr.util.ByteUtils;
 
 import java.util.Map;
 import java.util.List;
@@ -47,12 +46,17 @@ import java.io.StringReader;
  * @version $Id$
  */
 public class TextField extends FieldType {
-  protected boolean autoGeneratePhraseQueries = true;
+  protected boolean autoGeneratePhraseQueries;
 
   @Override
   protected void init(IndexSchema schema, Map<String,String> args) {
     properties |= TOKENIZED;
     if (schema.getVersion()> 1.1f) properties &= ~OMIT_TF_POSITIONS;
+    if (schema.getVersion() > 1.3f) {
+      autoGeneratePhraseQueries = false;
+    } else {
+      autoGeneratePhraseQueries = true;
+    }
     String autoGeneratePhraseQueriesStr = args.remove("autoGeneratePhraseQueries");
     if (autoGeneratePhraseQueriesStr != null)
       autoGeneratePhraseQueries = Boolean.parseBoolean(autoGeneratePhraseQueriesStr);
@@ -81,7 +85,7 @@ public class TextField extends FieldType
 
   @Override
   public Object toObject(SchemaField sf, BytesRef term) {
-    return ByteUtils.UTF8toUTF16(term);
+    return term.utf8ToString();
   }
 
   @Override

Modified: lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/TrieDateField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/TrieDateField.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/TrieDateField.java (original)
+++ lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/TrieDateField.java Mon May 30 14:51:25 2011
@@ -17,7 +17,6 @@
 
 package org.apache.solr.schema;
 
-import org.apache.noggit.CharArr;
 import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.QParser;
 import org.apache.solr.response.TextResponseWriter;
@@ -26,6 +25,7 @@ import org.apache.lucene.search.SortFiel
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.NumericRangeQuery;
 import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.CharsRef;
 
 import java.util.Map;
 import java.util.Date;
@@ -111,10 +111,10 @@ public class TrieDateField extends DateF
   public String indexedToReadable(String _indexedForm) {
     return wrappedField.indexedToReadable(_indexedForm);
   }
-
   @Override
-  public void indexedToReadable(BytesRef input, CharArr out) {
-    wrappedField.indexedToReadable(input, out);
+  public CharsRef indexedToReadable(BytesRef input, CharsRef charsRef) {
+    // TODO: this could be more efficient, but the sortable types should be deprecated instead
+    return wrappedField.indexedToReadable(input, charsRef);
   }
 
   @Override

Modified: lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/TrieField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/TrieField.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/TrieField.java (original)
+++ lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/schema/TrieField.java Mon May 30 14:51:25 2011
@@ -26,8 +26,8 @@ import org.apache.lucene.search.cache.Fl
 import org.apache.lucene.search.cache.IntValuesCreator;
 import org.apache.lucene.search.cache.LongValuesCreator;
 import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.CharsRef;
 import org.apache.lucene.util.NumericUtils;
-import org.apache.noggit.CharArr;
 import org.apache.solr.analysis.*;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.response.TextResponseWriter;
@@ -296,7 +296,7 @@ public class TrieField extends FieldType
   @Override
   public String readableToIndexed(String val) {
     // TODO: Numeric should never be handled as String, that may break in future lucene versions! Change to use BytesRef for term texts!
-    BytesRef bytes = new BytesRef(NumericUtils.BUF_SIZE_LONG);
+    final BytesRef bytes = new BytesRef(NumericUtils.BUF_SIZE_LONG);
     readableToIndexed(val, bytes);
     return bytes.utf8ToString();
   }
@@ -363,31 +363,29 @@ public class TrieField extends FieldType
   }
 
   @Override
-  public void indexedToReadable(BytesRef input, CharArr out) {
-    BytesRef indexedForm = input;
-    String s;
-
+  public CharsRef indexedToReadable(BytesRef indexedForm, CharsRef charsRef) {
+    final char[] value;
     switch (type) {
       case INTEGER:
-        s = Integer.toString( NumericUtils.prefixCodedToInt(indexedForm) );
+        value = Integer.toString( NumericUtils.prefixCodedToInt(indexedForm) ).toCharArray();
         break;
       case FLOAT:
-        s = Float.toString( NumericUtils.sortableIntToFloat(NumericUtils.prefixCodedToInt(indexedForm)) );
+        value = Float.toString( NumericUtils.sortableIntToFloat(NumericUtils.prefixCodedToInt(indexedForm)) ).toCharArray();
         break;
       case LONG:
-        s = Long.toString( NumericUtils.prefixCodedToLong(indexedForm) );
+        value = Long.toString( NumericUtils.prefixCodedToLong(indexedForm) ).toCharArray();
         break;
       case DOUBLE:
-        s = Double.toString( NumericUtils.sortableLongToDouble(NumericUtils.prefixCodedToLong(indexedForm)) );
+        value = Double.toString( NumericUtils.sortableLongToDouble(NumericUtils.prefixCodedToLong(indexedForm)) ).toCharArray();
         break;
       case DATE:
-        s = dateField.toExternal( new Date(NumericUtils.prefixCodedToLong(indexedForm)) );
+        value = dateField.toExternal( new Date(NumericUtils.prefixCodedToLong(indexedForm)) ).toCharArray();
         break;
       default:
         throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unknown type for trie field: " + type);
     }
-
-    out.write(s);
+    charsRef.copy(value, 0, value.length);
+    return charsRef;
   }
 
   @Override

Modified: lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/search/MissingStringLastComparatorSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/search/MissingStringLastComparatorSource.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/search/MissingStringLastComparatorSource.java (original)
+++ lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/search/MissingStringLastComparatorSource.java Mon May 30 14:51:25 2011
@@ -21,11 +21,11 @@ import org.apache.lucene.search.*;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
 import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.UnicodeUtil;
 import org.apache.lucene.util.packed.Direct16;
 import org.apache.lucene.util.packed.Direct32;
 import org.apache.lucene.util.packed.Direct8;
 import org.apache.lucene.util.packed.PackedInts;
-import org.apache.solr.util.ByteUtils;
 
 import java.io.IOException;
 
@@ -34,7 +34,7 @@ public class MissingStringLastComparator
   private final BytesRef missingValueProxy;
 
   public MissingStringLastComparatorSource() {
-    this(ByteUtils.bigTerm);
+    this(UnicodeUtil.BIG_TERM);
   }
 
   /** Creates a {@link FieldComparatorSource} that sorts null last in a normal ascending sort.

Modified: lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/search/MutableValueStr.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/search/MutableValueStr.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/search/MutableValueStr.java (original)
+++ lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/search/MutableValueStr.java Mon May 30 14:51:25 2011
@@ -17,14 +17,13 @@
 package org.apache.solr.search;
 
 import org.apache.lucene.util.BytesRef;
-import org.apache.solr.util.ByteUtils;
 
 public class MutableValueStr extends MutableValue {
   public BytesRef value = new BytesRef();
 
   @Override
   public Object toObject() {
-    return exists ? ByteUtils.UTF8toUTF16(value) : null;
+    return exists ? value.utf8ToString() : null;
   }
 
   @Override

Modified: lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/search/function/FileFloatSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/search/function/FileFloatSource.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/search/function/FileFloatSource.java (original)
+++ lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/search/function/FileFloatSource.java Mon May 30 14:51:25 2011
@@ -16,23 +16,38 @@
  */
 package org.apache.solr.search.function;
 
-import org.apache.lucene.index.IndexReader;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.WeakHashMap;
+
 import org.apache.lucene.index.DocsEnum;
+import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.MultiFields;
+import org.apache.lucene.index.TermsEnum;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
 import org.apache.lucene.index.IndexReader.ReaderContext;
-import org.apache.lucene.index.TermsEnum;
-import org.apache.lucene.index.MultiFields;
+import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.ReaderUtil;
 import org.apache.lucene.util.StringHelper;
-import org.apache.lucene.util.BytesRef;
 import org.apache.solr.core.SolrCore;
-import org.apache.solr.schema.SchemaField;
+import org.apache.solr.handler.RequestHandlerBase;
+import org.apache.solr.handler.RequestHandlerUtils;
+import org.apache.solr.request.SolrQueryRequest;
+import org.apache.solr.response.SolrQueryResponse;
 import org.apache.solr.schema.FieldType;
+import org.apache.solr.schema.SchemaField;
 import org.apache.solr.search.QParser;
+import org.apache.solr.update.processor.UpdateRequestProcessor;
 import org.apache.solr.util.VersionedFile;
-
-import java.io.*;
-import java.util.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Obtains float field values from an external file.
@@ -99,6 +114,10 @@ public class FileFloatSource extends Val
             + ",defVal="+defVal+",dataDir="+dataDir+")";
 
   }
+  
+  public static void resetCache(){
+    floatCache.resetCache();
+  }
 
   private final float[] getCachedFloats(IndexReader reader) {
     return (float[])floatCache.get(reader, new Entry(this));
@@ -150,6 +169,14 @@ public class FileFloatSource extends Val
 
       return value;
     }
+    
+    public void resetCache(){
+      synchronized(readerCache){
+        // Map.clear() is optional and can throw UnsipportedOperationException,
+        // but readerCache is WeakHashMap and it supports clear().
+        readerCache.clear();
+      }
+    }
   }
 
   static Object onlyForTesting; // set to the last value
@@ -272,5 +299,44 @@ public class FileFloatSource extends Val
     return vals;
   }
 
+  public static class ReloadCacheRequestHandler extends RequestHandlerBase {
+    
+    static final Logger log = LoggerFactory.getLogger(ReloadCacheRequestHandler.class);
 
+    @Override
+    public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp)
+        throws Exception {
+      FileFloatSource.resetCache();
+      log.debug("readerCache has been reset.");
+
+      UpdateRequestProcessor processor =
+        req.getCore().getUpdateProcessingChain(null).createProcessor(req, rsp);
+      try{
+        RequestHandlerUtils.handleCommit(req, processor, req.getParams(), true);
+      }
+      finally{
+        processor.finish();
+      }
+    }
+
+    @Override
+    public String getDescription() {
+      return "Reload readerCache request handler";
+    }
+
+    @Override
+    public String getSource() {
+      return "$URL$";
+    }
+
+    @Override
+    public String getSourceId() {
+      return "$Id$";
+    }
+
+    @Override
+    public String getVersion() {
+      return "$Revision$";
+    }    
+  }
 }

Modified: lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/search/function/IDFValueSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/search/function/IDFValueSource.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/search/function/IDFValueSource.java (original)
+++ lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/search/function/IDFValueSource.java Mon May 30 14:51:25 2011
@@ -22,7 +22,6 @@ import org.apache.lucene.index.IndexRead
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.Similarity;
 import org.apache.lucene.util.BytesRef;
-import org.apache.solr.util.ByteUtils;
 
 import java.io.IOException;
 import java.util.Map;
@@ -43,8 +42,7 @@ public class IDFValueSource extends DocF
     IndexSearcher searcher = (IndexSearcher)context.get("searcher");
     Similarity sim = searcher.getSimilarityProvider().get(field);
     // todo: we need docFreq that takes a BytesRef
-    String strVal = ByteUtils.UTF8toUTF16(indexedBytes);
-    int docfreq = searcher.docFreq(new Term(indexedField, strVal));
+    int docfreq = searcher.docFreq(new Term(indexedField, indexedBytes.utf8ToString()));
     float idf = sim.idf(docfreq, searcher.maxDoc());
     return new ConstDoubleDocValues(idf, this);
   }

Modified: lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/search/function/StringIndexDocValues.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/search/function/StringIndexDocValues.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/search/function/StringIndexDocValues.java (original)
+++ lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/search/function/StringIndexDocValues.java Mon May 30 14:51:25 2011
@@ -21,10 +21,9 @@ import org.apache.lucene.search.FieldCac
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
 import org.apache.lucene.util.BytesRef;
-import org.apache.noggit.CharArr;
+import org.apache.lucene.util.CharsRef;
 import org.apache.solr.search.MutableValue;
 import org.apache.solr.search.MutableValueStr;
-import org.apache.solr.util.ByteUtils;
 
 import java.io.IOException;
 
@@ -36,7 +35,7 @@ public abstract class StringIndexDocValu
   protected final ValueSource vs;
   protected final MutableValueStr val = new MutableValueStr();
   protected final BytesRef spare = new BytesRef();
-  protected final CharArr spareChars = new CharArr();
+  protected final CharsRef spareChars = new CharsRef();
 
   public StringIndexDocValues(ValueSource vs, AtomicReaderContext context, String field) throws IOException {
     try {
@@ -75,8 +74,7 @@ public abstract class StringIndexDocValu
     int ord=termsIndex.getOrd(doc);
     if (ord==0) return null;
     termsIndex.lookup(ord, spare);
-    spareChars.reset();
-    ByteUtils.UTF8toUTF16(spare, spareChars);
+    spare.utf8ToChars(spareChars);
     return spareChars.toString();
   }
 

Modified: lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/search/function/VectorValueSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/search/function/VectorValueSource.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/search/function/VectorValueSource.java (original)
+++ lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/search/function/VectorValueSource.java Mon May 30 14:51:25 2011
@@ -85,8 +85,8 @@ public class VectorValueSource extends M
         }
         @Override
         public void floatVal(int doc, float[] vals) {
-          vals[0] = x.byteVal(doc);
-          vals[1] = y.byteVal(doc);
+          vals[0] = x.floatVal(doc);
+          vals[1] = y.floatVal(doc);
         }
         @Override
         public void doubleVal(int doc, double[] vals) {

Modified: lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java (original)
+++ lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java Mon May 30 14:51:25 2011
@@ -26,12 +26,12 @@ import org.slf4j.LoggerFactory;
 
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
+import org.apache.lucene.search.spell.HighFrequencyDictionary;
 import org.apache.lucene.search.spell.PlainTextDictionary;
 import org.apache.lucene.store.RAMDirectory;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.schema.FieldType;
-import org.apache.solr.util.HighFrequencyDictionary;
 import org.apache.solr.search.SolrIndexSearcher;
 
 /**

Modified: lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/spelling/IndexBasedSpellChecker.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/spelling/IndexBasedSpellChecker.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/spelling/IndexBasedSpellChecker.java (original)
+++ lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/spelling/IndexBasedSpellChecker.java Mon May 30 14:51:25 2011
@@ -18,10 +18,11 @@ package org.apache.solr.spelling;
 
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.store.FSDirectory;
+import org.apache.lucene.search.spell.HighFrequencyDictionary;
+
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.search.SolrIndexSearcher;
-import org.apache.solr.util.HighFrequencyDictionary;
 
 import java.io.File;
 import java.io.IOException;

Modified: lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/update/SolrIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/update/SolrIndexWriter.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/update/SolrIndexWriter.java (original)
+++ lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/update/SolrIndexWriter.java Mon May 30 14:51:25 2011
@@ -18,7 +18,10 @@
 package org.apache.solr.update;
 
 import org.apache.lucene.index.*;
+import org.apache.lucene.index.IndexWriterConfig.OpenMode;
+import org.apache.lucene.index.codecs.CodecProvider;
 import org.apache.lucene.store.*;
+import org.apache.lucene.util.Version;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.core.DirectoryFactory;
 import org.apache.solr.schema.IndexSchema;
@@ -27,6 +30,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
@@ -79,16 +83,21 @@ public class SolrIndexWriter extends Ind
     return d;
   }
   
-  public SolrIndexWriter(String name, String path, DirectoryFactory dirFactory, boolean create, IndexSchema schema, SolrIndexConfig config, IndexDeletionPolicy delPolicy) throws IOException {
+  public SolrIndexWriter(String name, String path, DirectoryFactory dirFactory, boolean create, IndexSchema schema, SolrIndexConfig config, IndexDeletionPolicy delPolicy, CodecProvider codecProvider) throws IOException {
     super(
         getDirectory(path, dirFactory, config),
         config.toIndexWriterConfig(schema).
             setOpenMode(create ? IndexWriterConfig.OpenMode.CREATE : IndexWriterConfig.OpenMode.APPEND).
-            setIndexDeletionPolicy(delPolicy)
+            setIndexDeletionPolicy(delPolicy).setCodecProvider(codecProvider)
     );
     log.debug("Opened Writer " + name);
     this.name = name;
 
+    setInfoStream(config);
+  }
+
+  private void setInfoStream(SolrIndexConfig config)
+      throws IOException {
     String infoStreamFile = config.infoStreamFile;
     if (infoStreamFile != null) {
       File f = new File(infoStreamFile);

Modified: lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/update/UpdateHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/update/UpdateHandler.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/update/UpdateHandler.java (original)
+++ lucene/dev/branches/solr2452/solr/src/java/org/apache/solr/update/UpdateHandler.java Mon May 30 14:51:25 2011
@@ -98,7 +98,7 @@ public abstract class UpdateHandler impl
   }
 
   protected SolrIndexWriter createMainIndexWriter(String name, boolean removeAllExisting) throws IOException {
-    return new SolrIndexWriter(name,core.getNewIndexDir(), core.getDirectoryFactory(), removeAllExisting, schema, core.getSolrConfig().mainIndexConfig, core.getDeletionPolicy());
+    return new SolrIndexWriter(name,core.getNewIndexDir(), core.getDirectoryFactory(), removeAllExisting, schema, core.getSolrConfig().mainIndexConfig, core.getDeletionPolicy(), core.getCodecProvider());
   }
 
   protected final Term idTerm(String readableId) {

Modified: lucene/dev/branches/solr2452/solr/src/site/src/documentation/content/xdocs/tutorial.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/site/src/documentation/content/xdocs/tutorial.xml?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/site/src/documentation/content/xdocs/tutorial.xml (original)
+++ lucene/dev/branches/solr2452/solr/src/site/src/documentation/content/xdocs/tutorial.xml Mon May 30 14:51:25 2011
@@ -210,9 +210,9 @@ SimplePostTool: COMMITting Solr index ch
 <p>
 You may have noticed that even though the file <code>solr.xml</code> has now
 been POSTed to the server twice, you still only get 1 result when searching for
-"solr".  This is because the example schema.xml specifies a "uniqueKey" field
+"solr".  This is because the example <code>schema.xml</code> specifies a "<code>uniqueKey</code>" field
 called "<code>id</code>".  Whenever you POST instructions to Solr to add a
-document with the same value for the uniqueKey as an existing document, it
+document with the same value for the <code>uniqueKey</code> as an existing document, it
 automatically replaces it for you.  You can see that that has happened by
 looking at the values for <code>numDocs</code> and <code>maxDoc</code> in the
 "CORE"/searcher section of the statistics page...  </p>
@@ -221,13 +221,13 @@ looking at the values for <code>numDocs<
 </p>
 
 <p>
-  <strong>numDocs</strong> represents the number of searchable documents in the
+  <strong><code>numDocs</code></strong> represents the number of searchable documents in the
   index (and will be larger than the number of XML files since some files
-  contained more than one <code>&lt;doc&gt;</code>). <strong>maxDoc</strong>
-  may be larger as the maxDoc count includes logically deleted documents that
+  contained more than one <code>&lt;doc&gt;</code>). <strong><code>maxDoc</code></strong>
+  may be larger as the <code>maxDoc</code> count includes logically deleted documents that
   have not yet been removed from the index. You can re-post the sample XML
-  files over and over again as much as you want and numDocs will never
-  increase,because the new documents will constantly be replacing the old.
+  files over and over again as much as you want and <code>numDocs</code> will never
+  increase, because the new documents will constantly be replacing the old.
 </p>
 <p>
 Go ahead and edit the existing XML files to change some of the data, and re-run
@@ -246,7 +246,7 @@ in subsequent searches.
     <p>Now if you go to the <a href="http://localhost:8983/solr/admin/stats.jsp">statistics</a> page and scroll down
        to the UPDATE_HANDLERS section and verify that "<code>deletesById : 1</code>"</p>
     <p>If you search for <a href="http://localhost:8983/solr/select?q=id:SP2514N">id:SP2514N</a> it will still be found,
-       because index changes are not visible until, and a new searcher is opened.  To cause
+       because index changes are not visible until changes are committed and a new searcher is opened.  To cause
        this to happen, send a commit command to Solr (post.jar does this for you by default):</p>
     <source>java -jar post.jar</source>
     <p>Now re-execute the previous search and verify that no matching documents are found.  Also revisit the
@@ -256,7 +256,7 @@ in subsequent searches.
     <source>java -Ddata=args -jar post.jar "&lt;delete>&lt;query>name:DDR&lt;/query>&lt;/delete>"</source>
 
     <p>Commit can be an expensive operation so it's best to make many changes to an index in a batch and
-      then send the commit command at the end.  There is also an optimize command that does the same thing as commit,
+      then send the <code>commit</code> command at the end.  There is also an <code>optimize</code> command that does the same thing as <code>commit</code>,
       in addition to merging all index segments into a single segment, making it faster to search and causing any
       deleted documents to be removed.  All of the update commands are documented <a href="http://wiki.apache.org/solr/UpdateXmlMessages">here</a>.
     </p>
@@ -272,10 +272,10 @@ in subsequent searches.
   <title>Querying Data</title>
 
   <p>
-    Searches are done via HTTP GET on the select URL with the query string in the q parameter.
+    Searches are done via HTTP GET on the <code>select</code> URL with the query string in the <code>q</code> parameter.
     You can pass a number of optional <a href="http://wiki.apache.org/solr/StandardRequestHandler">request parameters</a>
-    to the request handler to control what information is returned.  For example, you can use the "fl" parameter
-    to control what stored fields are returned, and if the relevancy score is returned...
+    to the request handler to control what information is returned.  For example, you can use the "<code>fl</code>" parameter
+    to control what stored fields are returned, and if the relevancy score is returned:
   </p>
 
     <ul>
@@ -288,7 +288,7 @@ in subsequent searches.
 
   <p>
     Solr provides a <a href="http://localhost:8983/solr/admin/form.jsp">query form</a> within the web admin interface
-    that allows setting the various request parameters and is useful when trying out or debugging queries.
+    that allows setting the various request parameters and is useful when testing or debugging queries.
   </p>
 
   <section>
@@ -296,7 +296,7 @@ in subsequent searches.
 
     <p>
       Solr provides a simple method to sort on one or more indexed fields.
-      Use the 'sort' parameter to specify "field direction" pairs...
+      Use the "<code>sort</code>' parameter to specify "field direction" pairs, separated by commas if there's more than one sort field:
     </p>
 
     <ul>
@@ -306,7 +306,7 @@ in subsequent searches.
     </ul>
 
     <p>
-      "score" can also be used as a field name when specifying a sort...
+      "<code>score</code>" can also be used as a field name when specifying a sort:
     </p>
     <ul>
       <li><a href="http://localhost:8983/solr/select/?indent=on&amp;q=video&amp;sort=score+desc">q=video&amp;sort=score desc</a></li>
@@ -314,7 +314,7 @@ in subsequent searches.
     </ul>
 
     <p>
-      Complex functions may also be used to sort results...
+      Complex functions may also be used to sort results:
     </p>
     <ul>
       <li><a href="http://localhost:8983/solr/select/?indent=on&amp;q=*:*&amp;sort=div(popularity,add(price,1))+desc">q=video&amp;sort=div(popularity,add(price,1)) desc</a></li>
@@ -334,7 +334,7 @@ in subsequent searches.
   <title>Highlighting</title>
   <p>
     Hit highlighting returns relevent snippets of each returned document, and highlights
-    keywords from the query within those context snippets.
+    terms from the query within those context snippets.
   </p>
   <p>
     The following example searches for <code>video card</code> and requests
@@ -429,42 +429,52 @@ in subsequent searches.
   <title>Text Analysis</title>
 
   <p>
-    Text fields are typically indexed by breaking the field into words and applying various transformations such as
+    Text fields are typically indexed by breaking the text into words and applying various transformations such as
     lowercasing, removing plurals, or stemming to increase relevancy.  The same text transformations are normally
     applied to any queries in order to match what is indexed.
   </p>
 
-  <p>Example queries demonstrating relevancy improving transformations:</p>
+  <p>
+    The <a href="http://wiki.apache.org/solr/SchemaXml">schema</a> defines
+    the fields in the index and what type of analysis is applied to them.  The current schema your server is using
+    may be accessed via the <code>[SCHEMA]</code> link on the <a href="http://localhost:8983/solr/admin/">admin</a> page.
+  </p>
+
+  <p>
+    The best analysis components (tokenization and filtering) for your textual content depends heavily on language.
+    As you can see in the above <code>[SCHEMA]</code> link, the fields in the example schema are using a <code>fieldType</code>
+    named <code>text_general</code>, which has defaults appropriate for all languages.
+  </p>
+
+  <p>
+    If you know your textual content is English, as is the case for the example documents in this tutorial,
+    and you'd like to apply English-specific stemming and stop word removal, as well as split compound words, you can use the <code>text_en_splitting</code> fieldType instead.
+    Go ahead and edit the <code>schema.xml</code> under the <code>solr/example/solr/conf</code> directory,
+    and change the <code>type</code> for fields <code>text</code> and <code>features</code> from <code>text_general</code> to <code>text_en_splitting</code>.
+    Restart the server and then re-post all of the documents, and then these queries will show the English-specific transformations:
+  </p>
   <ul>
     <li>A search for
        <a href="http://localhost:8983/solr/select/?indent=on&amp;q=power-shot&amp;fl=name">power-shot</a>
        matches <code>PowerShot</code>, and
       <a href="http://localhost:8983/solr/select/?indent=on&amp;q=adata&amp;fl=name">adata</a>
-      matches <code>A-DATA</code> due to the use of WordDelimiterFilter and LowerCaseFilter.
+      matches <code>A-DATA</code> due to the use of <code>WordDelimiterFilter</code> and <code>LowerCaseFilter</code>.
     </li>
 
     <li>A search for
       <a href="http://localhost:8983/solr/select/?indent=on&amp;q=features:recharging&amp;fl=name,features">features:recharging</a>
-       matches <code>Rechargeable</code> due to stemming with the EnglishPorterFilter.
+       matches <code>Rechargeable</code> due to stemming with the <code>EnglishPorterFilter</code>.
     </li>
 
     <li>A search for
        <a href="http://localhost:8983/solr/select/?indent=on&amp;q=&quot;1 gigabyte&quot;&amp;fl=name">"1 gigabyte"</a>
        matches things with <code>GB</code>, and the misspelled
       <a href="http://localhost:8983/solr/select/?indent=on&amp;q=pixima&amp;fl=name">pixima</a>
-       matches <code>Pixma</code> due to use of a SynonymFilter.
+       matches <code>Pixma</code> due to use of a <code>SynonymFilter</code>.
     </li>
 
   </ul>
 
-
-  <p>
-    The <a href="http://wiki.apache.org/solr/SchemaXml">schema</a> defines
-    the fields in the index and what type of analysis is applied to them.  The current schema your server is using
-    may be accessed via the <code>[SCHEMA]</code> link on the <a href="http://localhost:8983/solr/admin/">admin</a> page.
-  </p>
-
-
   <p>A full description of the analysis components, Analyzers, Tokenizers, and TokenFilters
     available for use is <a href="http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters">here</a>.
   </p>
@@ -479,7 +489,7 @@ in subsequent searches.
     <p>
       <a href="http://localhost:8983/solr/admin/analysis.jsp?name=name&amp;val=Canon+Power-Shot+SD500">This</a>
       shows how "<code>Canon Power-Shot SD500</code>" would be indexed as a value in the name field.  Each row of
-      the table shows the resulting tokens after having passed through the next TokenFilter in the Analyzer for the <code>name</code> field.
+      the table shows the resulting tokens after having passed through the next <code>TokenFilter</code> in the analyzer for the <code>name</code> field.
       Notice how both <code>powershot</code> and <code>power</code>, <code>shot</code> are indexed.  Tokens generated at the same position
       are shown in the same column, in this case <code>shot</code> and <code>powershot</code>.
     </p>
@@ -501,27 +511,26 @@ in subsequent searches.
   <title>Conclusion</title>
   <p>
   Congratulations!  You successfully ran a small Solr instance, added some
-  documents, and made changes to the index.  You learned about queries, text
+  documents, and made changes to the index and schema.  You learned about queries, text
   analysis, and the Solr admin interface.  You're ready to start using Solr on
   your own project!  Continue on with the following steps:
 </p>
 <ul>
   <li>Subscribe to the Solr <a href="mailing_lists.html">mailing lists</a>!</li>
-  <li>Make a copy of the Solr example directory as a template for your project.</li>
-  <li>Customize the schema and other config in solr/conf/ to meet your needs.</li> 
+  <li>Make a copy of the Solr <code>example</code> directory as a template for your project.</li>
+  <li>Customize the schema and other config in <code>solr/conf/</code> to meet your needs.</li> 
 </ul>
 
 <p>
-  Solr as a ton of other features that we haven't touched on here, including
+  Solr has a ton of other features that we haven't touched on here, including
   <a href="http://wiki.apache.org/solr/DistributedSearch">distributed search</a>
   to handle huge document collections,
   <a href="http://wiki.apache.org/solr/FunctionQuery">function queries</a>,
   <a href="http://wiki.apache.org/solr/StatsComponent">numeric field statistics</a>,
   and
   <a href="http://wiki.apache.org/solr/ClusteringComponent">search results clustering</a>.
-  Explore the <a href="http://wiki.apache.org/solr/FrontPage">Solr Wiki</a> to find out
-  more details about Solr's many
-  <a href="features.html">features</a>.
+  Explore the <a href="http://wiki.apache.org/solr/FrontPage">Solr Wiki</a> to find
+  more details about Solr's many <a href="features.html">features</a>.
 </p>
 
 <p>

Modified: lucene/dev/branches/solr2452/solr/src/test-files/solr/conf/schema12.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/test-files/solr/conf/schema12.xml?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/test-files/solr/conf/schema12.xml (original)
+++ lucene/dev/branches/solr2452/solr/src/test-files/solr/conf/schema12.xml Mon May 30 14:51:25 2011
@@ -28,7 +28,7 @@
      $Name:  $
   -->
 
-<schema name="test" version="1.2">
+<schema name="test" version="1.4">
   <types>
 
     <!-- field type definitions... note that the "name" attribute is
@@ -104,7 +104,7 @@
 
 
     <!-- HighlitText optimizes storage for (long) columns which will be highlit -->
-    <fieldtype name="highlittext" class="solr.TextField" compressThreshold="345" />
+    <fieldtype name="highlittext" class="solr.TextField"/>
 
     <fieldtype name="boolean" class="solr.BoolField" sortMissingLast="true"/>
     <fieldtype name="string" class="solr.StrField" sortMissingLast="true"/>
@@ -116,7 +116,7 @@
     <fieldtype name="tdate" class="solr.TrieDateField" sortMissingLast="true" precisionStep="6"/>
     <fieldtype name="pdate" class="solr.DateField" sortMissingLast="true"/>
 
-  <fieldType name="text" class="solr.TextField" positionIncrementGap="100">
+  <fieldType name="text" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true" >
       <analyzer type="index">
         <tokenizer class="solr.WhitespaceTokenizerFactory"/>
         <filter class="solr.StopFilterFactory"
@@ -146,7 +146,7 @@
 
 
     <!-- field type that doesn't generate phrases from unquoted multiple tokens per analysis unit -->
-   <fieldType name="text_np" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="false" >
+   <fieldType name="text_np" class="solr.TextField" positionIncrementGap="100">
       <analyzer type="index">
         <tokenizer class="solr.WhitespaceTokenizerFactory"/>
         <filter class="solr.StopFilterFactory"

Modified: lucene/dev/branches/solr2452/solr/src/test-files/solr/conf/solrconfig-functionquery.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/test-files/solr/conf/solrconfig-functionquery.xml?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/test-files/solr/conf/solrconfig-functionquery.xml (original)
+++ lucene/dev/branches/solr2452/solr/src/test-files/solr/conf/solrconfig-functionquery.xml Mon May 30 14:51:25 2011
@@ -30,6 +30,9 @@
   <updateHandler class="solr.DirectUpdateHandler2"/>
   <requestHandler name="/update" class="solr.XmlUpdateRequestHandler" />
 
+  <requestHandler name="/reloadCache"
+                  class="org.apache.solr.search.function.FileFloatSource$ReloadCacheRequestHandler" />
+
   <!-- test ValueSourceParser plugins -->
   <valueSourceParser name="nvl" class="org.apache.solr.search.function.NvlValueSourceParser">
     <float name="nvlFloatValue">0.0</float>

Modified: lucene/dev/branches/solr2452/solr/src/test-framework/org/apache/solr/SolrTestCaseJ4.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/test-framework/org/apache/solr/SolrTestCaseJ4.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/test-framework/org/apache/solr/SolrTestCaseJ4.java (original)
+++ lucene/dev/branches/solr2452/solr/src/test-framework/org/apache/solr/SolrTestCaseJ4.java Mon May 30 14:51:25 2011
@@ -36,12 +36,8 @@ import org.apache.solr.handler.JsonUpdat
 import org.apache.solr.request.LocalSolrQueryRequest;
 import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.request.SolrRequestHandler;
-import org.apache.solr.response.ResultContext;
-import org.apache.solr.response.SolrQueryResponse;
 import org.apache.solr.schema.IndexSchema;
 import org.apache.solr.schema.SchemaField;
-import org.apache.solr.search.DocIterator;
-import org.apache.solr.search.DocList;
 import org.apache.solr.search.SolrIndexSearcher;
 import org.apache.solr.servlet.DirectSolrConnection;
 import org.apache.solr.util.TestHarness;
@@ -66,6 +62,7 @@ public abstract class SolrTestCaseJ4 ext
 
   @BeforeClass
   public static void beforeClassSolrTestCase() throws Exception {
+    startTrackingSearchers();
     ignoreException("ignore_exception");
   }
 
@@ -73,6 +70,7 @@ public abstract class SolrTestCaseJ4 ext
   public static void afterClassSolrTestCase() throws Exception {
     deleteCore();
     resetExceptionIgnores();
+    endTrackingSearchers();
   }
 
   @Override
@@ -96,7 +94,6 @@ public abstract class SolrTestCaseJ4 ext
   /** Call initCore in @BeforeClass to instantiate a solr core in your test class.
    * deleteCore will be called for you via SolrTestCaseJ4 @AfterClass */
   public static void initCore(String config, String schema, String solrHome) throws Exception {
-    startTrackingSearchers();
     configString = config;
     schemaString = schema;
     if (solrHome != null) {
@@ -108,12 +105,12 @@ public abstract class SolrTestCaseJ4 ext
 
   static long numOpens;
   static long numCloses;
-  protected static void startTrackingSearchers() {
+  public static void startTrackingSearchers() {
     numOpens = SolrIndexSearcher.numOpens.get();
     numCloses = SolrIndexSearcher.numCloses.get();
   }
 
-  protected static void endTrackingSearchers() {
+  public static void endTrackingSearchers() {
      long endNumOpens = SolrIndexSearcher.numOpens.get();
      long endNumCloses = SolrIndexSearcher.numCloses.get();
 
@@ -293,8 +290,6 @@ public abstract class SolrTestCaseJ4 ext
     h = null;
     lrf = null;
     configString = schemaString = null;
-
-    endTrackingSearchers();
   }
 
 

Modified: lucene/dev/branches/solr2452/solr/src/test-framework/org/apache/solr/util/AbstractSolrTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/test-framework/org/apache/solr/util/AbstractSolrTestCase.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/test-framework/org/apache/solr/util/AbstractSolrTestCase.java (original)
+++ lucene/dev/branches/solr2452/solr/src/test-framework/org/apache/solr/util/AbstractSolrTestCase.java Mon May 30 14:51:25 2011
@@ -28,7 +28,8 @@ import org.apache.solr.common.SolrInputF
 import org.apache.solr.common.params.CommonParams;
 import org.apache.solr.common.util.XML;
 import org.apache.solr.request.*;
-import org.apache.solr.util.TestHarness;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
 
 import org.xml.sax.SAXException;
 import org.slf4j.LoggerFactory;
@@ -93,6 +94,16 @@ public abstract class AbstractSolrTestCa
     return SolrTestCaseJ4.TEST_HOME();
   }
   
+  @BeforeClass
+  public static void beforeClassAbstractSolrTestCase() throws Exception {
+    SolrTestCaseJ4.startTrackingSearchers();
+  }
+  
+  @AfterClass
+  public static void afterClassAbstractSolrTestCase() throws Exception {
+    SolrTestCaseJ4.endTrackingSearchers();
+  }
+  
   /**
    * The directory used to story the index managed by the TestHarness h
    */

Modified: lucene/dev/branches/solr2452/solr/src/test/org/apache/solr/BasicFunctionalityTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/test/org/apache/solr/BasicFunctionalityTest.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/test/org/apache/solr/BasicFunctionalityTest.java (original)
+++ lucene/dev/branches/solr2452/solr/src/test/org/apache/solr/BasicFunctionalityTest.java Mon May 30 14:51:25 2011
@@ -120,7 +120,7 @@ public class BasicFunctionalityTest exte
     // test merge factor picked up
     SolrCore core = h.getCore();
 
-    SolrIndexWriter writer = new SolrIndexWriter("testWriter",core.getNewIndexDir(), core.getDirectoryFactory(), false, core.getSchema(), core.getSolrConfig().mainIndexConfig, core.getDeletionPolicy());
+    SolrIndexWriter writer = new SolrIndexWriter("testWriter",core.getNewIndexDir(), core.getDirectoryFactory(), false, core.getSchema(), core.getSolrConfig().mainIndexConfig, core.getDeletionPolicy(), core.getCodecProvider());
     assertEquals("Mergefactor was not picked up", ((LogMergePolicy) writer.getConfig().getMergePolicy()).getMergeFactor(), 8);
     writer.close();
 

Modified: lucene/dev/branches/solr2452/solr/src/test/org/apache/solr/ConvertedLegacyTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/test/org/apache/solr/ConvertedLegacyTest.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/test/org/apache/solr/ConvertedLegacyTest.java (original)
+++ lucene/dev/branches/solr2452/solr/src/test/org/apache/solr/ConvertedLegacyTest.java Mon May 30 14:51:25 2011
@@ -889,13 +889,10 @@ public class ConvertedLegacyTest extends
     assertQ(req("id:42 AND subword:\"bar foo\"")
             ,"*[count(//doc)=0]"
             );
-    assertQ(req("id:42 AND subword:bar-foo")
-            ,"*[count(//doc)=0]"
-            );
     assertQ(req("id:42 AND subword:\"bar foo\"~2")
             ,"*[count(//doc)=1]"
             );
-    assertQ(req("id:42 AND subword:foo/bar")
+    assertQ(req("id:42 AND subword:\"foo/bar\"")
             ,"*[count(//doc)=1]"
             );
     assertQ(req("id:42 AND subword:foobar")
@@ -916,13 +913,10 @@ public class ConvertedLegacyTest extends
     assertQ(req("id:42 AND subword:\"bar foo\"")
             ,"*[count(//doc)=0]"
             );
-    assertQ(req("id:42 AND subword:bar-foo")
-            ,"*[count(//doc)=0]"
-            );
     assertQ(req("id:42 AND subword:\"bar foo\"~2")
             ,"*[count(//doc)=1]"
             );
-    assertQ(req("id:42 AND subword:foo/bar")
+    assertQ(req("id:42 AND subword:\"foo/bar\"")
             ,"*[count(//doc)=1]"
             );
     assertQ(req("id:42 AND subword:foobar")

Modified: lucene/dev/branches/solr2452/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java (original)
+++ lucene/dev/branches/solr2452/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java Mon May 30 14:51:25 2011
@@ -20,7 +20,6 @@ package org.apache.solr.client.solrj;
 
 import java.io.IOException;
 import java.io.StringWriter;
-import java.io.File;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
@@ -912,11 +911,33 @@ abstract public class SolrExampleTests e
         
         // Make sure the transformer works for streaming
         Float score = (Float)doc.get( "score" );
-        Integer docid = (Integer)doc.get( "_docid_" );
         assertEquals( "should have score", new Float(1.0), score );
       }
      
     });
     assertEquals(10, cnt.get() );
   }
+
+  @Test
+  public void testChineseDefaults() throws Exception {
+    // Empty the database...
+    server.deleteByQuery( "*:*" );// delete everything!
+    server.commit();
+    assertNumFound( "*:*", 0 ); // make sure it got in
+
+    // Beijing medical University
+    UpdateRequest req = new UpdateRequest();
+    SolrInputDocument doc = new SolrInputDocument();
+    doc.addField("id", "42");
+    doc.addField("text", "北京医科大学");
+    req.add(doc);
+
+    req.setAction(ACTION.COMMIT, true, true );
+    req.process( server );
+
+    // Beijing university should match:
+    SolrQuery query = new SolrQuery("北京大学");
+    QueryResponse rsp = server.query( query );
+    assertEquals(1, rsp.getResults().getNumFound());
+  }
 }

Modified: lucene/dev/branches/solr2452/solr/src/test/org/apache/solr/cloud/BasicZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/test/org/apache/solr/cloud/BasicZkTest.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/test/org/apache/solr/cloud/BasicZkTest.java (original)
+++ lucene/dev/branches/solr2452/solr/src/test/org/apache/solr/cloud/BasicZkTest.java Mon May 30 14:51:25 2011
@@ -47,7 +47,7 @@ public class BasicZkTest extends Abstrac
     SolrCore core = h.getCore();
     SolrIndexWriter writer = new SolrIndexWriter("testWriter", core
         .getNewIndexDir(), core.getDirectoryFactory(), false, core.getSchema(),
-        core.getSolrConfig().mainIndexConfig, core.getDeletionPolicy());
+        core.getSolrConfig().mainIndexConfig, core.getDeletionPolicy(), core.getCodecProvider());
     assertEquals("Mergefactor was not picked up", ((LogMergePolicy)writer.getConfig().getMergePolicy()).getMergeFactor(), 8);
     writer.close();
     

Modified: lucene/dev/branches/solr2452/solr/src/test/org/apache/solr/search/function/TestFunctionQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/test/org/apache/solr/search/function/TestFunctionQuery.java?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/test/org/apache/solr/search/function/TestFunctionQuery.java (original)
+++ lucene/dev/branches/solr2452/solr/src/test/org/apache/solr/search/function/TestFunctionQuery.java Mon May 30 14:51:25 2011
@@ -22,6 +22,8 @@ import org.apache.lucene.search.DefaultS
 import org.apache.lucene.search.FieldCache;
 import org.apache.lucene.search.Similarity;
 import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.common.params.SolrParams;
+import org.apache.solr.common.util.NamedList;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.Ignore;
@@ -191,7 +193,7 @@ public class TestFunctionQuery extends S
   }
 
   @Test
-  public void testExternalField() {
+  public void testExternalField() throws Exception {
     String field = "foo_extf";
 
     float[] ids = {100,-4,0,10,25,5,77,23,55,-78,-45,-24,63,78,94,22,34,54321,261,-627};
@@ -210,8 +212,7 @@ public class TestFunctionQuery extends S
     assertTrue(orig == FileFloatSource.onlyForTesting);
 
     makeExternalFile(field, "0=1","UTF-8");
-    assertU(adoc("id", "10000")); // will get same reader if no index change
-    assertU(commit());   
+    assertU(h.query("/reloadCache",lrf.makeRequest("","")));
     singleTest(field, "sqrt(\0)");
     assertTrue(orig != FileFloatSource.onlyForTesting);
 
@@ -247,8 +248,7 @@ public class TestFunctionQuery extends S
       makeExternalFile(field, sb.toString(),"UTF-8");
 
       // make it visible
-      assertU(adoc("id", "10001")); // will get same reader if no index change
-      assertU(commit());
+      assertU(h.query("/reloadCache",lrf.makeRequest("","")));
 
       // test it
       float[] answers = new float[ids.length*2];

Modified: lucene/dev/branches/solr2452/solr/src/webapp/web/admin/analysis.jsp
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr2452/solr/src/webapp/web/admin/analysis.jsp?rev=1129205&r1=1129204&r2=1129205&view=diff
==============================================================================
--- lucene/dev/branches/solr2452/solr/src/webapp/web/admin/analysis.jsp (original)
+++ lucene/dev/branches/solr2452/solr/src/webapp/web/admin/analysis.jsp Mon May 30 14:51:25 2011
@@ -19,6 +19,7 @@
                  org.apache.lucene.util.AttributeSource,
                  org.apache.lucene.util.Attribute,
                  org.apache.lucene.util.BytesRef,
+                 org.apache.lucene.util.CharsRef,
                  org.apache.lucene.analysis.TokenStream,
                  org.apache.lucene.index.Payload,
                  org.apache.lucene.analysis.CharReader,
@@ -32,8 +33,7 @@
                  org.apache.solr.schema.FieldType,
                  org.apache.solr.schema.SchemaField,
                  org.apache.solr.common.util.XML,
-                 javax.servlet.jsp.JspWriter,java.io.IOException,
-                 org.apache.noggit.CharArr
+                 javax.servlet.jsp.JspWriter,java.io.IOException
                 "%>
 <%@ page import="java.io.Reader"%>
 <%@ page import="java.io.StringReader"%>
@@ -287,9 +287,7 @@
 	  bytes = new BytesRef(spare);
       rawText = (token.hasAttribute(CharTermAttribute.class)) ?
         token.getAttribute(CharTermAttribute.class).toString() : null;
-      final CharArr textBuf = new CharArr(bytes.length);
-      ft.indexedToReadable(bytes, textBuf);
-      text = textBuf.toString();
+      text = ft.indexedToReadable(bytes, new CharsRef()).toString();
       token.reflectWith(new AttributeReflector() {
         public void reflect(Class<? extends Attribute> attClass, String key, Object value) {
           // leave out position and raw term