lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From busc...@apache.org
Subject svn commit: r1052425 - in /lucene/dev/branches/realtime_search: ./ lucene/ lucene/contrib/ lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/stats/ lucene/co...
Date Fri, 24 Dec 2010 01:30:45 GMT
Author: buschmi
Date: Fri Dec 24 01:30:44 2010
New Revision: 1052425

URL: http://svn.apache.org/viewvc?rev=1052425&view=rev
Log:
Merge latest trunk into realtime branch

Added:
    lucene/dev/branches/realtime_search/solr/contrib/clustering/lib/carrot2-core-3.4.2.jar
      - copied unchanged from r1052423, lucene/dev/trunk/solr/contrib/clustering/lib/carrot2-core-3.4.2.jar
    lucene/dev/branches/realtime_search/solr/contrib/clustering/src/test/java/org/apache/solr/handler/clustering/DistributedClusteringComponentTest.java
      - copied unchanged from r1052423, lucene/dev/trunk/solr/contrib/clustering/src/test/java/org/apache/solr/handler/clustering/DistributedClusteringComponentTest.java
    lucene/dev/branches/realtime_search/solr/src/test/org/apache/solr/client/solrj/SolrExampleBinaryTest.java
      - copied unchanged from r1052423, lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/SolrExampleBinaryTest.java
Removed:
    lucene/dev/branches/realtime_search/solr/contrib/clustering/lib/carrot2-core-3.4.0.jar
Modified:
    lucene/dev/branches/realtime_search/   (props changed)
    lucene/dev/branches/realtime_search/lucene/   (props changed)
    lucene/dev/branches/realtime_search/lucene/contrib/CHANGES.txt
    lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/AbstractQueryMaker.java
    lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DemoHTMLParser.java
    lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DirContentSource.java
    lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java
    lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/EnwikiContentSource.java
    lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/HTMLParser.java
    lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersContentSource.java
    lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/stats/TaskStats.java
    lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/PerfTask.java
    lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/RepAllTask.java
    lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/RepSelectByPrefTask.java
    lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReportTask.java
    lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/TaskSequence.java
    lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Algorithm.java
    lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java
    lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/quality/trec/TrecTopicsReader.java
    lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/stats/MemUsage.java
    lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/stats/TestData.java
    lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/stats/TestRunData.java
    lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/stats/TimeData.java
    lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractReuters.java
    lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractWikipedia.java
    lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/BenchmarkTestCase.java
    lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/feeds/LineDocSourceTest.java
    lucene/dev/branches/realtime_search/lucene/src/java/org/apache/lucene/index/DocumentsWriter.java
    lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/util/LuceneJUnitResultFormatter.java
    lucene/dev/branches/realtime_search/modules/   (props changed)
    lucene/dev/branches/realtime_search/solr/   (props changed)
    lucene/dev/branches/realtime_search/solr/CHANGES.txt
    lucene/dev/branches/realtime_search/solr/contrib/clustering/CHANGES.txt
    lucene/dev/branches/realtime_search/solr/contrib/clustering/build.xml
    lucene/dev/branches/realtime_search/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/ClusteringComponent.java
    lucene/dev/branches/realtime_search/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/SearchClusteringEngine.java
    lucene/dev/branches/realtime_search/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/carrot2/CarrotClusteringEngine.java
    lucene/dev/branches/realtime_search/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/carrot2/LuceneLanguageModelFactory.java
    lucene/dev/branches/realtime_search/solr/contrib/clustering/src/test/java/org/apache/solr/handler/clustering/carrot2/CarrotClusteringEngineTest.java
    lucene/dev/branches/realtime_search/solr/example/README.txt
    lucene/dev/branches/realtime_search/solr/example/exampledocs/ipod_other.xml
    lucene/dev/branches/realtime_search/solr/example/exampledocs/mem.xml
    lucene/dev/branches/realtime_search/solr/example/exampledocs/monitor2.xml
    lucene/dev/branches/realtime_search/solr/example/exampledocs/mp500.xml
    lucene/dev/branches/realtime_search/solr/example/exampledocs/sd500.xml
    lucene/dev/branches/realtime_search/solr/example/multicore/README.txt
    lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/util/SolrPluginUtils.java
    lucene/dev/branches/realtime_search/solr/src/solrj/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java
    lucene/dev/branches/realtime_search/solr/src/test/org/apache/solr/util/SolrPluginUtilsTest.java

Modified: lucene/dev/branches/realtime_search/lucene/contrib/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/CHANGES.txt?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/CHANGES.txt (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/CHANGES.txt Fri Dec 24 01:30:44 2010
@@ -174,6 +174,9 @@ API Changes
  * LUCENE-2747: Deprecated ArabicLetterTokenizer. StandardTokenizer now tokenizes
    most languages correctly including Arabic.  (Steven Rowe, Robert Muir)
 
+ * LUCENE-2830: Use StringBuilder instead of StringBuffer across Benchmark, and
+   remove the StringBuffer HtmlParser.parse() variant. (Shai Erera)
+   
 New features
 
  * LUCENE-2306: Add NumericRangeFilter and NumericRangeQuery support to XMLQueryParser.

Modified: lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/AbstractQueryMaker.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/AbstractQueryMaker.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/AbstractQueryMaker.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/AbstractQueryMaker.java Fri Dec 24 01:30:44 2010
@@ -41,7 +41,7 @@ public abstract class AbstractQueryMaker
 
   public String printQueries() {
     String newline = System.getProperty("line.separator");
-    StringBuffer sb = new StringBuffer();
+    StringBuilder sb = new StringBuilder();
     if (queries != null) {
       for (int i = 0; i < queries.length; i++) {
         sb.append(i+". "+ queries[i].getClass().getSimpleName()+" - "+queries[i].toString());

Modified: lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DemoHTMLParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DemoHTMLParser.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DemoHTMLParser.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DemoHTMLParser.java Fri Dec 24 01:30:44 2010
@@ -40,7 +40,7 @@ public class DemoHTMLParser implements o
     // body
     Reader r = p.getReader();
     char c[] = new char[1024];
-    StringBuffer bodyBuf = new StringBuffer();
+    StringBuilder bodyBuf = new StringBuilder();
     int n;
     while ((n = r.read(c)) >= 0) {
       if (n>0) {
@@ -67,12 +67,4 @@ public class DemoHTMLParser implements o
     return docData;
   }
 
-  /*
-   *  (non-Javadoc)
-   * @see org.apache.lucene.benchmark.byTask.feeds.HTMLParser#parse(java.lang.String, java.util.Date, java.lang.StringBuffer, java.text.DateFormat)
-   */
-  public DocData parse(DocData docData, String name, Date date, StringBuffer inputText, DateFormat dateFormat) throws IOException, InterruptedException {
-    return parse(docData, name, date, new StringReader(inputText.toString()), dateFormat);
-  }
-
 }

Modified: lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DirContentSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DirContentSource.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DirContentSource.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DirContentSource.java Fri Dec 24 01:30:44 2010
@@ -202,7 +202,7 @@ public class DirContentSource extends Co
     reader.readLine();//skip an empty line
     String title = reader.readLine();
     reader.readLine();//skip an empty line
-    StringBuffer bodyBuf = new StringBuffer(1024);
+    StringBuilder bodyBuf = new StringBuilder(1024);
     while ((line = reader.readLine()) != null) {
       bodyBuf.append(line).append(' ');
     }

Modified: lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java Fri Dec 24 01:30:44 2010
@@ -400,7 +400,7 @@ public class DocMaker {
   public void printDocStatistics() {
     boolean print = false;
     String col = "                  ";
-    StringBuffer sb = new StringBuffer();
+    StringBuilder sb = new StringBuilder();
     String newline = System.getProperty("line.separator");
     sb.append("------------> ").append(getClass().getSimpleName()).append(" statistics (").append(printNum).append("): ").append(newline);
     int nut = source.getTotalDocsCount();

Modified: lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/EnwikiContentSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/EnwikiContentSource.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/EnwikiContentSource.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/EnwikiContentSource.java Fri Dec 24 01:30:44 2010
@@ -48,7 +48,7 @@ public class EnwikiContentSource extends
     private boolean threadDone;
     private String[] tuple;
     private NoMoreDataException nmde;
-    private StringBuffer contents = new StringBuffer();
+    private StringBuilder contents = new StringBuilder();
     private String title;
     private String body;
     private String time;
@@ -91,7 +91,7 @@ public class EnwikiContentSource extends
     }
     
     String time(String original) {
-      StringBuffer buffer = new StringBuffer();
+      StringBuilder buffer = new StringBuilder();
 
       buffer.append(original.substring(8, 10));
       buffer.append('-');

Modified: lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/HTMLParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/HTMLParser.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/HTMLParser.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/HTMLParser.java Fri Dec 24 01:30:44 2010
@@ -40,12 +40,5 @@ public interface HTMLParser {
    * @throws InterruptedException
    */
   public DocData parse(DocData docData, String name, Date date, Reader reader, DateFormat dateFormat) throws IOException, InterruptedException;
-  
-  /**
-   * Parse the inputText and return DocData. 
-   * @param inputText the html text to parse.
-   * @see #parse(DocData, String, Date, Reader, DateFormat)
-   */
-  public DocData parse(DocData docData, String name, Date date, StringBuffer inputText, DateFormat dateFormat) throws IOException, InterruptedException;
 
 }

Modified: lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersContentSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersContentSource.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersContentSource.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersContentSource.java Fri Dec 24 01:30:44 2010
@@ -119,7 +119,7 @@ public class ReutersContentSource extend
       reader.readLine();// skip an empty line
       String title = reader.readLine();
       reader.readLine();// skip an empty line
-      StringBuffer bodyBuf = new StringBuffer(1024);
+      StringBuilder bodyBuf = new StringBuilder(1024);
       String line = null;
       while ((line = reader.readLine()) != null) {
         bodyBuf.append(line).append(' ');

Modified: lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/stats/TaskStats.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/stats/TaskStats.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/stats/TaskStats.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/stats/TaskStats.java Fri Dec 24 01:30:44 2010
@@ -120,7 +120,7 @@ public class TaskStats implements Clonea
    */
   @Override
   public String toString() {
-    StringBuffer res = new StringBuffer(task.getName());
+    StringBuilder res = new StringBuilder(task.getName());
     res.append(" ");
     res.append(count);
     res.append(" ");

Modified: lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/PerfTask.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/PerfTask.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/PerfTask.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/PerfTask.java Fri Dec 24 01:30:44 2010
@@ -163,7 +163,7 @@ public abstract class PerfTask implement
     if (params==null) {
       return name;
     } 
-    return new StringBuffer(name).append('(').append(params).append(')').toString();
+    return new StringBuilder(name).append('(').append(params).append(')').toString();
   }
 
   /**
@@ -207,7 +207,7 @@ public abstract class PerfTask implement
   @Override
   public String toString() {
     String padd = getPadding();
-    StringBuffer sb = new StringBuffer(padd);
+    StringBuilder sb = new StringBuilder(padd);
     if (disableCounting) {
       sb.append('-');
     }

Modified: lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/RepAllTask.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/RepAllTask.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/RepAllTask.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/RepAllTask.java Fri Dec 24 01:30:44 2010
@@ -51,7 +51,7 @@ public class RepAllTask extends ReportTa
   protected Report reportAll(List<TaskStats> taskStats) {
     String longestOp = longestOp(taskStats);
     boolean first = true;
-    StringBuffer sb = new StringBuffer();
+    StringBuilder sb = new StringBuilder();
     sb.append(tableTitle(longestOp));
     sb.append(newline);
     int reported = 0;

Modified: lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/RepSelectByPrefTask.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/RepSelectByPrefTask.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/RepSelectByPrefTask.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/RepSelectByPrefTask.java Fri Dec 24 01:30:44 2010
@@ -49,7 +49,7 @@ public class RepSelectByPrefTask extends
   protected Report reportSelectByPrefix(List<TaskStats> taskStats) {
     String longestOp = longestOp(taskStats);
     boolean first = true;
-    StringBuffer sb = new StringBuffer();
+    StringBuilder sb = new StringBuilder();
     sb.append(tableTitle(longestOp));
     sb.append(newline);
     int reported = 0;

Modified: lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReportTask.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReportTask.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReportTask.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReportTask.java Fri Dec 24 01:30:44 2010
@@ -82,7 +82,7 @@ public abstract class ReportTask extends
    * @return the table title line.
    */
   protected String tableTitle (String longestOp) {
-    StringBuffer sb = new StringBuffer();
+    StringBuilder sb = new StringBuilder();
     sb.append(Format.format(OP,longestOp));
     sb.append(ROUND);
     sb.append(getRunData().getConfig().getColsNamesForValsByRound());
@@ -118,7 +118,7 @@ public abstract class ReportTask extends
    */
   protected String taskReportLine(String longestOp, TaskStats stat) {
     PerfTask task = stat.getTask();
-    StringBuffer sb = new StringBuffer();
+    StringBuilder sb = new StringBuilder();
     sb.append(Format.format(task.getName(), longestOp));
     String round = (stat.getRound()>=0 ? ""+stat.getRound() : "-");
     sb.append(Format.formatPaddLeft(round, ROUND));
@@ -136,7 +136,7 @@ public abstract class ReportTask extends
   protected Report genPartialReport(int reported, LinkedHashMap<String,TaskStats> partOfTasks, int totalSize) {
     String longetOp = longestOp(partOfTasks.values());
     boolean first = true;
-    StringBuffer sb = new StringBuffer();
+    StringBuilder sb = new StringBuilder();
     sb.append(tableTitle(longetOp));
     sb.append(newline);
     int lineNum = 0;

Modified: lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/TaskSequence.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/TaskSequence.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/TaskSequence.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/TaskSequence.java Fri Dec 24 01:30:44 2010
@@ -418,7 +418,7 @@ public class TaskSequence extends PerfTa
   @Override
   public String toString() {
     String padd = getPadding();
-    StringBuffer sb = new StringBuffer(super.toString());
+    StringBuilder sb = new StringBuilder(super.toString());
     sb.append(parallel ? " [" : " {");
     sb.append(NEW_LINE);
     for (final PerfTask task : tasks) {

Modified: lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Algorithm.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Algorithm.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Algorithm.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Algorithm.java Fri Dec 24 01:30:44 2010
@@ -82,7 +82,7 @@ public class Algorithm {
             stok.pushBack();
           } else {
             // get params, for tasks that supports them, - anything until next ')'
-            StringBuffer params = new StringBuffer();
+            StringBuilder params = new StringBuilder();
             stok.nextToken();
             while (stok.ttype!=')') { 
               switch (stok.ttype) {
@@ -254,7 +254,7 @@ public class Algorithm {
   @Override
   public String toString() {
     String newline = System.getProperty("line.separator");
-    StringBuffer sb = new StringBuffer();
+    StringBuilder sb = new StringBuilder();
     sb.append(sequence.toString());
     sb.append(newline);
     return sb.toString();

Modified: lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java Fri Dec 24 01:30:44 2010
@@ -44,6 +44,8 @@ import java.util.StringTokenizer;
  */
 public class Config {
 
+  // For tests, if verbose is not turned on, don't print the props.
+  private static final String DEFAULT_PRINT_PROPS = System.getProperty("tests.verbose", "true");
   private static final String NEW_LINE = System.getProperty("line.separator");
 
   private int roundNumber = 0;
@@ -71,7 +73,7 @@ public class Config {
     }
     r.close();
     // copy props lines to string
-    StringBuffer sb = new StringBuffer();
+    StringBuilder sb = new StringBuilder();
     for (int i = 0; i < lastConfigLine; i++) {
       sb.append(lines.get(i));
       sb.append(NEW_LINE);
@@ -85,12 +87,12 @@ public class Config {
       props.setProperty("work.dir", System.getProperty("benchmark.work.dir", "work"));
     }
 
-    if (Boolean.valueOf(props.getProperty("print.props", "true")).booleanValue()) {
+    if (Boolean.valueOf(props.getProperty("print.props", DEFAULT_PRINT_PROPS)).booleanValue()) {
       printProps();
     }
 
     // copy algorithm lines
-    sb = new StringBuffer();
+    sb = new StringBuilder();
     for (int i = lastConfigLine; i < lines.size(); i++) {
       sb.append(lines.get(i));
       sb.append(NEW_LINE);
@@ -104,12 +106,12 @@ public class Config {
    */
   public Config (Properties props) {
     this.props = props;
-    if (Boolean.valueOf(props.getProperty("print.props","true")).booleanValue()) {
+    if (Boolean.valueOf(props.getProperty("print.props",DEFAULT_PRINT_PROPS)).booleanValue()) {
       printProps();
     }
   }
 
-  @SuppressWarnings("unchecked")
+  @SuppressWarnings({"unchecked", "rawtypes"})
   private void printProps() {
     System.out.println("------------> config properties:");
     List<String> propKeys = new ArrayList(props.keySet());
@@ -270,7 +272,7 @@ public class Config {
   public int newRound() {
     roundNumber++;
 
-    StringBuffer sb = new StringBuffer("--> Round ").append(roundNumber - 1).append("-->").append(roundNumber);
+    StringBuilder sb = new StringBuilder("--> Round ").append(roundNumber - 1).append("-->").append(roundNumber);
 
     // log changes in values
     if (valByRound.size() > 0) {
@@ -386,7 +388,7 @@ public class Config {
     if (colForValByRound.size() == 0) {
       return "";
     }
-    StringBuffer sb = new StringBuffer();
+    StringBuilder sb = new StringBuilder();
     for (final String name : colForValByRound.keySet()) {
       String colName = colForValByRound.get(name);
       sb.append(" ").append(colName);
@@ -401,7 +403,7 @@ public class Config {
     if (colForValByRound.size() == 0) {
       return "";
     }
-    StringBuffer sb = new StringBuffer();
+    StringBuilder sb = new StringBuilder();
     for (final String name : colForValByRound.keySet()) {
       String colName = colForValByRound.get(name);
       String template = " " + colName;

Modified: lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/quality/trec/TrecTopicsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/quality/trec/TrecTopicsReader.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/quality/trec/TrecTopicsReader.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/quality/trec/TrecTopicsReader.java Fri Dec 24 01:30:44 2010
@@ -63,7 +63,7 @@ public class TrecTopicsReader {
    */
   public QualityQuery[] readQueries(BufferedReader reader) throws IOException {
     ArrayList<QualityQuery> res = new ArrayList<QualityQuery>();
-    StringBuffer sb;
+    StringBuilder sb;
     try {
       while (null!=(sb=read(reader,"<top>",null,false,false))) {
         HashMap<String,String> fields = new HashMap<String,String>();
@@ -112,8 +112,8 @@ public class TrecTopicsReader {
   }
 
   // read until finding a line that starts with the specified prefix
-  private StringBuffer read (BufferedReader reader, String prefix, StringBuffer sb, boolean collectMatchLine, boolean collectAll) throws IOException {
-    sb = (sb==null ? new StringBuffer() : sb);
+  private StringBuilder read (BufferedReader reader, String prefix, StringBuilder sb, boolean collectMatchLine, boolean collectAll) throws IOException {
+    sb = (sb==null ? new StringBuilder() : sb);
     String sep = "";
     while (true) {
       String line = reader.readLine();

Modified: lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/stats/MemUsage.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/stats/MemUsage.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/stats/MemUsage.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/stats/MemUsage.java Fri Dec 24 01:30:44 2010
@@ -31,7 +31,7 @@ public class MemUsage {
 
   /** Scale down the values by divisor, append the unit string. */
   public String toScaledString(int div, String unit) {
-    StringBuffer sb = new StringBuffer();
+    StringBuilder sb = new StringBuilder();
       sb.append("free=").append(minFree / div);
       sb.append("/").append(avgFree / div);
       sb.append("/").append(maxFree / div).append(" ").append(unit);

Modified: lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/stats/TestData.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/stats/TestData.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/stats/TestData.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/stats/TestData.java Fri Dec 24 01:30:44 2010
@@ -133,7 +133,7 @@ public class TestData
             return "# [NO RUN DATA]";
         }
         HashMap<String,LDCounter> resByTask = new HashMap<String,LDCounter>(); 
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         String lineSep = System.getProperty("line.separator");
         sb.append("warm = Warm Index Reader").append(lineSep).append("srch = Search Index").append(lineSep).append("trav = Traverse Hits list, optionally retrieving document").append(lineSep).append(lineSep);
         for (int i = 0; i < COLS.length; i++) {
@@ -446,7 +446,7 @@ public class TestData
     @Override
     public String toString()
     {
-        StringBuffer res = new StringBuffer();
+        StringBuilder res = new StringBuilder();
         res.append("#-- ID: ").append(id).append(", ").append(new Date()).append(", heap=").append(heap).append(" --\n");
         res.append("# source=").append(source).append(", directory=").append(directory).append("\n");
         res.append("# maxBufferedDocs=").append(maxBufferedDocs).append(", mergeFactor=").append(mergeFactor);

Modified: lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/stats/TestRunData.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/stats/TestRunData.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/stats/TestRunData.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/stats/TestRunData.java Fri Dec 24 01:30:44 2010
@@ -162,7 +162,7 @@ public class TestRunData {
   /** Return a string representation. */
   @Override
   public String toString() {
-    StringBuffer sb = new StringBuffer();
+    StringBuilder sb = new StringBuilder();
     for (final String label : getLabels()) {
         sb.append(id).append("-").append(label).append(" ").append(getTotals(label).toString(false)).append(" ");
         sb.append(getMemUsage(label).toScaledString(1024 * 1024, "MB")).append("\n");

Modified: lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/stats/TimeData.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/stats/TimeData.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/stats/TimeData.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/stats/TimeData.java Fri Dec 24 01:30:44 2010
@@ -95,7 +95,7 @@ public class TimeData {
    * @return The String
    */
   public String toString(boolean withMem) {
-    StringBuffer sb = new StringBuffer();
+    StringBuilder sb = new StringBuilder();
     sb.append(count + "\t" + elapsed + "\t" + getRate());
     if (withMem) sb.append("\t" + freeMem + "\t" + totalMem);
     return sb.toString();

Modified: lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractReuters.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractReuters.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractReuters.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractReuters.java Fri Dec 24 01:30:44 2010
@@ -90,8 +90,8 @@ public class ExtractReuters
         {
             BufferedReader reader = new BufferedReader(new FileReader(sgmFile));
 
-            StringBuffer buffer = new StringBuffer(1024);
-            StringBuffer outBuffer = new StringBuffer(1024);
+            StringBuilder buffer = new StringBuilder(1024);
+            StringBuilder outBuffer = new StringBuilder(1024);
 
             String line = null;
             int docNumber = 0;

Modified: lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractWikipedia.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractWikipedia.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractWikipedia.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractWikipedia.java Fri Dec 24 01:30:44 2010
@@ -71,7 +71,7 @@ public class ExtractWikipedia {
     d.mkdirs();
     File f = new File(d, id + ".txt");
 
-    StringBuffer contents = new StringBuffer();
+    StringBuilder contents = new StringBuilder();
 
     contents.append(time);
     contents.append("\n\n");

Modified: lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/BenchmarkTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/BenchmarkTestCase.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/BenchmarkTestCase.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/BenchmarkTestCase.java Fri Dec 24 01:30:44 2010
@@ -80,7 +80,7 @@ public abstract class BenchmarkTestCase 
   // catenate alg lines to make the alg text
   private String algLinesToText(String[] algLines) {
     String indent = "  ";
-    StringBuffer sb = new StringBuffer();
+    StringBuilder sb = new StringBuilder();
     for (int i = 0; i < propLines.length; i++) {
       sb.append(indent).append(propLines[i]).append(NEW_LINE);
     }

Modified: lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/feeds/LineDocSourceTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/feeds/LineDocSourceTest.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/feeds/LineDocSourceTest.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/feeds/LineDocSourceTest.java Fri Dec 24 01:30:44 2010
@@ -48,7 +48,7 @@ public class LineDocSourceTest extends B
     OutputStream out = new FileOutputStream(file);
     out = csFactory.createCompressorOutputStream("bzip2", out);
     BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, "utf-8"));
-    StringBuffer doc = new StringBuffer();
+    StringBuilder doc = new StringBuilder();
     doc.append("title").append(WriteLineDocTask.SEP).append("date").append(WriteLineDocTask.SEP).append("body");
     writer.write(doc.toString());
     writer.newLine();
@@ -58,7 +58,7 @@ public class LineDocSourceTest extends B
   private void createRegularLineFile(File file) throws Exception {
     OutputStream out = new FileOutputStream(file);
     BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, "utf-8"));
-    StringBuffer doc = new StringBuffer();
+    StringBuilder doc = new StringBuilder();
     doc.append("title").append(WriteLineDocTask.SEP).append("date").append(WriteLineDocTask.SEP).append("body");
     writer.write(doc.toString());
     writer.newLine();

Modified: lucene/dev/branches/realtime_search/lucene/src/java/org/apache/lucene/index/DocumentsWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/src/java/org/apache/lucene/index/DocumentsWriter.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/src/java/org/apache/lucene/index/DocumentsWriter.java (original)
+++ lucene/dev/branches/realtime_search/lucene/src/java/org/apache/lucene/index/DocumentsWriter.java Fri Dec 24 01:30:44 2010
@@ -24,8 +24,6 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
 
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.document.Document;
@@ -119,7 +117,6 @@ final class DocumentsWriter {
 
   private final DocumentsWriterThreadPool threadPool;
   final IndexWriter indexWriter;
-  private final Lock sequenceIDLock = new ReentrantLock();
 
   private AtomicInteger numDocsInRAM = new AtomicInteger(0);
   private AtomicLong ramUsed = new AtomicLong(0);
@@ -344,15 +341,10 @@ final class DocumentsWriter {
     notifyAll();
   }
 
-  DocumentsWriterPerThread newDocumentsWriterPerThread() {
+  synchronized DocumentsWriterPerThread newDocumentsWriterPerThread() {
     DocumentsWriterPerThread perThread = new DocumentsWriterPerThread(directory, this, chain);
-    sequenceIDLock.lock();
-    try {
-      numDocumentsWriterPerThreads++;
-      return perThread;
-    } finally {
-      sequenceIDLock.unlock();
-    }
+    numDocumentsWriterPerThreads++;
+    return perThread;
   }
 
   boolean updateDocument(final Document doc, final Analyzer analyzer, final Term delTerm)
@@ -365,16 +357,13 @@ final class DocumentsWriter {
             long perThreadRAMUsedBeforeAdd = perThread.bytesUsed();
             perThread.addDocument(doc, analyzer);
 
-            sequenceIDLock.lock();
-            try {
+            synchronized(DocumentsWriter.this) {
               ensureOpen();
               if (delTerm != null) {
                 deleteTerm(delTerm, true);
               }
               perThread.commitDocument();
               numDocsInRAM.incrementAndGet();
-            } finally {
-              sequenceIDLock.unlock();
             }
 
             if (finishAddDocument(perThread, perThreadRAMUsedBeforeAdd)) {

Modified: lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/util/LuceneJUnitResultFormatter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/util/LuceneJUnitResultFormatter.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/util/LuceneJUnitResultFormatter.java (original)
+++ lucene/dev/branches/realtime_search/lucene/src/test/org/apache/lucene/util/LuceneJUnitResultFormatter.java Fri Dec 24 01:30:44 2010
@@ -35,6 +35,7 @@ import org.apache.tools.ant.taskdefs.opt
 import org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner;
 import org.apache.tools.ant.util.FileUtils;
 import org.apache.tools.ant.util.StringUtils;
+import org.junit.Ignore;
 
 /**
  * Just like BriefJUnitResultFormatter "brief" bundled with ant,
@@ -151,6 +152,18 @@ public class LuceneJUnitResultFormatter 
       .append(StringUtils.LINE_SEP);
     }
     
+    // HACK: junit gives us no way to do this in LuceneTestCase
+    try {
+      Class<?> clazz = Class.forName(suite.getName());
+      Ignore ignore = clazz.getAnnotation(Ignore.class);
+      if (ignore != null) {
+        if (systemError == null) systemError = "";
+        systemError += "NOTE: Ignoring test class '" + clazz.getSimpleName() + "': " 
+                    + ignore.value() + StringUtils.LINE_SEP;
+      }
+    } catch (ClassNotFoundException e) { /* no problem */ }
+    // END HACK
+    
     if (systemError != null && systemError.length() > 0) {
       append("------------- Standard Error -----------------")
       .append(StringUtils.LINE_SEP)

Modified: lucene/dev/branches/realtime_search/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/CHANGES.txt?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/CHANGES.txt (original)
+++ lucene/dev/branches/realtime_search/solr/CHANGES.txt Fri Dec 24 01:30:44 2010
@@ -26,7 +26,7 @@ Versions of Major Components
 ---------------------
 Apache Lucene trunk
 Apache Tika 0.8-SNAPSHOT
-Carrot2 3.1.0
+Carrot2 3.4.2
 Velocity 1.6.4 and Velocity Tools 2.0
 
 
@@ -572,6 +572,13 @@ Bug Fixes
 
 * SOLR-2285: duplicate SolrEventListeners no longer created (hossman)
 
+* SOLR-1993: fix String cast assumption in JavaBinCodec - specific
+  addresses "commitWithin" option on Update requests.
+  (noble, hossman, and Maxim Valyanskiy)
+
+* SOLR-2275: fix DisMax 'mm' parsing to be tolerant of whitespace
+  (Erick Erickson via hossman)
+
 Other Changes
 ----------------------
 
@@ -676,6 +683,8 @@ Other Changes
   
 * SOLR-2213: Upgrade to jQuery 1.4.3 (Erick Erickson via ryan)
 
+* SOLR-2289: Tweak spatial coords for example docs so they are a bit
+  more spread out (Erick Erickson via hossman)
 
 Build
 ----------------------
@@ -698,6 +707,9 @@ Documentation
 * SOLR-1792: Documented peculiar behavior of TestHarness.LocalRequestFactory
   (hossman)
 
+* SOLR-2232: Improved README info on solr.solr.home in examples
+  (Eric Pugh and hossman)
+
 ================== Release 1.4.0 ==================
 Release Date:  See http://lucene.apache.org/solr for the official release date.
 

Modified: lucene/dev/branches/realtime_search/solr/contrib/clustering/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/contrib/clustering/CHANGES.txt?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/contrib/clustering/CHANGES.txt (original)
+++ lucene/dev/branches/realtime_search/solr/contrib/clustering/CHANGES.txt Fri Dec 24 01:30:44 2010
@@ -6,7 +6,7 @@ See http://wiki.apache.org/solr/Clusteri
 
 CHANGES
 
-$Id:$
+$Id$
 
 ================== Release XXXX ==================
 
@@ -17,6 +17,9 @@ $Id:$
 * SOLR-1804: Re-enabled clustering on trunk, updated to latest version of Carrot2.  No more LGPL run-time dependencies.
   This release of C2 also does not have a specific Lucene dependency.  (Stanislaw Osinski, gsingers)
 
+* SOLR-2282: Add distributed search support for search result clustering.
+  (Brad Giaccio, koji)
+
 ================== Release 1.4.0 ==================
 
 Solr Clustering will be released for the first time in Solr 1.4.  See http://wiki.apache.org/solr/ClusteringComponent

Modified: lucene/dev/branches/realtime_search/solr/contrib/clustering/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/contrib/clustering/build.xml?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/contrib/clustering/build.xml (original)
+++ lucene/dev/branches/realtime_search/solr/contrib/clustering/build.xml Fri Dec 24 01:30:44 2010
@@ -44,6 +44,10 @@
     <pathelement location="${common-solr.dir}/build/tests"/> <!-- include solr test code -->
     <pathelement location="${common-solr.dir}/../lucene/build/classes/test" />  <!-- include some lucene test code -->
     <path refid="common.classpath"/>
+    <!-- DistributedClusteringComponentTest uses Jetty -->
+    <fileset dir="${solr-path}/example/lib">
+      <include name="**/*.jar" />
+    </fileset>
   </path>
 
   <target name="clean">

Modified: lucene/dev/branches/realtime_search/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/ClusteringComponent.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/ClusteringComponent.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/ClusteringComponent.java (original)
+++ lucene/dev/branches/realtime_search/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/ClusteringComponent.java Fri Dec 24 01:30:44 2010
@@ -16,14 +16,22 @@ package org.apache.solr.handler.clusteri
  * limitations under the License.
  */
 
+import org.apache.solr.common.SolrDocument;
+import org.apache.solr.common.SolrDocumentList;
+import org.apache.solr.common.params.CommonParams;
 import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.core.SolrResourceLoader;
 import org.apache.solr.handler.clustering.carrot2.CarrotClusteringEngine;
+import org.apache.solr.handler.clustering.carrot2.CarrotParams;
 import org.apache.solr.handler.component.ResponseBuilder;
 import org.apache.solr.handler.component.SearchComponent;
+import org.apache.solr.handler.component.ShardRequest;
+import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.search.DocListAndSet;
+import org.apache.solr.search.SolrIndexSearcher;
+import org.apache.solr.util.SolrPluginUtils;
 import org.apache.solr.util.plugin.SolrCoreAware;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -31,7 +39,9 @@ import org.slf4j.LoggerFactory;
 import java.io.IOException;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 
 
 /**
@@ -53,7 +63,7 @@ public class ClusteringComponent extends
   public static final String COMPONENT_NAME = "clustering";
   private NamedList initParams;
 
-
+  @Override
   public void prepare(ResponseBuilder rb) throws IOException {
     SolrParams params = rb.req.getParams();
     if (!params.getBool(COMPONENT_NAME, false)) {
@@ -61,18 +71,21 @@ public class ClusteringComponent extends
     }
   }
 
+  @Override
   public void process(ResponseBuilder rb) throws IOException {
     SolrParams params = rb.req.getParams();
     if (!params.getBool(COMPONENT_NAME, false)) {
       return;
     }
-    String name = params.get(ClusteringParams.ENGINE_NAME, ClusteringEngine.DEFAULT_ENGINE_NAME);
+    String name = getClusteringEngineName(rb);
     boolean useResults = params.getBool(ClusteringParams.USE_SEARCH_RESULTS, false);
     if (useResults == true) {
-      SearchClusteringEngine engine = searchClusteringEngines.get(name);
+      SearchClusteringEngine engine = getSearchClusteringEngine(rb);
       if (engine != null) {
         DocListAndSet results = rb.getResults();
-        Object clusters = engine.cluster(rb.getQuery(), results.docList, rb.req);
+        Map<SolrDocument,Integer> docIds = new HashMap<SolrDocument, Integer>(results.docList.size());
+        SolrDocumentList solrDocList = engine.getSolrDocumentList(results.docList, rb.req, docIds);
+        Object clusters = engine.cluster(rb.getQuery(), solrDocList, docIds, rb.req);
         rb.rsp.add("clusters", clusters);
       } else {
         log.warn("No engine for: " + name);
@@ -97,6 +110,72 @@ public class ClusteringComponent extends
       }
     }
   }
+  
+  private SearchClusteringEngine getSearchClusteringEngine(ResponseBuilder rb){
+    return searchClusteringEngines.get(getClusteringEngineName(rb));
+  }
+  
+  private String getClusteringEngineName(ResponseBuilder rb){
+    return rb.req.getParams().get(ClusteringParams.ENGINE_NAME, ClusteringEngine.DEFAULT_ENGINE_NAME);
+  }
+
+  @Override
+  public void modifyRequest(ResponseBuilder rb, SearchComponent who, ShardRequest sreq) {
+    SolrParams params = rb.req.getParams();
+    if (!params.getBool(COMPONENT_NAME, false) || !params.getBool(ClusteringParams.USE_SEARCH_RESULTS, false)) {
+      return;
+    }
+    sreq.params.remove(COMPONENT_NAME);
+    if( ( sreq.purpose & ShardRequest.PURPOSE_GET_FIELDS ) != 0 ){
+      String fl = sreq.params.get(CommonParams.FL,"*");
+      // if fl=* then we don't need check
+      if( fl.indexOf( '*' ) >= 0 ) return;
+      Set<String> fields = getSearchClusteringEngine(rb).getFieldsToLoad(rb.req);
+      if( fields == null || fields.size() == 0 ) return;
+      StringBuilder sb = new StringBuilder();
+      String[] flparams = fl.split( "[,\\s]+" );
+      Set<String> flParamSet = new HashSet<String>(flparams.length);
+      for( String flparam : flparams ){
+        // no need trim() because of split() by \s+
+        flParamSet.add(flparam);
+      }
+      for( String aFieldToLoad : fields ){
+        if( !flParamSet.contains( aFieldToLoad ) ){
+          sb.append( ',' ).append( aFieldToLoad );
+        }
+      }
+      if( sb.length() > 0 ){
+        sreq.params.set( CommonParams.FL, fl + sb.toString() );
+      }
+    }
+  }
+
+  @Override
+  public void finishStage(ResponseBuilder rb) {
+    SolrParams params = rb.req.getParams();
+    if (!params.getBool(COMPONENT_NAME, false) || !params.getBool(ClusteringParams.USE_SEARCH_RESULTS, false)) {
+      return;
+    }
+    if (rb.stage == ResponseBuilder.STAGE_GET_FIELDS) {
+      SearchClusteringEngine engine = getSearchClusteringEngine(rb);
+      if (engine != null) {
+        SolrDocumentList solrDocList = (SolrDocumentList)rb.rsp.getValues().get("response");
+        // TODO: Currently, docIds is set to null in distributed environment.
+        // This causes CarrotParams.PRODUCE_SUMMARY doesn't work.
+        // To work CarrotParams.PRODUCE_SUMMARY under distributed mode, we can choose either one of:
+        // (a) In each shard, ClusteringComponent produces summary and finishStage()
+        //     merges these summaries.
+        // (b) Adding doHighlighting(SolrDocumentList, ...) method to SolrHighlighter and
+        //     making SolrHighlighter uses "external text" rather than stored values to produce snippets.
+        Map<SolrDocument,Integer> docIds = null;
+        Object clusters = engine.cluster(rb.getQuery(), solrDocList, docIds, rb.req);
+        rb.rsp.add("clusters", clusters);
+      } else {
+        String name = getClusteringEngineName(rb);
+        log.warn("No engine for: " + name);
+      }
+    }
+  }
 
   @Override
   @SuppressWarnings("unchecked")
@@ -174,17 +253,17 @@ public class ClusteringComponent extends
 
   @Override
   public String getVersion() {
-    return "$Revision:$";
+    return "$Revision$";
   }
 
   @Override
   public String getSourceId() {
-    return "$Id:$";
+    return "$Id$";
   }
 
   @Override
   public String getSource() {
-    return "$URL:$";
+    return "$URL$";
   }
 
 }

Modified: lucene/dev/branches/realtime_search/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/SearchClusteringEngine.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/SearchClusteringEngine.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/SearchClusteringEngine.java (original)
+++ lucene/dev/branches/realtime_search/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/SearchClusteringEngine.java Fri Dec 24 01:30:44 2010
@@ -16,12 +16,16 @@ package org.apache.solr.handler.clusteri
  * limitations under the License.
  */
 
-import org.apache.solr.common.util.NamedList;
-import org.apache.solr.common.params.SolrParams;
-import org.apache.solr.core.SolrCore;
-import org.apache.solr.search.DocList;
-import org.apache.solr.request.SolrQueryRequest;
+import java.io.IOException;
+import java.util.Map;
+import java.util.Set;
+
 import org.apache.lucene.search.Query;
+import org.apache.solr.common.SolrDocument;
+import org.apache.solr.common.SolrDocumentList;
+import org.apache.solr.request.SolrQueryRequest;
+import org.apache.solr.search.DocList;
+import org.apache.solr.util.SolrPluginUtils;
 
 
 /**
@@ -30,8 +34,27 @@ import org.apache.lucene.search.Query;
  **/
 public abstract class SearchClusteringEngine extends ClusteringEngine {
 
-
+  @Deprecated
   public abstract Object cluster(Query query, DocList docList, SolrQueryRequest sreq);
 
-
+  // TODO: need DocList, too?
+  public abstract Object cluster(Query query, SolrDocumentList solrDocumentList,
+      Map<SolrDocument,Integer> docIds, SolrQueryRequest sreq);
+
+  /**
+   * Returns the set of field names to load.
+   * Concrete classes can override this method if needed.
+   * Default implementation returns null, that is, all stored fields are loaded.
+   * @param sreq
+   * @return set of field names to load
+   */
+  protected Set<String> getFieldsToLoad(SolrQueryRequest sreq){
+    return null;
+  }
+
+  public SolrDocumentList getSolrDocumentList(DocList docList, SolrQueryRequest sreq,
+      Map<SolrDocument, Integer> docIds) throws IOException{
+    return SolrPluginUtils.docListToSolrDocumentList(
+        docList, sreq.getSearcher(), getFieldsToLoad(sreq), docIds);
+  }
 }

Modified: lucene/dev/branches/realtime_search/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/carrot2/CarrotClusteringEngine.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/carrot2/CarrotClusteringEngine.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/carrot2/CarrotClusteringEngine.java (original)
+++ lucene/dev/branches/realtime_search/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/carrot2/CarrotClusteringEngine.java Fri Dec 24 01:30:44 2010
@@ -18,25 +18,38 @@ package org.apache.solr.handler.clusteri
  */
 
 import java.io.IOException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.lucene.document.FieldSelector;
-import org.apache.lucene.document.SetBasedFieldSelector;
 import org.apache.lucene.search.Query;
+import org.apache.solr.common.SolrDocument;
+import org.apache.solr.common.SolrDocumentList;
+import org.apache.solr.common.SolrException;
+import org.apache.solr.common.SolrException.ErrorCode;
 import org.apache.solr.common.params.HighlightParams;
 import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.common.util.SimpleOrderedMap;
-import org.apache.solr.common.SolrException;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.handler.clustering.SearchClusteringEngine;
 import org.apache.solr.highlight.SolrHighlighter;
 import org.apache.solr.request.LocalSolrQueryRequest;
 import org.apache.solr.request.SolrQueryRequest;
-import org.apache.solr.search.*;
-import org.apache.solr.util.RefCounted;
-import org.carrot2.core.*;
+import org.apache.solr.search.DocList;
+import org.apache.solr.search.DocSlice;
+import org.apache.solr.search.SolrIndexSearcher;
+import org.apache.solr.util.SolrPluginUtils;
+import org.carrot2.core.Cluster;
+import org.carrot2.core.Controller;
+import org.carrot2.core.ControllerFactory;
+import org.carrot2.core.Document;
+import org.carrot2.core.IClusteringAlgorithm;
 import org.carrot2.core.attribute.AttributeNames;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -63,11 +76,25 @@ public class CarrotClusteringEngine exte
 
   private String idFieldName;
 
+  @Deprecated
   public Object cluster(Query query, DocList docList, SolrQueryRequest sreq) {
+    SolrIndexSearcher searcher = sreq.getSearcher();
+    SolrDocumentList solrDocList;
+    try {
+      Map<SolrDocument,Integer> docIds = new HashMap<SolrDocument, Integer>(docList.size());
+      solrDocList = SolrPluginUtils.docListToSolrDocumentList( docList, searcher, getFieldsToLoad(sreq), docIds );
+      return cluster(query, solrDocList, docIds, sreq);
+    } catch (IOException e) {
+      throw new SolrException(ErrorCode.SERVER_ERROR, e);
+    }
+  }
+
+  public Object cluster(Query query, SolrDocumentList solrDocList,
+      Map<SolrDocument, Integer> docIds, SolrQueryRequest sreq) {
     try {
       // Prepare attributes for Carrot2 clustering call
       Map<String, Object> attributes = new HashMap<String, Object>();
-      List<Document> documents = getDocuments(docList, query, sreq);
+      List<Document> documents = getDocuments(solrDocList, docIds, query, sreq);
       attributes.put(AttributeNames.DOCUMENTS, documents);
       attributes.put(AttributeNames.QUERY, query.toString());
 
@@ -79,7 +106,7 @@ public class CarrotClusteringEngine exte
               clusteringAlgorithmClass).getClusters(), sreq.getParams());
     } catch (Exception e) {
       log.error("Carrot2 clustering failed", e);
-      throw new RuntimeException(e);
+      throw new SolrException(ErrorCode.SERVER_ERROR, "Carrot2 clustering failed", e);
     }
   }
 
@@ -114,31 +141,36 @@ public class CarrotClusteringEngine exte
     return result;
   }
 
-  /**
-   * Prepares Carrot2 documents for clustering.
-   */
-  private List<Document> getDocuments(DocList docList,
-                                      Query query, final SolrQueryRequest sreq) throws IOException {
-    SolrHighlighter highlighter = null;
+  @Override
+  protected Set<String> getFieldsToLoad(SolrQueryRequest sreq){
     SolrParams solrParams = sreq.getParams();
-    SolrCore core = sreq.getCore();
 
     // Names of fields to deliver content for clustering
     String urlField = solrParams.get(CarrotParams.URL_FIELD_NAME, "url");
     String titleField = solrParams.get(CarrotParams.TITLE_FIELD_NAME, "title");
-    String snippetField = solrParams.get(CarrotParams.SNIPPET_FIELD_NAME,
-            titleField);
+    String snippetField = solrParams.get(CarrotParams.SNIPPET_FIELD_NAME, titleField);
     if (StringUtils.isBlank(snippetField)) {
       throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, CarrotParams.SNIPPET_FIELD_NAME
               + " must not be blank.");
     }
-    Set<String> fieldsToLoad = Sets.newHashSet(urlField, titleField,
-            snippetField, idFieldName);
+    return Sets.newHashSet(urlField, titleField, snippetField, idFieldName);
+  }
+  
+  /**
+   * Prepares Carrot2 documents for clustering.
+   */
+  private List<Document> getDocuments(SolrDocumentList solrDocList, Map<SolrDocument, Integer> docIds,
+                                      Query query, final SolrQueryRequest sreq) throws IOException {
+    SolrHighlighter highlighter = null;
+    SolrParams solrParams = sreq.getParams();
+    SolrCore core = sreq.getCore();
 
+    String urlField = solrParams.get(CarrotParams.URL_FIELD_NAME, "url");
+    String titleField = solrParams.get(CarrotParams.TITLE_FIELD_NAME, "title");
+    String snippetField = solrParams.get(CarrotParams.SNIPPET_FIELD_NAME, titleField);
+    
     // Get the documents
-    DocIterator docsIter = docList.iterator();
-    boolean produceSummary = solrParams.getBool(CarrotParams.PRODUCE_SUMMARY,
-            false);
+    boolean produceSummary = solrParams.getBool(CarrotParams.PRODUCE_SUMMARY, false);
 
     SolrQueryRequest req = null;
     String[] snippetFieldAry = null;
@@ -164,20 +196,20 @@ public class CarrotClusteringEngine exte
       }
     }
 
-    SolrIndexSearcher searcher = sreq.getSearcher();
-    List<Document> result = new ArrayList<Document>(docList.size());
+    Iterator<SolrDocument> docsIter = solrDocList.iterator();
+    List<Document> result = new ArrayList<Document>(solrDocList.size());
 
     float[] scores = {1.0f};
     int[] docsHolder = new int[1];
     Query theQuery = query;
 
     while (docsIter.hasNext()) {
-      Integer id = docsIter.next();
-      org.apache.lucene.document.Document doc = searcher.doc(id,
-              fieldsToLoad);
-      String snippet = getValue(doc, snippetField);
-      if (produceSummary == true) {
-        docsHolder[0] = id.intValue();
+      SolrDocument sdoc = docsIter.next();
+      String snippet = getValue(sdoc, snippetField);
+      // TODO: docIds will be null when running distributed search.
+      // See comment in ClusteringComponent#finishStage().
+      if (produceSummary && docIds != null) {
+        docsHolder[0] = docIds.get(sdoc).intValue();
         DocList docAsList = new DocSlice(0, 1, docsHolder, scores, 1, 1.0f);
         NamedList highlights = highlighter.doHighlighting(docAsList, theQuery, req, snippetFieldAry);
         if (highlights != null && highlights.size() == 1) {//should only be one value given our setup
@@ -189,15 +221,16 @@ public class CarrotClusteringEngine exte
           }
         }
       }
-      Document carrotDocument = new Document(getValue(doc, titleField),
-              snippet, doc.get(urlField));
-      carrotDocument.setField("solrId", doc.get(idFieldName));
+      Document carrotDocument = new Document(getValue(sdoc, titleField),
+              snippet, (String)sdoc.getFieldValue(urlField));
+      carrotDocument.setField("solrId", sdoc.getFieldValue(idFieldName));
       result.add(carrotDocument);
     }
 
     return result;
   }
 
+  @Deprecated
   protected String getValue(org.apache.lucene.document.Document doc,
                             String field) {
     StringBuilder result = new StringBuilder();
@@ -211,6 +244,20 @@ public class CarrotClusteringEngine exte
     return result.toString().trim();
   }
 
+  protected String getValue(SolrDocument sdoc, String field) {
+    StringBuilder result = new StringBuilder();
+    Collection<Object> vals = sdoc.getFieldValues(field);
+    if(vals == null) return "";
+    Iterator<Object> ite = vals.iterator();
+    while(ite.hasNext()){
+      // Join multiple values with a period so that Carrot2 does not pick up
+      // phrases that cross field value boundaries (in most cases it would
+      // create useless phrases).
+      result.append((String)ite.next()).append(" . ");
+    }
+    return result.toString().trim();
+  }
+
   private List clustersToNamedList(List<Cluster> carrotClusters,
                                    SolrParams solrParams) {
     List result = new ArrayList();

Modified: lucene/dev/branches/realtime_search/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/carrot2/LuceneLanguageModelFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/carrot2/LuceneLanguageModelFactory.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/carrot2/LuceneLanguageModelFactory.java (original)
+++ lucene/dev/branches/realtime_search/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/carrot2/LuceneLanguageModelFactory.java Fri Dec 24 01:30:44 2010
@@ -31,7 +31,7 @@ import org.apache.lucene.analysis.tokena
 import org.carrot2.core.LanguageCode;
 import org.carrot2.text.analysis.ExtendedWhitespaceTokenizer;
 import org.carrot2.text.analysis.ITokenizer;
-import org.carrot2.text.linguistic.BaseLanguageModelFactory;
+import org.carrot2.text.linguistic.DefaultLanguageModelFactory;
 import org.carrot2.text.linguistic.IStemmer;
 import org.carrot2.text.linguistic.IdentityStemmer;
 import org.carrot2.text.util.MutableCharArray;
@@ -62,7 +62,7 @@ import org.tartarus.snowball.ext.Turkish
  * change, the changes can be made in this class.
  */
 @Bindable(prefix = "DefaultLanguageModelFactory")
-public class LuceneLanguageModelFactory extends BaseLanguageModelFactory {
+public class LuceneLanguageModelFactory extends DefaultLanguageModelFactory {
 	final static Logger logger = org.slf4j.LoggerFactory
 			.getLogger(LuceneLanguageModelFactory.class);
 

Modified: lucene/dev/branches/realtime_search/solr/contrib/clustering/src/test/java/org/apache/solr/handler/clustering/carrot2/CarrotClusteringEngineTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/contrib/clustering/src/test/java/org/apache/solr/handler/clustering/carrot2/CarrotClusteringEngineTest.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/contrib/clustering/src/test/java/org/apache/solr/handler/clustering/carrot2/CarrotClusteringEngineTest.java (original)
+++ lucene/dev/branches/realtime_search/solr/contrib/clustering/src/test/java/org/apache/solr/handler/clustering/carrot2/CarrotClusteringEngineTest.java Fri Dec 24 01:30:44 2010
@@ -22,6 +22,8 @@ import org.apache.lucene.search.MatchAll
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.Sort;
 import org.apache.lucene.search.TermQuery;
+import org.apache.solr.common.SolrDocument;
+import org.apache.solr.common.SolrDocumentList;
 import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.util.NamedList;
@@ -31,11 +33,14 @@ import org.apache.solr.request.LocalSolr
 import org.apache.solr.search.DocList;
 import org.apache.solr.search.SolrIndexSearcher;
 import org.apache.solr.util.RefCounted;
+import org.apache.solr.util.SolrPluginUtils;
 import org.carrot2.util.attribute.AttributeUtils;
 import org.junit.Test;
 
 import java.io.IOException;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import static org.junit.Assert.*;
 
@@ -133,21 +138,23 @@ public class CarrotClusteringEngineTest 
       docList = searcher.getDocList(query, (Query) null, new Sort(), 0,
               numberOfDocs);
       assertEquals("docList size", expectedNumDocs, docList.matches());
+
+      ModifiableSolrParams solrParams = new ModifiableSolrParams();
+      solrParams.add(CarrotParams.PRODUCE_SUMMARY, "true");
+      solrParams.add(clusteringParams);
+
+      // Perform clustering
+      LocalSolrQueryRequest req = new LocalSolrQueryRequest(h.getCore(), solrParams);
+      Map<SolrDocument,Integer> docIds = new HashMap<SolrDocument, Integer>(docList.size());
+      SolrDocumentList solrDocList = SolrPluginUtils.docListToSolrDocumentList( docList, searcher, engine.getFieldsToLoad(req), docIds );
+      List results = (List)engine.cluster(query, solrDocList, docIds, req);
+      req.close();
+      assertEquals("number of clusters: " + results, expectedNumClusters, results.size());
+      checkClusters(results, false);
+      return results;
     } finally {
       ref.decref();
     }
-
-    ModifiableSolrParams solrParams = new ModifiableSolrParams();
-    solrParams.add(CarrotParams.PRODUCE_SUMMARY, "true");
-    solrParams.add(clusteringParams);
-
-    // Perform clustering
-    LocalSolrQueryRequest req = new LocalSolrQueryRequest(h.getCore(), solrParams);
-    List results = (List) engine.cluster(query, docList, req);
-    req.close();
-    assertEquals("number of clusters: " + results, expectedNumClusters, results.size());
-    checkClusters(results, false);
-    return results;
   }
 
   private void checkClusters(List results, int expectedDocCount,

Modified: lucene/dev/branches/realtime_search/solr/example/README.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/example/README.txt?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/example/README.txt (original)
+++ lucene/dev/branches/realtime_search/solr/example/README.txt Fri Dec 24 01:30:44 2010
@@ -16,19 +16,20 @@
 Solr example configuration
 --------------------------
 
-To run this example configuration, use 
+To run the default example configuration, use 
 
   java -jar start.jar
 
-in this directory, and when Solr is started connect to 
+in this example directory, and when Solr is started connect to 
 
   http://localhost:8983/solr/admin/
 
-To add documents to the index, use the post.sh script in the exampledocs
-subdirectory (while Solr is running), for example:
+To add documents to the index, use the post.jar (or post.sh script) in
+the exampledocs subdirectory (while Solr is running), for example:
 
-  cd exampledocs
-  ./post.sh *.xml
+     cd exampledocs
+     java -jar post.jar *.xml
+Or:  ./post.sh *.xml
 
 See also README.txt in the solr subdirectory, and check
 http://wiki.apache.org/solr/SolrResources for a list of tutorials and
@@ -40,3 +41,10 @@ this example server and wish to use the 
 you will need to copy the required jars into solr/lib or update the paths to
 the jars in your solrconfig.xml.
 
+By default, start.jar starts Solr in Jetty using the default SolrHome 
+directory of "./solr/" -- To run other example configurations, you can
+speciy the solr.solr.home system property when starting jetty...
+
+  java -Dsolr.solr.home=multicore -jar start.jar
+  java -Dsolr.solr.home=example-DIH -jar start.jar
+

Modified: lucene/dev/branches/realtime_search/solr/example/exampledocs/ipod_other.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/example/exampledocs/ipod_other.xml?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/example/exampledocs/ipod_other.xml (original)
+++ lucene/dev/branches/realtime_search/solr/example/exampledocs/ipod_other.xml Fri Dec 24 01:30:44 2010
@@ -29,7 +29,7 @@
   <field name="popularity">1</field>
   <field name="inStock">false</field>
   <!-- Buffalo store -->
-  <field name="store">45.17614,-93.87341</field>
+  <field name="store">45.18014,-93.87741</field>
   <field name="manufacturedate_dt">2005-08-01T16:30:25Z</field>
 </doc>
 

Modified: lucene/dev/branches/realtime_search/solr/example/exampledocs/mem.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/example/exampledocs/mem.xml?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/example/exampledocs/mem.xml (original)
+++ lucene/dev/branches/realtime_search/solr/example/exampledocs/mem.xml Fri Dec 24 01:30:44 2010
@@ -61,7 +61,7 @@
   <field name="popularity">0</field>
   <field name="inStock">true</field>
   <!-- Buffalo store -->
-  <field name="store">45.17614,-93.87341</field>
+  <field name="store">45.18414,-93.88141</field>
   <field name="manufacturedate_dt">2006-02-13T15:26:37Z</field>
 
   <field name="payloads">electronics|0.9 memory|0.1</field>

Modified: lucene/dev/branches/realtime_search/solr/example/exampledocs/monitor2.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/example/exampledocs/monitor2.xml?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/example/exampledocs/monitor2.xml (original)
+++ lucene/dev/branches/realtime_search/solr/example/exampledocs/monitor2.xml Fri Dec 24 01:30:44 2010
@@ -27,6 +27,6 @@
   <field name="popularity">6</field>
   <field name="inStock">true</field>
   <!-- Buffalo store -->
-  <field name="store">45.17614,-93.87341</field>
+  <field name="store">45.18814,-93.88541</field>
 </doc></add>
 

Modified: lucene/dev/branches/realtime_search/solr/example/exampledocs/mp500.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/example/exampledocs/mp500.xml?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/example/exampledocs/mp500.xml (original)
+++ lucene/dev/branches/realtime_search/solr/example/exampledocs/mp500.xml Fri Dec 24 01:30:44 2010
@@ -36,6 +36,6 @@
   <field name="popularity">6</field>
   <field name="inStock">true</field>
   <!-- Buffalo store -->
-  <field name="store">45.17614,-93.87341</field>
+  <field name="store">45.19214,-93.89941</field>
 </doc></add>
 

Modified: lucene/dev/branches/realtime_search/solr/example/exampledocs/sd500.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/example/exampledocs/sd500.xml?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/example/exampledocs/sd500.xml (original)
+++ lucene/dev/branches/realtime_search/solr/example/exampledocs/sd500.xml Fri Dec 24 01:30:44 2010
@@ -32,5 +32,5 @@
   <field name="inStock">true</field>
   <field name="manufacturedate_dt">2006-02-13T15:26:37Z</field>
   <!-- Buffalo store -->
-  <field name="store">45.17614,-93.87341</field>
+  <field name="store">45.19614,-93.90341</field>
 </doc></add>

Modified: lucene/dev/branches/realtime_search/solr/example/multicore/README.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/example/multicore/README.txt?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/example/multicore/README.txt (original)
+++ lucene/dev/branches/realtime_search/solr/example/multicore/README.txt Fri Dec 24 01:30:44 2010
@@ -1,3 +1,7 @@
 This is an alternative setup structure to support multiple cores.
 
-For general examples on standard solr configuration, see the "solr" directory.
\ No newline at end of file
+To run this configuration, start jetty in the example/ directory using:
+
+java -Dsolr.solr.home=multicore -jar start.jar
+
+For general examples on standard solr configuration, see the "solr" directory.

Modified: lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/util/SolrPluginUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/util/SolrPluginUtils.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/util/SolrPluginUtils.java (original)
+++ lucene/dev/branches/realtime_search/solr/src/java/org/apache/solr/util/SolrPluginUtils.java Fri Dec 24 01:30:44 2010
@@ -608,6 +608,11 @@ public class SolrPluginUtils {
     }
   }
 
+  // private static Pattern spaceAroundLessThanPattern = Pattern.compile("\\s*<\\s*");
+  private static Pattern spaceAroundLessThanPattern = Pattern.compile("(\\s+<\\s*)|(\\s*<\\s+)");
+  private static Pattern spacePattern = Pattern.compile(" ");
+  private static Pattern lessThanPattern = Pattern.compile("<");
+
   /**
    * helper exposed for UnitTests
    * @see #setMinShouldMatch
@@ -615,14 +620,14 @@ public class SolrPluginUtils {
   static int calculateMinShouldMatch(int optionalClauseCount, String spec) {
 
     int result = optionalClauseCount;
-
+    spec = spec.trim();
 
     if (-1 < spec.indexOf("<")) {
       /* we have conditional spec(s) */
-
-      for (String s : spec.trim().split(" ")) {
-        String[] parts = s.split("<");
-        int upperBound = (new Integer(parts[0])).intValue();
+      spec = spaceAroundLessThanPattern.matcher(spec).replaceAll("<");
+      for (String s : spacePattern.split(spec)) {
+        String[] parts = lessThanPattern.split(s,0);
+        int upperBound = Integer.parseInt(parts[0]);
         if (optionalClauseCount <= upperBound) {
           return result;
         } else {
@@ -635,13 +640,14 @@ public class SolrPluginUtils {
 
     /* otherwise, simple expresion */
 
-    if (-1 < spec.indexOf("%")) {
-      /* percentage */
-      int percent = new Integer(spec.replace("%","")).intValue();
-      float calc = (result * percent) / 100f;
+    if (-1 < spec.indexOf('%')) {
+      /* percentage - assume the % was the last char.  If not, let Integer.parseInt fail. */
+      spec = spec.substring(0,spec.length()-1);
+      int percent = Integer.parseInt(spec);
+      float calc = (result * percent) * (1/100f);
       result = calc < 0 ? result + (int)calc : (int)calc;
     } else {
-      int calc = (new Integer(spec)).intValue();
+      int calc = Integer.parseInt(spec);
       result = calc < 0 ? result + calc : calc;
     }
 

Modified: lucene/dev/branches/realtime_search/solr/src/solrj/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/src/solrj/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/src/solrj/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java (original)
+++ lucene/dev/branches/realtime_search/solr/src/solrj/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java Fri Dec 24 01:30:44 2010
@@ -128,7 +128,7 @@ public class JavaBinUpdateRequestCodec {
 
       private List readOuterMostDocIterator(FastInputStream fis) throws IOException {
         NamedList params = (NamedList) namedList[0].getVal(0);
-        updateRequest.setParams(namedListToSolrParams(params));
+        updateRequest.setParams(new ModifiableSolrParams(SolrParams.toSolrParams(params)));
         if (handler == null) return super.readIterator(fis);
         while (true) {
           Object o = readVal(fis);
@@ -207,17 +207,6 @@ public class JavaBinUpdateRequestCodec {
     return nl;
   }
 
-  private ModifiableSolrParams namedListToSolrParams(NamedList nl) {
-    ModifiableSolrParams solrParams = new ModifiableSolrParams();
-    for (int i = 0; i < nl.size(); i++) {
-      List<String> l = (List) nl.getVal(i);
-      if (l != null)
-        solrParams.add(nl.getName(i),
-                l.toArray(new String[l.size()]));
-    }
-    return solrParams;
-  }
-
   public static interface StreamingDocumentHandler {
     public void document(SolrInputDocument document, UpdateRequest req);
   }

Modified: lucene/dev/branches/realtime_search/solr/src/test/org/apache/solr/util/SolrPluginUtilsTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/solr/src/test/org/apache/solr/util/SolrPluginUtilsTest.java?rev=1052425&r1=1052424&r2=1052425&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/solr/src/test/org/apache/solr/util/SolrPluginUtilsTest.java (original)
+++ lucene/dev/branches/realtime_search/solr/src/test/org/apache/solr/util/SolrPluginUtilsTest.java Fri Dec 24 01:30:44 2010
@@ -296,11 +296,11 @@ public class SolrPluginUtilsTest extends
     /* zero is zero is zero */
     assertEquals(0, calcMSM(5, "0"));
     assertEquals(0, calcMSM(5, "0%"));
-    assertEquals(0, calcMSM(5, "-5"));
-    assertEquals(0, calcMSM(5, "-100%"));
+    assertEquals(0, calcMSM(5, " -5 "));
+    assertEquals(0, calcMSM(5, "\n -100% \n"));
 
     /* basic integers */
-    assertEquals(3, calcMSM(5, "3"));
+    assertEquals(3, calcMSM(5, " \n3\n "));
     assertEquals(2, calcMSM(5, "-3"));
     assertEquals(3, calcMSM(3, "3"));
     assertEquals(0, calcMSM(3, "-3"));
@@ -308,13 +308,13 @@ public class SolrPluginUtilsTest extends
     assertEquals(0, calcMSM(3, "-5"));
 
     /* positive percentages with rounding */
-    assertEquals(0, calcMSM(3, "25%"));
+    assertEquals(0, calcMSM(3, " \n25% \n"));
     assertEquals(1, calcMSM(4, "25%"));
-    assertEquals(1, calcMSM(5, "25%"));
+    assertEquals(1, calcMSM(5, " 25% "));
     assertEquals(2, calcMSM(10, "25%"));
         
     /* negative percentages with rounding */
-    assertEquals(3, calcMSM(3, "-25%"));
+    assertEquals(3, calcMSM(3, " \n-25%\n "));
     assertEquals(3, calcMSM(4, "-25%"));
     assertEquals(4, calcMSM(5, "-25%"));
     assertEquals(8, calcMSM(10, "-25%"));
@@ -326,22 +326,22 @@ public class SolrPluginUtilsTest extends
     assertEquals(0, calcMSM(4, "3<0"));
     assertEquals(0, calcMSM(5, "3<0"));
     assertEquals(1, calcMSM(1, "3<25%"));
-    assertEquals(2, calcMSM(2, "3<25%"));
+    assertEquals(2, calcMSM(2, " 3\n<\n25% "));
     assertEquals(3, calcMSM(3, "3<25%"));
-    assertEquals(1, calcMSM(4, "3<25%"));
+    assertEquals(1, calcMSM(4, "\n 3 < \n25%\n "));
     assertEquals(1, calcMSM(5, "3<25%"));
 
     /* multiple conditionals */
-    assertEquals(1, calcMSM(1, "3<-25% 10<-3"));
-    assertEquals(2, calcMSM(2, "3<-25% 10<-3"));
-    assertEquals(3, calcMSM(3, "3<-25% 10<-3"));
-    assertEquals(3, calcMSM(4, "3<-25% 10<-3"));
-    assertEquals(4, calcMSM(5, "3<-25% 10<-3"));
+    assertEquals(1, calcMSM(1, "\n3 < -25% 10 < -3 \n"));
+    assertEquals(2, calcMSM(2, " 3 < -25% 10 < -3\n"));
+    assertEquals(3, calcMSM(3, " 3 < -25% \n 10 < -3 \n"));
+    assertEquals(3, calcMSM(4, " 3 < -25% 10 < -3 "));
+    assertEquals(4, calcMSM(5, " 3 < -25% 10 < -3"));
     assertEquals(5, calcMSM(6, "3<-25% 10<-3"));
-    assertEquals(6, calcMSM(7, "3<-25% 10<-3"));
-    assertEquals(6, calcMSM(8, "3<-25% 10<-3"));
-    assertEquals(7, calcMSM(9, "3<-25% 10<-3"));
-    assertEquals(8, calcMSM(10, "3<-25% 10<-3"));
+    assertEquals(6, calcMSM(7, " 3 < -25% 10 < -3 "));
+    assertEquals(6, calcMSM(8, " 3 < -25% 10 \n < -3\n"));
+    assertEquals(7, calcMSM(9, " 3 < -25% 10 < -3 \n"));
+    assertEquals(8, calcMSM(10, " 3 < -25% 10 < -3"));
     assertEquals(8, calcMSM(11, "3<-25% 10<-3"));
     assertEquals(9, calcMSM(12, "3<-25% 10<-3"));
     assertEquals(97, calcMSM(100, "3<-25% 10<-3"));



Mime
View raw message