You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by si...@apache.org on 2011/05/31 13:25:50 UTC

svn commit: r1129631 [7/7] - in /lucene/dev/branches/docvalues: ./ 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/spell...

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/StrField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/StrField.java?rev=1129631&r1=1129630&r2=1129631&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/StrField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/StrField.java Tue May 31 11:25:37 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/docvalues/solr/src/java/org/apache/solr/schema/StrFieldSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/StrFieldSource.java?rev=1129631&r1=1129630&r2=1129631&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/StrFieldSource.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/StrFieldSource.java Tue May 31 11:25:37 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/docvalues/solr/src/java/org/apache/solr/schema/TextField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TextField.java?rev=1129631&r1=1129630&r2=1129631&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TextField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TextField.java Tue May 31 11:25:37 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/docvalues/solr/src/java/org/apache/solr/schema/TrieDateField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TrieDateField.java?rev=1129631&r1=1129630&r2=1129631&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TrieDateField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TrieDateField.java Tue May 31 11:25:37 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/docvalues/solr/src/java/org/apache/solr/schema/TrieField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TrieField.java?rev=1129631&r1=1129630&r2=1129631&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TrieField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TrieField.java Tue May 31 11:25:37 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/docvalues/solr/src/java/org/apache/solr/search/MissingStringLastComparatorSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/MissingStringLastComparatorSource.java?rev=1129631&r1=1129630&r2=1129631&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/MissingStringLastComparatorSource.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/MissingStringLastComparatorSource.java Tue May 31 11:25:37 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/docvalues/solr/src/java/org/apache/solr/search/MutableValueStr.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/MutableValueStr.java?rev=1129631&r1=1129630&r2=1129631&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/MutableValueStr.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/MutableValueStr.java Tue May 31 11:25:37 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/docvalues/solr/src/java/org/apache/solr/search/function/FileFloatSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/function/FileFloatSource.java?rev=1129631&r1=1129630&r2=1129631&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/function/FileFloatSource.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/function/FileFloatSource.java Tue May 31 11:25:37 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/docvalues/solr/src/java/org/apache/solr/search/function/IDFValueSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/function/IDFValueSource.java?rev=1129631&r1=1129630&r2=1129631&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/function/IDFValueSource.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/function/IDFValueSource.java Tue May 31 11:25:37 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/docvalues/solr/src/java/org/apache/solr/search/function/StringIndexDocValues.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/function/StringIndexDocValues.java?rev=1129631&r1=1129630&r2=1129631&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/function/StringIndexDocValues.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/function/StringIndexDocValues.java Tue May 31 11:25:37 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/docvalues/solr/src/java/org/apache/solr/search/function/VectorValueSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/function/VectorValueSource.java?rev=1129631&r1=1129630&r2=1129631&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/function/VectorValueSource.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/function/VectorValueSource.java Tue May 31 11:25:37 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/docvalues/solr/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java?rev=1129631&r1=1129630&r2=1129631&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java Tue May 31 11:25:37 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/docvalues/solr/src/java/org/apache/solr/spelling/IndexBasedSpellChecker.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/spelling/IndexBasedSpellChecker.java?rev=1129631&r1=1129630&r2=1129631&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/spelling/IndexBasedSpellChecker.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/spelling/IndexBasedSpellChecker.java Tue May 31 11:25:37 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/docvalues/solr/src/java/org/apache/solr/update/SolrIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/update/SolrIndexWriter.java?rev=1129631&r1=1129630&r2=1129631&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/update/SolrIndexWriter.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/update/SolrIndexWriter.java Tue May 31 11:25:37 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/docvalues/solr/src/java/org/apache/solr/update/UpdateHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/update/UpdateHandler.java?rev=1129631&r1=1129630&r2=1129631&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/update/UpdateHandler.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/update/UpdateHandler.java Tue May 31 11:25:37 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/docvalues/solr/src/site/src/documentation/content/xdocs/tutorial.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/site/src/documentation/content/xdocs/tutorial.xml?rev=1129631&r1=1129630&r2=1129631&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/site/src/documentation/content/xdocs/tutorial.xml (original)
+++ lucene/dev/branches/docvalues/solr/src/site/src/documentation/content/xdocs/tutorial.xml Tue May 31 11:25:37 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/docvalues/solr/src/test-files/solr/conf/schema12.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/schema12.xml?rev=1129631&r1=1129630&r2=1129631&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/schema12.xml (original)
+++ lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/schema12.xml Tue May 31 11:25:37 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/docvalues/solr/src/test-files/solr/conf/solrconfig-functionquery.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-functionquery.xml?rev=1129631&r1=1129630&r2=1129631&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-functionquery.xml (original)
+++ lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-functionquery.xml Tue May 31 11:25:37 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/docvalues/solr/src/test-framework/org/apache/solr/SolrTestCaseJ4.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test-framework/org/apache/solr/SolrTestCaseJ4.java?rev=1129631&r1=1129630&r2=1129631&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test-framework/org/apache/solr/SolrTestCaseJ4.java (original)
+++ lucene/dev/branches/docvalues/solr/src/test-framework/org/apache/solr/SolrTestCaseJ4.java Tue May 31 11:25:37 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/docvalues/solr/src/test-framework/org/apache/solr/util/AbstractSolrTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test-framework/org/apache/solr/util/AbstractSolrTestCase.java?rev=1129631&r1=1129630&r2=1129631&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test-framework/org/apache/solr/util/AbstractSolrTestCase.java (original)
+++ lucene/dev/branches/docvalues/solr/src/test-framework/org/apache/solr/util/AbstractSolrTestCase.java Tue May 31 11:25:37 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/docvalues/solr/src/test/org/apache/solr/BasicFunctionalityTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/BasicFunctionalityTest.java?rev=1129631&r1=1129630&r2=1129631&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/BasicFunctionalityTest.java (original)
+++ lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/BasicFunctionalityTest.java Tue May 31 11:25:37 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/docvalues/solr/src/test/org/apache/solr/ConvertedLegacyTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/ConvertedLegacyTest.java?rev=1129631&r1=1129630&r2=1129631&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/ConvertedLegacyTest.java (original)
+++ lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/ConvertedLegacyTest.java Tue May 31 11:25:37 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/docvalues/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java?rev=1129631&r1=1129630&r2=1129631&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java (original)
+++ lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java Tue May 31 11:25:37 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/docvalues/solr/src/test/org/apache/solr/cloud/BasicZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/cloud/BasicZkTest.java?rev=1129631&r1=1129630&r2=1129631&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/cloud/BasicZkTest.java (original)
+++ lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/cloud/BasicZkTest.java Tue May 31 11:25:37 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/docvalues/solr/src/test/org/apache/solr/search/function/TestFunctionQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/search/function/TestFunctionQuery.java?rev=1129631&r1=1129630&r2=1129631&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/search/function/TestFunctionQuery.java (original)
+++ lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/search/function/TestFunctionQuery.java Tue May 31 11:25:37 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/docvalues/solr/src/webapp/web/admin/analysis.jsp
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/webapp/web/admin/analysis.jsp?rev=1129631&r1=1129630&r2=1129631&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/webapp/web/admin/analysis.jsp (original)
+++ lucene/dev/branches/docvalues/solr/src/webapp/web/admin/analysis.jsp Tue May 31 11:25:37 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

Modified: lucene/dev/branches/docvalues/solr/src/webapp/web/index.jsp
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/webapp/web/index.jsp?rev=1129631&r1=1129630&r2=1129631&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/webapp/web/index.jsp (original)
+++ lucene/dev/branches/docvalues/solr/src/webapp/web/index.jsp Tue May 31 11:25:37 2011
@@ -1,49 +1,119 @@
-<%@ page import="org.apache.solr.core.SolrCore" %>
+<%@ page contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
+<% request.setCharacterEncoding("UTF-8"); %>
+
+<%@ page import="java.util.List" %>
 <%@ page import="java.util.Collection" %>
-<%--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements.  See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License.  You may obtain a copy of the License at
-
-     http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
---%>
+
+<% org.apache.solr.core.CoreContainer cores = (org.apache.solr.core.CoreContainer)request.getAttribute("org.apache.solr.CoreContainer"); %>
 
 <html>
 <head>
-<link rel="stylesheet" type="text/css" href="solr-admin.css">
-<link rel="icon" href="favicon.ico" type="image/ico"></link>
-<link rel="shortcut icon" href="favicon.ico" type="image/ico"></link>
-<title>Welcome to Solr</title>
+    
+    <title>solr-admin</title>
+    
+    <link rel="stylesheet" type="text/css" href="css/screen.css">
+    <link rel="icon" type="image/ico" href="img/favicon.ico">
+    
+    <script type="text/javascript">
+    
+    var app_config = {};
+    
+    app_config.solr_path = '<%= request.getContextPath() %>';
+    app_config.core_admin_path = '<%= cores.getAdminPath() %>';
+    app_config.zookeeper_path = 'zookeeper.jsp';
+    
+    </script>
+    
 </head>
-
 <body>
-<h1>Welcome to Solr!</h1>
-<a href="."><img border="0" align="right" height="78" width="142" src="admin/solr_small.png" alt="Solr"/></a>
-
-<% 
-  org.apache.solr.core.CoreContainer cores = (org.apache.solr.core.CoreContainer)request.getAttribute("org.apache.solr.CoreContainer");
-  Collection<SolrCore> solrCores = cores.getCores();
-  if( cores != null
-   && solrCores.size() > 0 // HACK! check that we have valid names...
-   && solrCores.iterator().next().getName().length() != 0 ) {
-    for( org.apache.solr.core.SolrCore core : cores.getCores() ) {
-       String coreName = core.getName();
-      if("".equals(coreName) ) coreName =".";
-%>
-<a href="<%= coreName %>/admin/">Admin <%= core.getName() %></a>
-<br/>
-<% }} else { %>
-<a href="admin/">Solr Admin</a>
-<% } %>
-
+    
+    <div id="wrapper">
+    
+        <div id="header">
+            
+            <a href="./" id="solr"><span>Apache SOLR</span></a>
+
+            <div id="wip-notice">
+                <p>This interface is work in progress. It works best in Chrome.</p>
+                <p><a href="admin/">Use the <span>old admin interface</span> if there are problems with this one.</a></p>
+                <p><a href="https://issues.apache.org/jira/browse/SOLR-2399">Bugs/Requests/Suggestions: <span>SOLR-2399</span></a></p>
+            </div>
+
+	    <p id="environment">&nbsp;</p>
+
+        </div>
+        
+        <div id="main" class="clearfix">
+        
+            <div id="content-wrapper">
+            <div id="content">
+                
+                &nbsp;
+                
+            </div>
+            </div>
+            
+            <div id="menu-wrapper">
+            <div id="menu">
+                
+                <ul>
+
+                    <li id="index" class="global">
+                        <p><a href="#/">Dashboard</a></p>
+                    </li>
+
+                    <li id="logging" class="global">
+                        <p><a href="#/logging">Logging</a></p>
+                    </li>
+
+                    <li id="cloud" class="global optional">
+                        <p><a href="#/cloud">Cloud</a></p>
+                    </li>
+
+                    <li id="cores" class="global optional">
+                        <p><a href="#/cores">Core Admin</a></p>
+                    </li>
+
+                    <li id="java-properties" class="global">
+                        <p><a href="#/java-properties">Java Properties</a>
+                    </li>
+
+                    <li id="threads" class="global">
+                        <p><a href="#/threads">Thread Dump</a></p>
+                    </li>
+                    
+                </ul>
+                
+            </div>
+            </div>
+            
+            <div id="meta">
+                
+                <ul>
+                    
+                    <li class="documentation"><a href="http://lucene.apache.org/solr/"><span>Documentation</span></a></li>
+                    <li class="issues"><a href="http://issues.apache.org/jira/browse/SOLR"><span>Issue Tracker</span></a></li>
+                    <li class="irc"><a href="http://webchat.freenode.net/?channels=#solr"><span>IRC Channel</span></a></li>
+                    <li class="mailinglist"><a href="http://wiki.apache.org/solr/UsingMailingLists"><span>Community forum</span></a></li>
+                    <li class="wiki-query-syntax"><a href="http://wiki.apache.org/solr/SolrQuerySyntax"><span>Solr Query Syntax</span></a></li>
+                    
+                </ul>
+                
+            </div>
+            
+        </div>
+    
+    </div>
+    
+    <script type="text/javascript" src="js/0_console.js"></script>
+    <script type="text/javascript" src="js/1_jquery.js"></script>
+    <script type="text/javascript" src="js/jquery.timeago.js"></script>
+    <script type="text/javascript" src="js/jquery.form.js"></script>
+    <script type="text/javascript" src="js/jquery.sammy.js"></script>
+    <script type="text/javascript" src="js/jquery.sparkline.js"></script>
+    <script type="text/javascript" src="js/jquery.jstree.js"></script>
+    <script type="text/javascript" src="js/highlight.js"></script>
+    <script type="text/javascript" src="js/script.js"></script>
+    
 </body>
-</html>
+</html>
\ No newline at end of file