You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2011/02/09 02:04:13 UTC

svn commit: r1068718 [17/21] - in /lucene/dev/branches/bulkpostings: ./ dev-tools/eclipse/ dev-tools/idea/.idea/ dev-tools/idea/lucene/ dev-tools/maven/ dev-tools/maven/lucene/ dev-tools/maven/lucene/contrib/ant/ dev-tools/maven/lucene/contrib/db/bdb-j...

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/function/distance/HaversineConstFunction.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/function/distance/HaversineConstFunction.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/function/distance/HaversineConstFunction.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/function/distance/HaversineConstFunction.java Wed Feb  9 01:03:49 2011
@@ -39,6 +39,7 @@ import java.util.Map;
 public class HaversineConstFunction extends ValueSource {
 
   public static ValueSourceParser parser = new ValueSourceParser() {
+    @Override
     public ValueSource parse(FunctionQParser fp) throws ParseException
     {
       // TODO: dispatch through SpatialQueriable in the future?
@@ -198,18 +199,22 @@ public class HaversineConstFunction exte
     final double latCenterRad_cos = this.latCenterRad_cos;
 
     return new DocValues() {
+      @Override
       public float floatVal(int doc) {
         return (float) doubleVal(doc);
       }
 
+      @Override
       public int intVal(int doc) {
         return (int) doubleVal(doc);
       }
 
+      @Override
       public long longVal(int doc) {
         return (long) doubleVal(doc);
       }
 
+      @Override
       public double doubleVal(int doc) {
         double latRad = latVals.doubleVal(doc) * DistanceUtils.DEGREES_TO_RADIANS;
         double lonRad = lonVals.doubleVal(doc) * DistanceUtils.DEGREES_TO_RADIANS;
@@ -222,6 +227,7 @@ public class HaversineConstFunction exte
         return (EARTH_MEAN_DIAMETER * Math.atan2(Math.sqrt(h), Math.sqrt(1 - h)));
       }
 
+      @Override
       public String strVal(int doc) {
         return Double.toString(doubleVal(doc));
       }
@@ -260,6 +266,7 @@ public class HaversineConstFunction exte
     return result;
   }
 
+  @Override
   public String description() {
     return name() + '(' + p2 + ',' + latCenter + ',' + lonCenter + ')';
   }

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/function/distance/HaversineFunction.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/function/distance/HaversineFunction.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/function/distance/HaversineFunction.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/function/distance/HaversineFunction.java Wed Feb  9 01:03:49 2011
@@ -100,22 +100,27 @@ public class HaversineFunction extends V
 
     final DocValues vals2 = p2.getValues(context, readerContext);
     return new DocValues() {
+      @Override
       public float floatVal(int doc) {
         return (float) doubleVal(doc);
       }
 
+      @Override
       public int intVal(int doc) {
         return (int) doubleVal(doc);
       }
 
+      @Override
       public long longVal(int doc) {
         return (long) doubleVal(doc);
       }
 
+      @Override
       public double doubleVal(int doc) {
         return distance(doc, vals1, vals2);
       }
 
+      @Override
       public String strVal(int doc) {
         return Double.toString(doubleVal(doc));
       }
@@ -159,6 +164,7 @@ public class HaversineFunction extends V
     return result;
   }
 
+  @Override
   public String description() {
     StringBuilder sb = new StringBuilder();
     sb.append(name()).append('(');

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/function/distance/SquaredEuclideanFunction.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/function/distance/SquaredEuclideanFunction.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/function/distance/SquaredEuclideanFunction.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/function/distance/SquaredEuclideanFunction.java Wed Feb  9 01:03:49 2011
@@ -33,6 +33,7 @@ public class SquaredEuclideanFunction ex
   }
 
 
+  @Override
   protected String name() {
 
     return name;
@@ -41,6 +42,7 @@ public class SquaredEuclideanFunction ex
   /**
    * @param doc The doc to score
    */
+  @Override
   protected double distance(int doc, DocValues dv1, DocValues dv2) {
 
     double[] vals1 = new double[source1.dimension()];

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/function/distance/StringDistanceFunction.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/function/distance/StringDistanceFunction.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/function/distance/StringDistanceFunction.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/function/distance/StringDistanceFunction.java Wed Feb  9 01:03:49 2011
@@ -1,5 +1,22 @@
 package org.apache.solr.search.function.distance;
 
+/**
+ * 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.
+ */
+
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
 import org.apache.lucene.search.spell.StringDistance;
 import org.apache.solr.search.function.DocValues;
@@ -36,18 +53,22 @@ public class StringDistanceFunction exte
     final DocValues str2DV = str2.getValues(context, readerContext);
     return new DocValues() {
 
+      @Override
       public float floatVal(int doc) {
         return dist.getDistance(str1DV.strVal(doc), str2DV.strVal(doc));
       }
 
+      @Override
       public int intVal(int doc) {
         return (int) doubleVal(doc);
       }
 
+      @Override
       public long longVal(int doc) {
         return (long) doubleVal(doc);
       }
 
+      @Override
       public double doubleVal(int doc) {
         return (double) floatVal(doc);
       }
@@ -64,6 +85,7 @@ public class StringDistanceFunction exte
     };
   }
 
+  @Override
   public String description() {
     StringBuilder sb = new StringBuilder();
     sb.append("strdist").append('(');

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/function/distance/VectorDistanceFunction.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/function/distance/VectorDistanceFunction.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/function/distance/VectorDistanceFunction.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/function/distance/VectorDistanceFunction.java Wed Feb  9 01:03:49 2011
@@ -96,22 +96,27 @@ public class VectorDistanceFunction exte
         return (short) doubleVal(doc);
       }
 
+      @Override
       public float floatVal(int doc) {
         return (float) doubleVal(doc);
       }
 
+      @Override
       public int intVal(int doc) {
         return (int) doubleVal(doc);
       }
 
+      @Override
       public long longVal(int doc) {
         return (long) doubleVal(doc);
       }
 
+      @Override
       public double doubleVal(int doc) {
         return distance(doc, vals1, vals2);
       }
 
+      @Override
       public String strVal(int doc) {
         return Double.toString(doubleVal(doc));
       }

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/AbstractLuceneSpellChecker.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/AbstractLuceneSpellChecker.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/AbstractLuceneSpellChecker.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/AbstractLuceneSpellChecker.java Wed Feb  9 01:03:49 2011
@@ -91,6 +91,7 @@ public abstract class AbstractLuceneSpel
 
   protected StringDistance sd;
 
+  @Override
   public String init(NamedList config, SolrCore core) {
     super.init(config, core);
     indexDir = (String) config.get(INDEX_DIR);
@@ -213,6 +214,7 @@ public abstract class AbstractLuceneSpel
     return reader;
   }
 
+  @Override
   public void reload(SolrCore core, SolrIndexSearcher searcher) throws IOException {
     spellChecker.setSpellIndex(index);
 

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java Wed Feb  9 01:03:49 2011
@@ -50,12 +50,14 @@ public class FileBasedSpellChecker exten
   private String characterEncoding;
   public static final String WORD_FIELD_NAME = "word";
 
+  @Override
   public String init(NamedList config, SolrCore core) {
     super.init(config, core);
     characterEncoding = (String) config.get(SOURCE_FILE_CHAR_ENCODING);
     return name;
   }
 
+  @Override
   public void build(SolrCore core, SolrIndexSearcher searcher) {
     try {
       loadExternalFileDictionary(core);

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/IndexBasedSpellChecker.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/IndexBasedSpellChecker.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/IndexBasedSpellChecker.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/IndexBasedSpellChecker.java Wed Feb  9 01:03:49 2011
@@ -49,6 +49,7 @@ public class IndexBasedSpellChecker exte
   protected float threshold;
   protected IndexReader reader;
 
+  @Override
   public String init(NamedList config, SolrCore core) {
     super.init(config, core);
     threshold = config.get(THRESHOLD_TOKEN_FREQUENCY) == null ? 0.0f
@@ -68,6 +69,7 @@ public class IndexBasedSpellChecker exte
     }
   }
 
+  @Override
   public void build(SolrCore core, SolrIndexSearcher searcher) {
     IndexReader reader = null;
     try {

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/SpellingQueryConverter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/SpellingQueryConverter.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/SpellingQueryConverter.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/SpellingQueryConverter.java Wed Feb  9 01:03:49 2011
@@ -91,6 +91,7 @@ public class SpellingQueryConverter exte
    * @param original the original query string
    * @return a Collection of Lucene Tokens
    */
+  @Override
   public Collection<Token> convert(String original) {
     if (original == null) { // this can happen with q.alt = and no query
       return Collections.emptyList();

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/suggest/Lookup.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/suggest/Lookup.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/suggest/Lookup.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/suggest/Lookup.java Wed Feb  9 01:03:49 2011
@@ -25,6 +25,7 @@ public abstract class Lookup {
       this.value = value;
     }
     
+    @Override
     public String toString() {
       return key + "/" + value;
     }

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/CommitUpdateCommand.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/CommitUpdateCommand.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/CommitUpdateCommand.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/CommitUpdateCommand.java Wed Feb  9 01:03:49 2011
@@ -39,6 +39,7 @@ public class CommitUpdateCommand extends
     super("commit", req);
     this.optimize=optimize;
   }
+  @Override
   public String toString() {
     return "commit(optimize="+optimize
             +",waitFlush="+waitFlush

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/DeleteUpdateCommand.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/DeleteUpdateCommand.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/DeleteUpdateCommand.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/DeleteUpdateCommand.java Wed Feb  9 01:03:49 2011
@@ -30,6 +30,7 @@ public class DeleteUpdateCommand extends
     super("delete", req);
   }
 
+  @Override
   public String toString() {
     StringBuilder sb = new StringBuilder(commandName);
     sb.append(':');

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/DirectUpdateHandler2.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/DirectUpdateHandler2.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/DirectUpdateHandler2.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/DirectUpdateHandler2.java Wed Feb  9 01:03:49 2011
@@ -134,6 +134,7 @@ public class DirectUpdateHandler2 extend
     }
   }
 
+  @Override
   public int addDoc(AddUpdateCommand cmd) throws IOException {
     addCommands.incrementAndGet();
     addCommandsCumulative.incrementAndGet();
@@ -202,6 +203,7 @@ public class DirectUpdateHandler2 extend
 
 
   // could return the number of docs deleted, but is that always possible to know???
+  @Override
   public void delete(DeleteUpdateCommand cmd) throws IOException {
     deleteByIdCommands.incrementAndGet();
     deleteByIdCommandsCumulative.incrementAndGet();
@@ -221,6 +223,7 @@ public class DirectUpdateHandler2 extend
 
   // why not return number of docs deleted?
   // Depending on implementation, we may not be able to immediately determine the num...
+  @Override
   public void deleteByQuery(DeleteUpdateCommand cmd) throws IOException {
     deleteByQueryCommands.incrementAndGet();
     deleteByQueryCommandsCumulative.incrementAndGet();
@@ -263,6 +266,7 @@ public class DirectUpdateHandler2 extend
     }
   }
 
+  @Override
   public int mergeIndexes(MergeIndexesCommand cmd) throws IOException {
     mergeIndexesCommands.incrementAndGet();
     int rc = -1;
@@ -300,6 +304,7 @@ public class DirectUpdateHandler2 extend
     }
   }
 
+  @Override
   public void commit(CommitUpdateCommand cmd) throws IOException {
 
     if (cmd.optimize) {
@@ -369,6 +374,7 @@ public class DirectUpdateHandler2 extend
   /**
    * @since Solr 1.4
    */
+  @Override
   public void rollback(RollbackUpdateCommand cmd) throws IOException {
 
     rollbackCommands.incrementAndGet();
@@ -402,6 +408,7 @@ public class DirectUpdateHandler2 extend
   }
 
 
+  @Override
   public void close() throws IOException {
     log.info("closing " + this);
     iwCommit.lock();
@@ -547,6 +554,7 @@ public class DirectUpdateHandler2 extend
     // to facilitate testing: blocks if called during commit
     public synchronized int getCommitCount() { return autoCommitCount; }
 
+    @Override
     public String toString() {
       if(timeUpperBound > 0 || docsUpperBound > 0) {
         return
@@ -619,6 +627,7 @@ public class DirectUpdateHandler2 extend
     return lst;
   }
 
+  @Override
   public String toString() {
     return "DirectUpdateHandler2" + getStatistics();
   }

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/SolrIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/SolrIndexWriter.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/SolrIndexWriter.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/SolrIndexWriter.java Wed Feb  9 01:03:49 2011
@@ -132,6 +132,7 @@ public class SolrIndexWriter extends Ind
    * ****
    */
   private volatile boolean isClosed = false;
+  @Override
   public void close() throws IOException {
     log.debug("Closing Writer " + name);
     try {
@@ -178,6 +179,7 @@ public class SolrIndexWriter extends Ind
     // We might ideally want to override print(String) as well, but
     // looking through the code that writes to infoStream, it appears
     // that all the classes except CheckIndex just use println.
+    @Override
     public void println(String x) {
       print(dateFormat.format(new Date()) + " ");
       super.println(x);

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/UpdateCommand.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/UpdateCommand.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/UpdateCommand.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/UpdateCommand.java Wed Feb  9 01:03:49 2011
@@ -33,6 +33,7 @@ import org.apache.solr.request.SolrQuery
       this.commandName = commandName;
     }
 
+    @Override
     public String toString() {
       return commandName;
     }

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/processor/Lookup3Signature.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/processor/Lookup3Signature.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/processor/Lookup3Signature.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/processor/Lookup3Signature.java Wed Feb  9 01:03:49 2011
@@ -25,10 +25,12 @@ public class Lookup3Signature extends Si
   public Lookup3Signature() {
   }
 
+  @Override
   public void add(String content) {
     hash = Hash.lookup3ycs64(content,0,content.length(),hash);
   }
 
+  @Override
   public byte[] getSignature() {
     return new byte[]{(byte)(hash>>56),(byte)(hash>>48),(byte)(hash>>40),(byte)(hash>>32),(byte)(hash>>24),(byte)(hash>>16),(byte)(hash>>8),(byte)(hash>>0)};
   }

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/processor/MD5Signature.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/processor/MD5Signature.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/processor/MD5Signature.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/processor/MD5Signature.java Wed Feb  9 01:03:49 2011
@@ -26,6 +26,7 @@ import org.slf4j.LoggerFactory;
 public class MD5Signature extends Signature {
   protected final static Logger log = LoggerFactory.getLogger(MD5Signature.class);
   private static ThreadLocal<MessageDigest> DIGESTER_FACTORY = new ThreadLocal<MessageDigest>() {
+    @Override
     protected MessageDigest initialValue() {
       try {
         return MessageDigest.getInstance("MD5");
@@ -41,6 +42,7 @@ public class MD5Signature extends Signat
     digester.reset();
   }
 
+  @Override
   public void add(String content) {
     try {
       digester.update(content.getBytes("UTF-8"));
@@ -51,6 +53,7 @@ public class MD5Signature extends Signat
     }
   }
 
+  @Override
   public byte[] getSignature() {
     return digester.digest();
   }

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/processor/TextProfileSignature.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/processor/TextProfileSignature.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/processor/TextProfileSignature.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/processor/TextProfileSignature.java Wed Feb  9 01:03:49 2011
@@ -51,12 +51,14 @@ public class TextProfileSignature extend
   private float quantRate;
   private float minTokenLen;
 
+  @Override
   public void init(SolrParams params) {
     quantRate = params.getFloat("quantRate", 0.01f);
     minTokenLen = params.getInt("minTokenLen", 2);
   }
 
   
+  @Override
   public byte[] getSignature() {
     return super.getSignature();
   }
@@ -144,6 +146,7 @@ public class TextProfileSignature extend
       this.val = val;
     }
 
+    @Override
     public String toString() {
       return val + " " + cnt;
     }

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/util/BoundedTreeSet.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/util/BoundedTreeSet.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/util/BoundedTreeSet.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/util/BoundedTreeSet.java Wed Feb  9 01:03:49 2011
@@ -55,11 +55,13 @@ public class BoundedTreeSet<E> extends T
       remove(last());
     }
   }
+  @Override
   public boolean add(E item) {
     boolean out = super.add(item);
     adjust();
     return out;
   }
+  @Override
   public boolean addAll(Collection<? extends E> c) {
     boolean out = super.addAll(c);
     adjust();

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/util/SentinelIntSet.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/util/SentinelIntSet.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/util/SentinelIntSet.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/util/SentinelIntSet.java Wed Feb  9 01:03:49 2011
@@ -1,134 +1,134 @@
-/**
- * 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.
- */
-
-package org.apache.solr.util;
-
-import java.util.Arrays;
-
-/** A native int set where one value is reserved to mean "EMPTY" */
-public class SentinelIntSet {
-  public int[] keys;
-  public int count;
-  public final int emptyVal;
-  public int rehashCount;   // the count at which a rehash should be done
-
-  public SentinelIntSet(int size, int emptyVal) {
-    this.emptyVal = emptyVal;
-    int tsize = Math.max(org.apache.lucene.util.BitUtil.nextHighestPowerOfTwo(size), 1);
-    rehashCount = tsize - (tsize>>2);
-    if (size >= rehashCount) {  // should be able to hold "size" w/o rehashing
-      tsize <<= 1;
-      rehashCount = tsize - (tsize>>2);
-    }
-    keys = new int[tsize];
-    if (emptyVal != 0)
-      clear();
-  }
-
-  public void clear() {
-    Arrays.fill(keys, emptyVal);
-    count = 0;
-  }
-
-  public int hash(int key) {
-    return key;
-  }
-
-  public int size() { return count; }
-
-  /** returns the slot for this key */
-  public int getSlot(int key) {
-    assert key != emptyVal;
-    int h = hash(key);
-    int s = h & (keys.length-1);
-    if (keys[s] == key || keys[s]== emptyVal) return s;
-
-    int increment = (h>>7)|1;
-    do {
-      s = (s + increment) & (keys.length-1);
-    } while (keys[s] != key && keys[s] != emptyVal);
-    return s;
-  }
-
-  /** returns the slot for this key, or -slot-1 if not found */
-  public int find(int key) {
-    assert key != emptyVal;
-    int h = hash(key);
-    int s = h & (keys.length-1);
-    if (keys[s] == key) return s;
-    if (keys[s] == emptyVal) return -s-1;
-
-    int increment = (h>>7)|1;
-    for(;;) {
-      s = (s + increment) & (keys.length-1);
-      if (keys[s] == key) return s;
-      if (keys[s] == emptyVal) return -s-1;
-    }
-  }
-
-
-  public boolean exists(int key) {
-    return find(key) >= 0;
-  }
-
-
-  public int put(int key) {
-    int s = find(key);
-    if (s < 0) {
-      if (count >= rehashCount) {
-        rehash();
-        s = getSlot(key);
-      } else {
-        s = -s-1;
-      }
-      count++;
-      keys[s] = key;
-      putKey(key, s);
-    } else {
-      overwriteKey(key, s);
-    }
-    return s;
-  }
-
-
-  protected void putKey(int key, int slot) {}
-  protected void overwriteKey(int key, int slot) {}
-
-  protected void startRehash(int newSize) {}
-  protected void moveKey(int key, int oldSlot, int newSlot) {}
-  protected void endRehash() {}
-
-  public void rehash() {
-    int newSize = keys.length << 1;
-    startRehash(newSize);
-    int[] oldKeys = keys;
-    keys = new int[newSize];
-    if (emptyVal != 0) Arrays.fill(keys, emptyVal);
-
-    for (int i=0; i<oldKeys.length; i++) {
-      int key = oldKeys[i];
-      if (key == emptyVal) continue;
-      int newSlot = getSlot(key);
-      keys[newSlot] = key;
-      moveKey(key, i, newSlot);
-    }
-    endRehash();
-    rehashCount = newSize - (newSize>>2);
-
-  }
-
-}
+/**
+ * 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.
+ */
+
+package org.apache.solr.util;
+
+import java.util.Arrays;
+
+/** A native int set where one value is reserved to mean "EMPTY" */
+public class SentinelIntSet {
+  public int[] keys;
+  public int count;
+  public final int emptyVal;
+  public int rehashCount;   // the count at which a rehash should be done
+
+  public SentinelIntSet(int size, int emptyVal) {
+    this.emptyVal = emptyVal;
+    int tsize = Math.max(org.apache.lucene.util.BitUtil.nextHighestPowerOfTwo(size), 1);
+    rehashCount = tsize - (tsize>>2);
+    if (size >= rehashCount) {  // should be able to hold "size" w/o rehashing
+      tsize <<= 1;
+      rehashCount = tsize - (tsize>>2);
+    }
+    keys = new int[tsize];
+    if (emptyVal != 0)
+      clear();
+  }
+
+  public void clear() {
+    Arrays.fill(keys, emptyVal);
+    count = 0;
+  }
+
+  public int hash(int key) {
+    return key;
+  }
+
+  public int size() { return count; }
+
+  /** returns the slot for this key */
+  public int getSlot(int key) {
+    assert key != emptyVal;
+    int h = hash(key);
+    int s = h & (keys.length-1);
+    if (keys[s] == key || keys[s]== emptyVal) return s;
+
+    int increment = (h>>7)|1;
+    do {
+      s = (s + increment) & (keys.length-1);
+    } while (keys[s] != key && keys[s] != emptyVal);
+    return s;
+  }
+
+  /** returns the slot for this key, or -slot-1 if not found */
+  public int find(int key) {
+    assert key != emptyVal;
+    int h = hash(key);
+    int s = h & (keys.length-1);
+    if (keys[s] == key) return s;
+    if (keys[s] == emptyVal) return -s-1;
+
+    int increment = (h>>7)|1;
+    for(;;) {
+      s = (s + increment) & (keys.length-1);
+      if (keys[s] == key) return s;
+      if (keys[s] == emptyVal) return -s-1;
+    }
+  }
+
+
+  public boolean exists(int key) {
+    return find(key) >= 0;
+  }
+
+
+  public int put(int key) {
+    int s = find(key);
+    if (s < 0) {
+      if (count >= rehashCount) {
+        rehash();
+        s = getSlot(key);
+      } else {
+        s = -s-1;
+      }
+      count++;
+      keys[s] = key;
+      putKey(key, s);
+    } else {
+      overwriteKey(key, s);
+    }
+    return s;
+  }
+
+
+  protected void putKey(int key, int slot) {}
+  protected void overwriteKey(int key, int slot) {}
+
+  protected void startRehash(int newSize) {}
+  protected void moveKey(int key, int oldSlot, int newSlot) {}
+  protected void endRehash() {}
+
+  public void rehash() {
+    int newSize = keys.length << 1;
+    startRehash(newSize);
+    int[] oldKeys = keys;
+    keys = new int[newSize];
+    if (emptyVal != 0) Arrays.fill(keys, emptyVal);
+
+    for (int i=0; i<oldKeys.length; i++) {
+      int key = oldKeys[i];
+      if (key == emptyVal) continue;
+      int newSlot = getSlot(key);
+      keys[newSlot] = key;
+      moveKey(key, i, newSlot);
+    }
+    endRehash();
+    rehashCount = newSize - (newSize>>2);
+
+  }
+
+}

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/util/SimplePostTool.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/util/SimplePostTool.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/util/SimplePostTool.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/util/SimplePostTool.java Wed Feb  9 01:03:49 2011
@@ -22,14 +22,9 @@ import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.InputStreamReader;
+import java.io.ByteArrayInputStream;
 import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.StringWriter;
 import java.io.UnsupportedEncodingException;
-import java.io.Writer;
 import java.util.Set;
 import java.util.HashSet;
 import java.net.HttpURLConnection;
@@ -44,12 +39,14 @@ import java.net.URL;
  */
 public class SimplePostTool {
   public static final String DEFAULT_POST_URL = "http://localhost:8983/solr/update";
-  public static final String POST_ENCODING = "UTF-8";
-  public static final String VERSION_OF_THIS_TOOL = "1.2";
+  public static final String VERSION_OF_THIS_TOOL = "1.3";
   private static final String SOLR_OK_RESPONSE_EXCERPT = "<int name=\"status\">0</int>";
 
   private static final String DEFAULT_COMMIT = "yes";
-  
+  private static final String DEFAULT_OUT = "no";
+
+  private static final String DEFAULT_DATA_TYPE = "application/xml";
+
   private static final String DATA_MODE_FILES = "files";
   private static final String DATA_MODE_ARGS = "args";
   private static final String DATA_MODE_STDIN = "stdin";
@@ -61,37 +58,35 @@ public class SimplePostTool {
     DATA_MODES.add(DATA_MODE_ARGS);
     DATA_MODES.add(DATA_MODE_STDIN);
   }
-  
+
   protected URL solrUrl;
 
-  private class PostException extends RuntimeException {
-    PostException(String reason,Throwable cause) {
-      super(reason + " (POST URL=" + solrUrl + ")",cause);
-    }
-  }
-  
   public static void main(String[] args) {
     info("version " + VERSION_OF_THIS_TOOL);
 
     if (0 < args.length && "-help".equals(args[0])) {
       System.out.println
-        ("This is a simple command line tool for POSTing raw XML to a Solr\n"+
-         "port.  XML data can be read from files specified as commandline\n"+
-         "args; as raw commandline arg strings; or via STDIN.\n"+
+        ("This is a simple command line tool for POSTing raw data to a Solr\n"+
+         "port.  Data can be read from files specified as commandline args,\n"+
+         "as raw commandline arg strings, or via STDIN.\n"+
          "Examples:\n"+
          "  java -Ddata=files -jar post.jar *.xml\n"+
          "  java -Ddata=args  -jar post.jar '<delete><id>42</id></delete>'\n"+
          "  java -Ddata=stdin -jar post.jar < hd.xml\n"+
          "Other options controlled by System Properties include the Solr\n"+
-         "URL to POST to, and whether a commit should be executed.  These\n"+
-         "are the defaults for all System Properties...\n"+
+         "URL to POST to, the Content-Type of the data, whether a commit\n"+
+         "should be executed, and whether the response should be written\n"+
+         "to STDOUT. These are the defaults for all System Properties...\n"+
          "  -Ddata=" + DEFAULT_DATA_MODE + "\n"+
+         "  -Dtype=" + DEFAULT_DATA_TYPE + "\n"+
          "  -Durl=" + DEFAULT_POST_URL + "\n"+
-         "  -Dcommit=" + DEFAULT_COMMIT + "\n");
+         "  -Dcommit=" + DEFAULT_COMMIT + "\n"+
+         "  -Dout=" + DEFAULT_OUT + "\n");
       return;
     }
 
-    
+    OutputStream out = null;
+
     URL u = null;
     try {
       u = new URL(System.getProperty("url", DEFAULT_POST_URL));
@@ -105,53 +100,49 @@ public class SimplePostTool {
       fatal("System Property 'data' is not valid for this tool: " + mode);
     }
 
+    final String doOut = System.getProperty("out", DEFAULT_OUT);
+    if ("yes".equals(System.getProperty("out", DEFAULT_OUT))) {
+      out = System.out;
+    }
+
     try {
       if (DATA_MODE_FILES.equals(mode)) {
         if (0 < args.length) {
           info("POSTing files to " + u + "..");
-          final int posted = t.postFiles(args,0);
+          final int posted = t.postFiles(args, 0, out);
         }
         
       } else if (DATA_MODE_ARGS.equals(mode)) {
         if (0 < args.length) {
           info("POSTing args to " + u + "..");
           for (String a : args) {
-            final StringWriter sw = new StringWriter();
-            t.postData(new StringReader(a), sw);
-            warnIfNotExpectedResponse(sw.toString(),SOLR_OK_RESPONSE_EXCERPT);
+            t.postData(t.stringToStream(a), null, out);
           }
         }
         
       } else if (DATA_MODE_STDIN.equals(mode)) {
         info("POSTing stdin to " + u + "..");
-        final StringWriter sw = new StringWriter();
-        t.postData(new InputStreamReader(System.in,POST_ENCODING), sw);
-        warnIfNotExpectedResponse(sw.toString(),SOLR_OK_RESPONSE_EXCERPT);
+        t.postData(System.in, null, out);
       }
       if ("yes".equals(System.getProperty("commit",DEFAULT_COMMIT))) {
         info("COMMITting Solr index changes..");
-        final StringWriter sw = new StringWriter();
-        t.commit(sw);
-        warnIfNotExpectedResponse(sw.toString(),SOLR_OK_RESPONSE_EXCERPT);
+        t.commit(out);
       }
     
-    } catch(IOException ioe) {
-      fatal("Unexpected IOException " + ioe);
+    } catch(RuntimeException e) {
+      fatal("RuntimeException " + e);
     }
   }
  
   /** Post all filenames provided in args, return the number of files posted*/
-  int postFiles(String [] args,int startIndexInArgs) throws IOException {
+  int postFiles(String [] args,int startIndexInArgs, OutputStream out) {
     int filesPosted = 0;
     for (int j = startIndexInArgs; j < args.length; j++) {
       File srcFile = new File(args[j]);
-      final StringWriter sw = new StringWriter();
-      
       if (srcFile.canRead()) {
         info("POSTing file " + srcFile.getName());
-        postFile(srcFile, sw);
+        postFile(srcFile, out);
         filesPosted++;
-        warnIfNotExpectedResponse(sw.toString(),SOLR_OK_RESPONSE_EXCERPT);
       } else {
         warn("Cannot read input file: " + srcFile);
       }
@@ -159,15 +150,6 @@ public class SimplePostTool {
     return filesPosted;
   }
   
-  /** Check what Solr replied to a POST, and complain if it's not what we expected.
-   *  TODO: parse the response and check it XMLwise, here we just check it as an unparsed String  
-   */
-  static void warnIfNotExpectedResponse(String actual,String expected) {
-    if(actual.indexOf(expected) < 0) {
-      warn("Unexpected response from Solr: '" + actual + "' does not contain '" + expected + "'");
-    }
-  }
-  
   static void warn(String msg) {
     System.err.println("SimplePostTool: WARNING: " + msg);
   }
@@ -187,15 +169,13 @@ public class SimplePostTool {
    */
   public SimplePostTool(URL solrUrl) {
     this.solrUrl = solrUrl;
-    warn("Make sure your XML documents are encoded in " + POST_ENCODING
-        + ", other encodings are not currently supported");
   }
 
   /**
    * Does a simple commit operation 
    */
-  public void commit(Writer output) throws IOException {
-    postData(new StringReader("<commit/>"), output);
+  public void commit(OutputStream output) {
+    postData(stringToStream("<commit/>"), null, output);
   }
 
   /**
@@ -203,85 +183,103 @@ public class SimplePostTool {
    * writes to response to output.
    * @throws UnsupportedEncodingException 
    */
-  public void postFile(File file, Writer output) 
-    throws FileNotFoundException, UnsupportedEncodingException {
+  public void postFile(File file, OutputStream output) {
 
-    // FIXME; use a real XML parser to read files, so as to support various encodings
-    // (and we can only post well-formed XML anyway)
-    Reader reader = new InputStreamReader(new FileInputStream(file),POST_ENCODING);
+    InputStream is = null;
     try {
-      postData(reader, output);
+      is = new FileInputStream(file);
+      postData(is, (int)file.length(), output);
+    } catch (IOException e) {
+      fatal("Can't open/read file: " + file);
     } finally {
       try {
-        if(reader!=null) reader.close();
+        if(is!=null) is.close();
       } catch (IOException e) {
-        throw new PostException("IOException while closing file", e);
+        fatal("IOException while closing file: "+ e);
       }
     }
   }
 
   /**
-   * Reads data from the data reader and posts it to solr,
+   * Reads data from the data stream and posts it to solr,
    * writes to the response to output
    */
-  public void postData(Reader data, Writer output) {
+  public void postData(InputStream data, Integer length, OutputStream output) {
+
+    final String type = System.getProperty("type", DEFAULT_DATA_TYPE);
 
     HttpURLConnection urlc = null;
     try {
-      urlc = (HttpURLConnection) solrUrl.openConnection();
       try {
-        urlc.setRequestMethod("POST");
-      } catch (ProtocolException e) {
-        throw new PostException("Shouldn't happen: HttpURLConnection doesn't support POST??", e);
+        urlc = (HttpURLConnection) solrUrl.openConnection();
+        try {
+          urlc.setRequestMethod("POST");
+        } catch (ProtocolException e) {
+          fatal("Shouldn't happen: HttpURLConnection doesn't support POST??"+e);
+                
+        }
+        urlc.setDoOutput(true);
+        urlc.setDoInput(true);
+        urlc.setUseCaches(false);
+        urlc.setAllowUserInteraction(false);
+        urlc.setRequestProperty("Content-type", type);
+
+        if (null != length) urlc.setFixedLengthStreamingMode(length);
+
+      } catch (IOException e) {
+        fatal("Connection error (is Solr running at " + solrUrl + " ?): " + e);
       }
-      urlc.setDoOutput(true);
-      urlc.setDoInput(true);
-      urlc.setUseCaches(false);
-      urlc.setAllowUserInteraction(false);
-      urlc.setRequestProperty("Content-type", "text/xml; charset=" + POST_ENCODING);
-      
-      OutputStream out = urlc.getOutputStream();
       
+      OutputStream out = null;
       try {
-        Writer writer = new OutputStreamWriter(out, POST_ENCODING);
-        pipe(data, writer);
-        writer.close();
+        out = urlc.getOutputStream();
+        pipe(data, out);
       } catch (IOException e) {
-        throw new PostException("IOException while posting data", e);
+        fatal("IOException while posting data: " + e);
       } finally {
-        if(out!=null) out.close();
+        try { if(out!=null) out.close(); } catch (IOException x) { /*NOOP*/ }
       }
       
-      InputStream in = urlc.getInputStream();
+      InputStream in = null;
       try {
-        Reader reader = new InputStreamReader(in);
-        pipe(reader, output);
-        reader.close();
+        if (HttpURLConnection.HTTP_OK != urlc.getResponseCode()) {
+          fatal("Solr returned an error #" + urlc.getResponseCode() + 
+                " " + urlc.getResponseMessage());
+        }
+
+        in = urlc.getInputStream();
+        pipe(in, output);
       } catch (IOException e) {
-        throw new PostException("IOException while reading response", e);
+        fatal("IOException while reading response: " + e);
       } finally {
-        if(in!=null) in.close();
+        try { if(in!=null) in.close(); } catch (IOException x) { /*NOOP*/ }
       }
       
-    } catch (IOException e) {
-      try {
-        fatal("Solr returned an error: " + urlc.getResponseMessage());
-      } catch (IOException f) { }
-      fatal("Connection error (is Solr running at " + solrUrl + " ?): " + e);
     } finally {
       if(urlc!=null) urlc.disconnect();
     }
   }
 
+  private static InputStream stringToStream(String s) {
+    InputStream is = null;
+    try {
+      is = new ByteArrayInputStream(s.getBytes("UTF-8"));
+    } catch (UnsupportedEncodingException e) {
+      fatal("Shouldn't happen: UTF-8 not supported?!?!?!");
+    }
+    return is;
+  }
+
   /**
-   * Pipes everything from the reader to the writer via a buffer
+   * Pipes everything from the source to the dest.  If dest is null, 
+   * then everything is read fro msource and thrown away.
    */
-  private static void pipe(Reader reader, Writer writer) throws IOException {
-    char[] buf = new char[1024];
+  private static void pipe(InputStream source, OutputStream dest) throws IOException {
+    byte[] buf = new byte[1024];
     int read = 0;
-    while ( (read = reader.read(buf) ) >= 0) {
-      writer.write(buf, 0, read);
+    while ( (read = source.read(buf) ) >= 0) {
+      if (null != dest) dest.write(buf, 0, read);
     }
-    writer.flush();
+    if (null != dest) dest.flush();
   }
 }

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/util/SolrPluginUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/util/SolrPluginUtils.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/util/SolrPluginUtils.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/util/SolrPluginUtils.java Wed Feb  9 01:03:49 2011
@@ -703,6 +703,7 @@ public class SolrPluginUtils {
      * DisjunctionMaxQuery.  (so yes: aliases which point at other
      * aliases should work)
      */
+    @Override
     protected Query getFieldQuery(String field, String queryText, boolean quoted)
       throws ParseException {
 

Modified: lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java Wed Feb  9 01:03:49 2011
@@ -36,6 +36,7 @@ import java.util.List;
  */
 public class BinaryRequestWriter extends RequestWriter {
 
+  @Override
   public Collection<ContentStream> getContentStreams(SolrRequest req) throws IOException {
     if (req instanceof UpdateRequest) {
       UpdateRequest updateRequest = (UpdateRequest) req;
@@ -55,10 +56,12 @@ public class BinaryRequestWriter extends
   }
 
 
+  @Override
   public String getUpdateContentType() {
     return "application/octet-stream";
   }
 
+  @Override
   public ContentStream getContentStream(final UpdateRequest request) throws IOException {
     final BAOS baos = new BAOS();
       new JavaBinUpdateRequestCodec().marshal(request, baos);
@@ -91,6 +94,7 @@ public class BinaryRequestWriter extends
   }
 
 
+  @Override
   public void write(SolrRequest request, OutputStream os) throws IOException {
     if (request instanceof UpdateRequest) {
       UpdateRequest updateRequest = (UpdateRequest) request;
@@ -106,6 +110,7 @@ public class BinaryRequestWriter extends
     }
   }
 
+  @Override
   public String getPath(SolrRequest req) {
     if (req instanceof UpdateRequest) {
       return "/update/javabin";

Modified: lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/BinaryResponseParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/BinaryResponseParser.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/BinaryResponseParser.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/BinaryResponseParser.java Wed Feb  9 01:03:49 2011
@@ -30,10 +30,12 @@ import java.io.Reader;
  * @since solr 1.3
  */
 public class BinaryResponseParser extends ResponseParser {
+  @Override
   public String getWriterType() {
     return "javabin";
   }
 
+  @Override
   public NamedList<Object> processResponse(InputStream body, String encoding) {
     try {
       return (NamedList<Object>) new JavaBinCodec().unmarshal(body);
@@ -44,10 +46,12 @@ public class BinaryResponseParser extend
   }
 
 
+  @Override
   public String getVersion() {
     return "2";
   }
 
+  @Override
   public NamedList<Object> processResponse(Reader reader) {
     throw new RuntimeException("Cannot handle character stream");
   }

Modified: lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/CommonsHttpSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/CommonsHttpSolrServer.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/CommonsHttpSolrServer.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/CommonsHttpSolrServer.java Wed Feb  9 01:03:49 2011
@@ -20,7 +20,6 @@ package org.apache.solr.client.solrj.imp
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.io.Reader;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.*;
@@ -62,6 +61,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
+ * The {@link CommonsHttpSolrServer} uses the Apache Commons HTTP Client to connect to solr. 
+ * <pre class="prettyprint" >SolrServer server = new CommonsHttpSolrServer( url );</pre>
  * 
  * @version $Id$
  * @since solr 1.3
@@ -335,11 +336,11 @@ public class CommonsHttpSolrServer exten
                     @Override
                     protected void sendData(OutputStream out)
                         throws IOException {
-                      Reader reader = c.getReader();
+                      InputStream in = c.getStream();
                       try {
-                        IOUtils.copy(reader, out);
+                        IOUtils.copy(in, out);
                       } finally {
-                        reader.close();
+                        in.close();
                       }
                     }
                   });

Modified: lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java Wed Feb  9 01:03:49 2011
@@ -105,6 +105,7 @@ public class LBHttpSolrServer extends So
       this.solrServer = solrServer;
     }
 
+    @Override
     public String toString() {
       return solrServer.getBaseURL();
     }
@@ -149,7 +150,7 @@ public class LBHttpSolrServer extends So
       return numDeadServersToTry;
     }
 
-    /** @return The number of dead servers to try if there are no live servers left.
+    /** @param numDeadServersToTry The number of dead servers to try if there are no live servers left.
      * Defaults to the number of servers in this request. */
     public void setNumDeadServersToTry(int numDeadServersToTry) {
       this.numDeadServersToTry = numDeadServersToTry;
@@ -376,6 +377,7 @@ public class LBHttpSolrServer extends So
    * @throws SolrServerException
    * @throws IOException
    */
+  @Override
   public NamedList<Object> request(final SolrRequest request)
           throws SolrServerException, IOException {
     Exception ex = null;
@@ -535,6 +537,7 @@ public class LBHttpSolrServer extends So
     return httpClient;
   }
 
+  @Override
   protected void finalize() throws Throwable {
     try {
       if(this.aliveCheckExecutor!=null)

Modified: lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/StreamingBinaryResponseParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/StreamingBinaryResponseParser.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/StreamingBinaryResponseParser.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/StreamingBinaryResponseParser.java Wed Feb  9 01:03:49 2011
@@ -48,12 +48,14 @@ public class StreamingBinaryResponsePars
     try {
       JavaBinCodec codec = new JavaBinCodec() {
 
+        @Override
         public SolrDocument readSolrDocument(FastInputStream dis) throws IOException {
           SolrDocument doc = super.readSolrDocument(dis);
           callback.streamSolrDocument( doc );
           return null;
         }
 
+        @Override
         public SolrDocumentList readSolrDocumentList(FastInputStream dis) throws IOException {
           SolrDocumentList solrDocs = new SolrDocumentList();
           List list = (List) readVal(dis);

Modified: lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.java Wed Feb  9 01:03:49 2011
@@ -173,12 +173,20 @@ public class StreamingUpdateSolrServer e
       }
       catch (Throwable e) {
         handleError( e );
-      } 
+      }
       finally {
-        // remove it from the list of running things...
+
+        // remove it from the list of running things unless we are the last runner and the queue is full...
+        // in which case, the next queue.put() would block and there would be no runners to handle it.
         synchronized (runners) {
-          runners.remove( this );
+          if (runners.size() == 1 && queue.remainingCapacity() == 0) {
+           // keep this runner alive
+           scheduler.execute(this);
+          } else {
+            runners.remove( this );
+          }
         }
+
         log.info( "finished: {}" , this );
         runnerLock.unlock();
       }
@@ -208,7 +216,7 @@ public class StreamingUpdateSolrServer e
         return super.request( request );
       }
     }
-    
+
     try {
       CountDownLatch tmpLock = lock;
       if( tmpLock != null ) {
@@ -216,18 +224,18 @@ public class StreamingUpdateSolrServer e
       }
 
       queue.put( req );
-      
-        synchronized( runners ) {
-      if( runners.isEmpty() 
-        || (queue.remainingCapacity() < queue.size() 
-         && runners.size() < threadCount) ) 
-      {
+
+      synchronized( runners ) {
+        if( runners.isEmpty()
+                || (queue.remainingCapacity() < queue.size()
+                && runners.size() < threadCount) )
+        {
           Runner r = new Runner();
           scheduler.execute( r );
           runners.add( r );
         }
       }
-    } 
+    }
     catch (InterruptedException e) {
       log.error( "interrupted", e );
       throw new IOException( e.getLocalizedMessage() );

Modified: lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java Wed Feb  9 01:03:49 2011
@@ -67,6 +67,7 @@ public class JavaBinUpdateRequestCodec {
     nl.add("delByQ", updateRequest.getDeleteQuery());
     nl.add("docs", docIter);
     new JavaBinCodec(){
+      @Override
       public void writeMap(Map val) throws IOException {
         if (val instanceof SolrInputDocument) {
           writeVal(solrInputDocumentToList((SolrInputDocument) val));
@@ -101,6 +102,7 @@ public class JavaBinUpdateRequestCodec {
       // is ever refactored, this will not work.
       private boolean seenOuterMostDocIterator = false;
         
+      @Override
       public NamedList readNamedList(FastInputStream dis) throws IOException {
         int sz = readSize(dis);
         NamedList nl = new NamedList();
@@ -115,6 +117,7 @@ public class JavaBinUpdateRequestCodec {
         return nl;
       }
 
+      @Override
       public List readIterator(FastInputStream fis) throws IOException {
 
         // default behavior for reading any regular Iterator in the stream

Modified: lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/response/FieldStatsInfo.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/response/FieldStatsInfo.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/response/FieldStatsInfo.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/response/FieldStatsInfo.java Wed Feb  9 01:03:49 2011
@@ -94,6 +94,7 @@ public class FieldStatsInfo implements S
     }
   }
   
+  @Override
   public String toString()
   {
     StringBuilder sb = new StringBuilder();

Modified: lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/response/QueryResponse.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/response/QueryResponse.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/response/QueryResponse.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/response/QueryResponse.java Wed Feb  9 01:03:49 2011
@@ -105,7 +105,8 @@ public class QueryResponse extends SolrR
       }
       else if( "facet_counts".equals( n ) ) {
         _facetInfo = (NamedList<Object>) res.getVal( i );
-        extractFacetInfo( _facetInfo );
+        // extractFacetInfo inspects _results, so defer calling it
+        // in case it hasn't been populated yet.
       }
       else if( "debug".equals( n ) ) {
         _debugInfo = (NamedList<Object>) res.getVal( i );
@@ -128,6 +129,7 @@ public class QueryResponse extends SolrR
         extractTermsInfo( _termsInfo );
       }
     }
+    if(_facetInfo != null) extractFacetInfo( _facetInfo );
   }
 
   private void extractSpellCheckInfo(NamedList<NamedList<Object>> spellInfo) {

Modified: lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/response/SpellCheckResponse.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/response/SpellCheckResponse.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/response/SpellCheckResponse.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/response/SpellCheckResponse.java Wed Feb  9 01:03:49 2011
@@ -115,7 +115,7 @@ public class SpellCheckResponse {
    * <p>
    *  Return the first collated query string.  For convenience and backwards-compatibility.  Use getCollatedResults() for full data.
    * </p>
-   * @return
+   * @return first collated query string
    */
   public String getCollatedResult() {
     return collations==null || collations.size()==0 ? null : collations.get(0).collationQueryString;
@@ -126,7 +126,7 @@ public class SpellCheckResponse {
    *  Return all collations.  
    *  Will include # of hits and misspelling-to-correction details if "spellcheck.collateExtendedResults was true.
    * </p>
-   * @return
+   * @return all collations
    */
   public List<Collation> getCollatedResults() {
   	return collations;

Modified: lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/schema.xml?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/schema.xml (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/schema.xml Wed Feb  9 01:03:49 2011
@@ -402,8 +402,8 @@
    <field name="text" type="text" indexed="true" stored="false"/>
    <field name="subject" type="text" indexed="true" stored="true"/>
    <field name="title" type="nametext" indexed="true" stored="true"/>
-   <field name="weight" type="float" indexed="true" stored="true"/>
-   <field name="bday" type="date" indexed="true" stored="true"/>
+   <field name="weight" type="float" indexed="true" stored="true" multiValued="false"/>
+   <field name="bday" type="date" indexed="true" stored="true" multiValued="false"/>
 
    <field name="title_stemmed" type="text" indexed="true" stored="false"/>
    <field name="title_lettertok" type="lettertok" indexed="true" stored="false"/>
@@ -480,9 +480,10 @@
 
    <field name="numberpartfail" type="failtype1" indexed="true" stored="true"/>
 
-   <field name="nullfirst" type="string" indexed="true" stored="true" sortMissingFirst="true"/>
+   <field name="nullfirst" type="string" indexed="true" stored="true" sortMissingFirst="true" multiValued="false"/>
 
    <field name="subword" type="subword" indexed="true" stored="true"/>
+   <field name="subword_offsets" type="subword" indexed="true" stored="true" termOffsets="true"/>
    <field name="numericsubword" type="numericsubword" indexed="true" stored="true"/>
    <field name="protectedsubword" type="protectedsubword" indexed="true" stored="true"/>
 
@@ -507,27 +508,40 @@
         both match, the first appearing in the schema will be used.
    -->
    <dynamicField name="*_i"  type="int"    indexed="true"  stored="true"/>
+   <dynamicField name="*_i1"  type="int"    indexed="true" stored="true" multiValued="false"/>
+                 
    <dynamicField name="*_s"  type="string"  indexed="true"  stored="true"/>
    <dynamicField name="*_s1"  type="string"  indexed="true"  stored="true" multiValued="false"/>
    <dynamicField name="*_l"  type="long"   indexed="true"  stored="true"/>
+   <dynamicField name="*_l1"  type="long"   indexed="true"  stored="true" multiValued="false"/>
    <dynamicField name="*_t"  type="text"    indexed="true"  stored="true"/>
    <dynamicField name="*_b"  type="boolean" indexed="true"  stored="true"/>
    <dynamicField name="*_f"  type="float"  indexed="true"  stored="true"/>
+   <dynamicField name="*_f1"  type="float"  indexed="true"  stored="true" multiValued="false"/>
    <dynamicField name="*_d"  type="double" indexed="true"  stored="true"/>
+   <dynamicField name="*_d1"  type="double" indexed="true"  stored="true" multiValued="false"/>
    <dynamicField name="*_dt" type="date"    indexed="true"  stored="true"/>
+   <dynamicField name="*_dt1" type="date"    indexed="true"  stored="true" multiValued="false"/>
    <dynamicField name="*_bcd" type="bcdstr" indexed="true"  stored="true"/>
 
       <!-- some trie-coded dynamic fields for faster range queries -->
    <dynamicField name="*_ti" type="tint"    indexed="true"  stored="true"/>
+   <dynamicField name="*_ti1" type="tint"    indexed="true"  stored="true" multiValued="false"/>
    <dynamicField name="*_tl" type="tlong"   indexed="true"  stored="true"/>
+   <dynamicField name="*_tl1" type="tlong"   indexed="true"  stored="true" multiValued="false"/>
    <dynamicField name="*_tf" type="tfloat"  indexed="true"  stored="true"/>
+   <dynamicField name="*_tf1" type="tfloat"  indexed="true"  stored="true" multiValued="false"/>
    <dynamicField name="*_td" type="tdouble" indexed="true"  stored="true"/>
+   <dynamicField name="*_td1" type="tdouble" indexed="true" stored="true" multiValued="false"/>
    <dynamicField name="*_tdt" type="tdate"  indexed="true"  stored="true"/>
+   <dynamicField name="*_tdt1" type="tdate"  indexed="true"  stored="true" multiValued="false"/>
 
-   <dynamicField name="*_si"  type="sint"  indexed="true"  stored="true"/>
+   <dynamicField name="*_si"  type="sint"  indexed="true"  stored="true" multiValued="false"/>
    <dynamicField name="*_sl"  type="slong"  indexed="true"  stored="true"/>
    <dynamicField name="*_sf"  type="sfloat"  indexed="true"  stored="true"/>
+   <dynamicField name="*_sf1"  type="sfloat"  indexed="true"  stored="true" multiValued="false"/>
    <dynamicField name="*_sd"  type="sdouble"  indexed="true"  stored="true"/>
+   <dynamicField name="*_sd1"  type="sdouble"  indexed="true"  stored="true" multiValued="false"/>
 
    <dynamicField name="*_pi"  type="pint"    indexed="true"  stored="true"/>
    <dynamicField name="*_pf"  type="pfloat"  indexed="true"  stored="true"/>

Modified: lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/schema12.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/schema12.xml?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/schema12.xml (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/schema12.xml Wed Feb  9 01:03:49 2011
@@ -545,6 +545,8 @@
 
    <dynamicField name="*_i"  type="int"    indexed="true"  stored="true"/>
    <dynamicField name="*_is"  type="int"    indexed="true"  stored="true" multiValued="true"/>
+   <dynamicField name="*_s1"  type="string"  indexed="true" stored="true" multiValued="false"/>
+   <!-- :TODO: why are these identical?!?!?! -->
    <dynamicField name="*_s"  type="string"  indexed="true"  stored="true" multiValued="true"/>
    <dynamicField name="*_ss"  type="string"  indexed="true"  stored="true" multiValued="true"/>
    <dynamicField name="*_l"  type="long"   indexed="true"  stored="true"/>

Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/BaseDistributedSearchTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/BaseDistributedSearchTestCase.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/BaseDistributedSearchTestCase.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/BaseDistributedSearchTestCase.java Wed Feb  9 01:03:49 2011
@@ -1,5 +1,22 @@
 package org.apache.solr;
 
+/**
+ * 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.
+ */
+
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -81,24 +98,28 @@ public abstract class BaseDistributedSea
   public static Logger log = LoggerFactory.getLogger(BaseDistributedSearchTestCase.class);
   
   public static RandVal rint = new RandVal() {
+    @Override
     public Object val() {
       return r.nextInt();
     }
   };
 
   public static RandVal rlong = new RandVal() {
+    @Override
     public Object val() {
       return r.nextLong();
     }
   };
 
   public static RandVal rfloat = new RandVal() {
+    @Override
     public Object val() {
       return r.nextFloat();
     }
   };
 
   public static RandVal rdouble = new RandVal() {
+    @Override
     public Object val() {
       return r.nextDouble();
     }
@@ -113,7 +134,7 @@ public abstract class BaseDistributedSea
    */
   public abstract void doTest() throws Exception;
 
-  public static String[] fieldNames = new String[]{"n_ti", "n_f", "n_tf", "n_d", "n_td", "n_l", "n_tl", "n_dt", "n_tdt"};
+  public static String[] fieldNames = new String[]{"n_ti1", "n_f1", "n_tf1", "n_d1", "n_td1", "n_l1", "n_tl1", "n_dt1", "n_tdt1"};
   public static RandVal[] randVals = new RandVal[]{rint, rfloat, rfloat, rdouble, rdouble, rlong, rlong, rdate, rdate};
 
   protected String[] getFieldNames() {
@@ -320,6 +341,7 @@ public abstract class BaseDistributedSea
       Thread[] threads = new Thread[nThreads];
       for (int i = 0; i < threads.length; i++) {
         threads[i] = new Thread() {
+          @Override
           public void run() {
             for (int j = 0; j < stress; j++) {
               int which = r.nextInt(clients.size());
@@ -606,6 +628,7 @@ public abstract class BaseDistributedSea
   public static class RandDate extends RandVal {
     public static TrieDateField df = new TrieDateField();
 
+    @Override
     public Object val() {
       long v = r.nextLong();
       Date d = new Date(v);

Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/BasicFunctionalityTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/BasicFunctionalityTest.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/BasicFunctionalityTest.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/BasicFunctionalityTest.java Wed Feb  9 01:03:49 2011
@@ -29,6 +29,8 @@ import javax.xml.parsers.DocumentBuilder
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.index.LogMergePolicy;
+import org.apache.solr.common.SolrException;
+import org.apache.solr.common.SolrException.ErrorCode;
 import org.apache.solr.common.params.AppendedSolrParams;
 import org.apache.solr.common.params.CommonParams;
 import org.apache.solr.common.params.DefaultSolrParams;
@@ -47,6 +49,8 @@ import org.apache.solr.schema.SchemaFiel
 import org.apache.solr.search.DocIterator;
 import org.apache.solr.search.DocList;
 import org.apache.solr.update.SolrIndexWriter;
+
+
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -221,10 +225,15 @@ public class BasicFunctionalityTest exte
   public void testRequestHandlerBaseException() {
     final String tmp = "BOO! ignore_exception";
     SolrRequestHandler handler = new RequestHandlerBase() {
+        @Override
         public String getDescription() { return tmp; }
+        @Override
         public String getSourceId() { return tmp; }
+        @Override
         public String getSource() { return tmp; }
+        @Override
         public String getVersion() { return tmp; }
+        @Override
         public void handleRequestBody
           ( SolrQueryRequest req, SolrQueryResponse rsp ) {
           throw new RuntimeException(tmp);
@@ -653,6 +662,39 @@ public class BasicFunctionalityTest exte
             "*[count(//doc)=1]");
   }
 
+  @Test
+  public void testAbuseOfSort() {
+
+    assertU(adoc("id", "9999991",
+                 "sortabuse_b", "true",
+                 "sortabuse_t", "zzz xxx ccc vvv bbb nnn aaa sss ddd fff ggg"));
+    assertU(adoc("id", "9999992",
+                 "sortabuse_b", "true",
+                 "sortabuse_t", "zzz xxx ccc vvv bbb nnn qqq www eee rrr ttt"));
+
+    assertU(commit());
+  
+    try {
+      assertQ("sort on something that shouldn't work",
+              req("q", "sortabuse_b:true",
+                  "sort", "sortabuse_t asc"),
+              "*[count(//doc)=2]");
+      fail("no error encountered when sorting on sortabuse_t");
+    } catch (Exception outer) {
+      // EXPECTED
+      Throwable root = getRootCause(outer);
+      assertEquals("sort exception root cause", 
+                   SolrException.class, root.getClass());
+      SolrException e = (SolrException) root;
+      assertEquals("incorrect error type", 
+                   SolrException.ErrorCode.BAD_REQUEST,
+                   SolrException.ErrorCode.getErrorCode(e.code()));
+      assertTrue("exception doesn't contain field name",
+                 -1 != e.getMessage().indexOf("sortabuse_t"));
+    }
+  }
+
+
 //   /** this doesn't work, but if it did, this is how we'd test it. */
 //   public void testOverwriteFalse() {