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

svn commit: r1073192 [3/32] - in /lucene/dev/branches/realtime_search: ./ dev-tools/eclipse/ dev-tools/idea/.idea/ dev-tools/idea/lucene/contrib/ant/ dev-tools/idea/lucene/contrib/demo/ dev-tools/idea/lucene/contrib/highlighter/ dev-tools/idea/lucene/c...

Modified: lucene/dev/branches/realtime_search/lucene/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/build.xml?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/build.xml (original)
+++ lucene/dev/branches/realtime_search/lucene/build.xml Tue Feb 22 01:00:39 2011
@@ -17,7 +17,8 @@
     limitations under the License.
  -->
 
-<project name="core" default="default" basedir=".">
+<project name="core" default="default" basedir="."
+         xmlns:artifact="antlib:org.apache.maven.artifact.ant">
 
   <property name="junit.includes" value="**/Test*.java"/>
 
@@ -32,12 +33,13 @@
   	<path refid="classpath"/>
     <path refid="junit-path"/>
     <path refid="ant-path"/>
+    <pathelement location="${build.dir}/classes/test-framework"/>
     <pathelement location="${build.dir}/classes/test"/>
   </path>
 
-
   <path id="junit.classpath">
     <path refid="junit-path"/>
+    <pathelement location="${build.dir}/classes/test-framework"/>
     <pathelement location="${build.dir}/classes/test"/>
     <pathelement location="${build.dir}/classes/java"/>
     <pathelement path="${java.class.path}"/>
@@ -48,7 +50,7 @@
               excludes="contrib/db/*/lib/,contrib/*/ext-libs/,src/site/build/"
   />
   <patternset id="binary.build.dist.patterns"
-              includes="${final.name}.jar,docs/,contrib/*/*.jar,contrib/*/*.war, contrib/*/*/*.jar"
+              includes="${final.name}*.jar,docs/,contrib/*/*.jar,contrib/*/*.war, contrib/*/*/*.jar"
   />
   <patternset id="binary.root.dist.patterns"
               includes="docs/,*.txt,contrib/*/README*,**/CHANGES.txt"
@@ -153,7 +155,7 @@
   </target>
 
   <target name="javadocs" description="Generate javadoc" 
-          depends="javadocs-all, javadocs-core, javadocs-contrib">
+          depends="javadocs-all, javadocs-core, javadocs-contrib, javadocs-test-framework">
     <echo file="${javadoc.dir}/index.html" append="false">
 <![CDATA[<html><head><title>${Name} ${version} Javadoc Index</title></head>
 <body>
@@ -259,7 +261,7 @@
   <!-- ================================================================== -->
   <!--                                                                    -->
   <!-- ================================================================== -->
-  <target name="package" depends="jar-core, javadocs, build-contrib, init-dist, changes-to-html"/>
+  <target name="package" depends="jar-core, jar-test-framework, javadocs, build-contrib, init-dist, changes-to-html"/>
 
   <target name="nightly" depends="test, package-tgz">
   </target>
@@ -389,9 +391,10 @@
 
   <target name="dist-all" depends="dist, dist-src"/>
 
-  <target name="generate-maven-artifacts" depends="maven.ant.tasks-check, package, jar-src, javadocs">
+  <target name="generate-maven-artifacts"
+          depends="maven.ant.tasks-check, package, jar-src, jar-test-framework-src, javadocs">
     <sequential>
-	  <ant target="get-maven-poms" inheritAll="false" dir=".."/>
+	  <ant target="get-maven-poms" dir=".."/>
  
       <m2-deploy pom.xml="../pom.xml"/> <!-- Lucene/Solr grandparent POM -->
       <m2-deploy pom.xml="pom.xml"/>    <!-- Lucene parent POM -->
@@ -403,6 +406,37 @@
                   classifier="javadoc"/>
         </artifact-attachments>
       </m2-deploy>
+
+      <!--
+        For the purposes of the generated artifacts, change the <packaging>
+        in the test-framework POM from "jar" to "test-jar" - this allows
+        artifact:deploy to properly name the artifact.  The Maven build doesn't
+        have a lifecycle mapping for the "test-jar" packaging, though, so the
+        POM in src/test-framework/ is left with the "jar" packaging.
+      -->
+      <property name="test-jar-packaging-test-framework-pom"
+                location="${build.dir}/test-jar-packaging-test-framework,pom"/>
+      <copy file="src/test-framework/pom.xml"
+            tofile="${test-jar-packaging-test-framework-pom}">
+        <filterset begintoken="&lt;packaging&gt;" endtoken="&lt;/packaging&gt;">
+          <filter token="jar"
+                  value="&lt;packaging&gt;test-jar&lt;/packaging&gt;"/>
+        </filterset>
+      </copy>
+      <artifact:pom id="test-framework-pom"
+                    file="${test-jar-packaging-test-framework-pom}"/>
+      <artifact:deploy file="${build.dir}/${final.name}-tests.jar">
+        <attach file="${build.dir}/${final.name}-tests-src.jar"
+                classifier="test-sources"/>
+        <attach file="${build.dir}/${final.name}-tests-javadoc.jar"
+                classifier="test-javadoc"/>
+        <remoteRepository url="${m2.repository.url}">
+          <authentication username="${m2.repository.username}"
+                          privateKey="${m2.repository.private.key}"/>
+        </remoteRepository>
+        <pom refid="test-framework-pom"/>
+      </artifact:deploy>
+
       <contrib-crawl target="dist-maven"/>
     </sequential>
   </target>
@@ -463,9 +497,6 @@
       <fileset dir="contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/parser" includes="*.java">
         <containsregexp expression="Generated.*By.*JavaCC"/>
       </fileset>
-      <fileset dir="contrib/demo/src/java/org/apache/lucene/demo/html" includes="*.java">
-        <containsregexp expression="Generated.*By.*JavaCC"/>
-      </fileset>
     </delete>
   </target>
 
@@ -600,20 +631,30 @@
     <patch patchfile="${patch.file}" strip="0"/>
   </target>
 
-  <target name="rat-sources-typedef">
-    <typedef resource="org/apache/rat/anttasks/antlib.xml" uri="antlib:rat.anttasks">
-      <classpath>
-        <fileset dir="." includes="rat*.jar"/>
-      </classpath>
-    </typedef>
+  <target name="jar-test-framework" depends="compile-test-framework">
+    <jarify basedir="${build.dir}/classes/test-framework" destfile="${build.dir}/${final.name}-tests.jar"
+            title="Lucene Search Engine: Test Framework" />
   </target>
 
-  <target name="rat-sources" depends="rat-sources-typedef"
-	  description="runs the tasks over src/java">
-    <rat:report xmlns:rat="antlib:org.apache.rat.anttasks">
-      <fileset dir="src/java">
-      </fileset>
-    </rat:report>
+  <target name="javadocs-test-framework">
+	<sequential>
+      <mkdir dir="${javadoc.dir}/test-framework"/>
+      <invoke-javadoc
+          destdir="${javadoc.dir}/test-framework"
+          title="${Name} ${version} Test Framework API">
+        <sources>
+          <packageset dir="src/test-framework"/>
+          <link href=""/>
+        </sources>
+      </invoke-javadoc>
+      <jarify basedir="${javadoc.dir}/test-framework" destfile="${build.dir}/${final.name}-tests-javadoc.jar"
+	          title="Lucene Search Engine: Test Framework" />
+    </sequential>
+  </target>
+
+  <target name="jar-test-framework-src" depends="init">
+    <jarify basedir="${tests-framework.src.dir}" destfile="${build.dir}/${final.name}-tests-src.jar"
+            title="Lucene Search Engine: Test Framework" />
   </target>
 
 </project>

Modified: lucene/dev/branches/realtime_search/lucene/common-build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/common-build.xml?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/common-build.xml (original)
+++ lucene/dev/branches/realtime_search/lucene/common-build.xml Tue Feb 22 01:00:39 2011
@@ -25,6 +25,9 @@
 
   <dirname file="${ant.file.common}" property="common.dir"/>
 
+  <property name="dev-tools.dir" value="${common.dir}/../dev-tools"/>
+  <property name="prettify.dir" value="${dev-tools.dir}/prettify"/>
+
   <!-- Give user a chance to override without editing this file
       (and without typing -D each time it compiles it -->
   <property file="${user.home}/lucene.build.properties"/>
@@ -110,6 +113,7 @@
 
   <property name="src.dir" location="src/java"/>
   <property name="tests.src.dir" location="src/test"/>
+  <property name="tests-framework.src.dir" location="${common.dir}/src/test-framework"/>
   <property name="build.dir" location="build"/>
   <property name="dist.dir" location="dist"/>
   <property name="maven.dist.dir" location="dist/maven"/>
@@ -360,6 +364,8 @@
   <macrodef name="jarify" description="Builds a JAR file">
   	<attribute name="basedir" default="${build.dir}/classes/java"/>
   	<attribute name="destfile" default="${build.dir}/${final.name}.jar"/>
+  	<attribute name="title" default="Lucene Search Engine: ${ant.project.name}"/>
+    <attribute name="excludes" default="**/pom.xml"/>
     <element name="manifest-attributes" optional="yes"/>
   	<element name="metainf-includes" optional="yes"/>
     <sequential>
@@ -369,12 +375,13 @@
         <arg line="."/>
       </exec>
       
-      <build-manifest/>
+      <build-manifest title="@{title}"/>
     	
       <jar
         destfile="@{destfile}"
         basedir="@{basedir}"
-      	manifest="${manifest.file}">
+      	manifest="${manifest.file}"
+        excludes="@{excludes}">
         <manifest>
         	<manifest-attributes/>
         </manifest>
@@ -387,7 +394,12 @@
     </sequential>
   </macrodef>
 
-  <target name="compile-test" depends="compile-core">
+  <target name="compile-test-framework" depends="compile-core">
+  	<compile-test-macro srcdir="${tests-framework.src.dir}" destdir="${common.dir}/build/classes/test-framework"
+  						test.classpath="test.classpath"/>
+  </target>
+
+  <target name="compile-test" depends="compile-test-framework">
   	<compile-test-macro srcdir="${tests.src.dir}" destdir="${build.dir}/classes/test"
   						test.classpath="test.classpath"/>
   </target>
@@ -550,6 +562,9 @@
       <fileset dir="${src.dir}">
         <include name="org/apache/**/*.java" />
       </fileset>
+      <testsources dir="${tests-framework.src.dir}">
+        <include name="org/apache/**/*.java" />
+      </testsources>
       <testsources dir="${tests.src.dir}">
         <include name="org/apache/**/*.java" />
       </testsources>
@@ -580,6 +595,9 @@
     <fileset dir="contrib" id="clover.contrib.test.src.files">
       <include name="**/test/**/*.java"/>
     </fileset>
+    <fileset dir="${tests-framework.src.dir}" id="clover.test.src.files">
+      <include name="**/*.java" />
+    </fileset>
     <fileset dir="${tests.src.dir}" id="clover.test.src.files">
       <include name="**/*.java" />
     </fileset>
@@ -638,6 +656,23 @@
 
   <target name="default" depends="jar-core"/>
 
+  <target name="rat-sources-typedef">
+    <typedef resource="org/apache/rat/anttasks/antlib.xml" uri="antlib:rat.anttasks">
+      <classpath>
+        <fileset dir="." includes="rat*.jar"/>
+      </classpath>
+    </typedef>
+  </target>
+
+  <target name="rat-sources" depends="rat-sources-typedef"
+	  description="runs the tasks over source and test files">
+    <rat:report xmlns:rat="antlib:org.apache.rat.anttasks">
+      <fileset dir="${src.dir}"/>
+      <fileset dir="${tests-framework.src.dir}"/>
+      <fileset dir="${tests.src.dir}"/>
+    </rat:report>
+  </target>
+
   <!--+
       | M A C R O S
       +-->
@@ -693,6 +728,9 @@
     <attribute name="destdir"/>
   	<attribute name="title" default="${Name} ${version} API"/>
     <sequential>
+      <copy todir="@{destdir}/../prettify" overwrite="false">
+        <fileset dir="${prettify.dir}"/>
+      </copy>
       <javadoc
           overview="${src.dir}/overview.html"
           packagenames="org.apache.lucene.*"
@@ -708,6 +746,7 @@
           link="${javadoc.link}"
           windowtitle="${Name} ${version} API"
           doctitle="@{title}"
+          stylesheetfile="@{destdir}/../prettify/stylesheet+prettify.css"
           maxmemory="${javadoc.maxmemory}"
           bottom="Copyright &amp;copy; ${year} Apache Software Foundation.  All Rights Reserved.">
         <tag name="lucene.experimental" 
@@ -715,6 +754,10 @@
         <tag name="lucene.internal"
         description="NOTE: This API is for Lucene internal purposes only and might change in incompatible ways in the next release."/>
       	<link offline="true" packagelistLoc="${javadoc.dir}"/>
+        <header><![CDATA[
+           <script src="{@docRoot}/../prettify/prettify.js" type="text/javascript"></script>
+           <script language="JavaScript">window.onload=function(){windowTitle();prettyPrint();}</script>
+        ]]></header>
       	
       	<sources />
       	      	

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=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/CHANGES.txt (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/CHANGES.txt Tue Feb 22 01:00:39 2011
@@ -38,6 +38,11 @@ API Changes
  * LUCENE-2638 MakeHighFreqTerms.TermStats public to make it more useful
    for API use. (Andrzej Bialecki)
 
+ * LUCENE-2912: The field-specific hashmaps in SweetSpotSimilarity were removed.
+   Instead, use SimilarityProvider to return different SweetSpotSimilaritys
+   for different fields, this way all parameters (such as TF factors) can be 
+   customized on a per-field basis.  (Robert Muir)
+
 ======================= Lucene 3.x (not yet released) =======================
 
 Changes in backwards compatibility policy
@@ -188,6 +193,9 @@ API Changes
  * LUCENE-2830: Use StringBuilder instead of StringBuffer across Benchmark, and
    remove the StringBuffer HtmlParser.parse() variant. (Shai Erera)
    
+ * LUCENE-2920: Deprecated ShingleMatrixFilter as it is unmaintained and does
+   not work with custom Attributes or custom payload encoders.  (Uwe Schindler)
+   
 New features
 
  * LUCENE-2500: Added DirectIOLinuxDirectory, a Linux-specific

Modified: lucene/dev/branches/realtime_search/lucene/contrib/contrib-build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/contrib-build.xml?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/contrib-build.xml (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/contrib-build.xml Tue Feb 22 01:00:39 2011
@@ -40,6 +40,7 @@
   
   <path id="test.base.classpath">
     <path refid="classpath"/>
+    <pathelement location="${common.dir}/build/classes/test-framework"/>
     <pathelement location="${common.dir}/build/classes/test"/>
     <path refid="junit-path"/>
     <pathelement location="${build.dir}/classes/java"/>
@@ -50,7 +51,6 @@
   <path id="junit.classpath">
     <path refid="test.classpath"/>
     <pathelement location="${build.dir}/classes/test"/>
-    <pathelement location="${build.dir}/classes/java"/>
     <pathelement path="${java.class.path}"/>
   </path>
 

Modified: lucene/dev/branches/realtime_search/lucene/contrib/db/bdb-je/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/db/bdb-je/build.xml?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/db/bdb-je/build.xml (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/db/bdb-je/build.xml Tue Feb 22 01:00:39 2011
@@ -39,13 +39,6 @@
 	
   <import file="../../contrib-build.xml" />
 
-  <path id="test.classpath">
-    <path refid="classpath"/>
-    <pathelement location="../../../build/classes/test/"/>
-    <path refid="junit-path"/>
-    <pathelement location="${build.dir}/classes/java"/>
-  </path>
-
   <target name="get-je-jar" unless="je.jar.exists">
     <mkdir dir="lib" />
     <get src="http://download.oracle.com/maven/com/sleepycat/je/${je.version}/je-${je.version}.jar"

Modified: lucene/dev/branches/realtime_search/lucene/contrib/db/bdb/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/db/bdb/build.xml?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/db/bdb/build.xml (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/db/bdb/build.xml Tue Feb 22 01:00:39 2011
@@ -39,13 +39,6 @@
 
   <import file="../../contrib-build.xml" />
 
-  <path id="test.classpath">
-    <path refid="classpath"/>
-    <pathelement location="../../../build/classes/test/"/>
-    <path refid="junit-path"/>
-    <pathelement location="${build.dir}/classes/java"/>
-  </path>
-
   <target name="get-db-jar" unless="db.jar.exists">
     <mkdir dir="lib" />
     <get src="http://downloads.osafoundation.org/db/db-${db.version}.jar"

Modified: lucene/dev/branches/realtime_search/lucene/contrib/demo/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/demo/build.xml?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/demo/build.xml (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/demo/build.xml Tue Feb 22 01:00:39 2011
@@ -17,81 +17,40 @@
     limitations under the License.
  -->
 
-<project name="demo" default="default" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+<project name="demo" default="jar-core" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
 
   <description>
     Lucene Demo
   </description>
 
-  <property name="build.demo.template" value="src/java/demo-build.template"/> 
-
   <property name="demo.name" value="lucene-demos-${version}"/>
-  <property name="demo.war.name" value="luceneweb"/>
 
   <import file="../contrib-build.xml"/>
 
   <module-uptodate name="analysis/common" jarfile="${common.dir}/../modules/analysis/build/common/lucene-analyzers-common-${version}.jar"
       property="analyzers-common.uptodate" classpath.property="analyzers-common.jar"/>
-
+  
+  <property name="lucene.jar" value="${common.dir}/build/lucene-core-${version}.jar"/>
+  <target name="lucene-jar-uptodate" unless="lucene.jar.uptodate">
+    <uptodate property="lucene.jar.uptodate" targetfile="${lucene.jar}">
+     	<srcfiles dir="${common.dir}/src/java" includes="**/*.java"/>
+    </uptodate>
+  </target>
+  <target name="jar-lucene" depends="build-lucene" unless="lucene.jar.uptodate">
+    <ant dir="${common.dir}" target="jar-core" inheritAll="false"/>
+  </target>
+  <target name="init" depends="contrib-build.init,lucene-jar-uptodate,jar-lucene"/>
+  
   <path id="classpath">
 	 <pathelement path="${analyzers-common.jar}"/>
-	 <path refid="base.classpath"/>
+   <pathelement path="${lucene.jar}"/>
   </path>
 
-  <target name="compile-core" depends="compile-analyzers-common, common.compile-core, war-demo" />
+  <target name="compile-core" depends="jar-analyzers-common,common.compile-core" />
 
-  <target name="compile-analyzers-common" unless="analyzers-common.uptodate">
-    <subant target="default">
+  <target name="jar-analyzers-common" unless="analyzers-common.uptodate">
+    <subant target="jar-core">
       <fileset dir="${common.dir}/../modules/analysis/common" includes="build.xml"/>
     </subant>
   </target>
-
-  <target name="war-demo">
-    <sequential>
-      <build-manifest title="Lucene Search Engine: demos"/>
-  	  <war destfile="${build.dir}/${demo.war.name}.war"
-           webxml="src/jsp/WEB-INF/web.xml"
-      	   manifest="${manifest.file}">
-        <fileset dir="src/jsp" excludes="WEB-INF/web.xml"/>
-        <lib dir="${build.dir}/../.." includes="lucene-core-${version}.jar"/>
-  	  	<lib dir="${common.dir}/../modules/analysis/build/common" includes="lucene-analyzers-common-${version}.jar"/>
-        <lib dir="${build.dir}" includes="${final.name}.jar"/>
-        <metainf dir="${common.dir}">
-          <include name="LICENSE.txt"/>
-          <include name="NOTICE.txt"/>
-        </metainf>
-      </war>
-    </sequential>
-  </target>
-	
-  <target name="clean-javacc">
-    <fileset dir="src/java/org/apache/lucene/demo/html" includes="*.java">
-      <containsregexp expression="Generated.*By.*JavaCC"/>
-    </fileset>
-  </target>
-	
-  <target name="javacc" depends="init,javacc-check" if="javacc.present">
-    <invoke-javacc target="src/java/org/apache/lucene/demo/html/HTMLParser.jj"
-                     outputDir="src/java/org/apache/lucene/demo/html"
-    />
-  </target>
-
-  <target name="dist-maven" if="pom.xml.present" depends="compile-core,jar-src">
-    <sequential>
-      <artifact:install-provider artifactId="wagon-ssh" version="1.0-beta-7"/>
-      <artifact:pom id="maven.project" file="pom.xml"/>
-      <artifact:deploy file="${build.dir}/${demo.war.name}.war">
-        <attach file="${build.dir}/${maven.project.build.finalName}.jar"
-                classifier="classes"/>
-        <attach file="${build.dir}/${final.name}-src.jar"
-                classifier="sources"/>
-        <attach file="${build.dir}/${final.name}-javadoc.jar"
-                classifier="javadoc"/>
-        <remoteRepository url="${m2.repository.url}">
-          <authentication username="${m2.repository.username}" privateKey="${m2.repository.private.key}"/>
-        </remoteRepository>
-        <pom refid="maven.project"/>
-      </artifact:deploy>
-    </sequential>
-  </target>  	
 </project>

Modified: lucene/dev/branches/realtime_search/lucene/contrib/demo/src/java/org/apache/lucene/demo/IndexFiles.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/demo/src/java/org/apache/lucene/demo/IndexFiles.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/demo/src/java/org/apache/lucene/demo/IndexFiles.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/demo/src/java/org/apache/lucene/demo/IndexFiles.java Tue Feb 22 01:00:39 2011
@@ -17,39 +17,59 @@ package org.apache.lucene.demo;
  * limitations under the License.
  */
 
+import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.NumericField;
 import org.apache.lucene.index.IndexWriter;
-import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.index.IndexWriterConfig.OpenMode;
+import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.FSDirectory;
 import org.apache.lucene.util.Version;
 
+import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.io.InputStreamReader;
 import java.util.Date;
 
-/** Index all text files under a directory. */
+/** Index all text files under a directory. See http://lucene.apache.org/java/4_0/demo.html. */
 public class IndexFiles {
   
   private IndexFiles() {}
 
-  static final File INDEX_DIR = new File("index");
-  
   /** Index all text files under a directory. */
   public static void main(String[] args) {
-    String usage = "java org.apache.lucene.demo.IndexFiles <root_directory>";
-    if (args.length == 0) {
-      System.err.println("Usage: " + usage);
-      System.exit(1);
+    String usage = "java org.apache.lucene.demo.IndexFiles"
+                 + " [-index INDEX_PATH] [-docs DOCS_PATH] [-update]\n\n"
+                   // TODO: Change the link with every release (or: fill in some less error-prone alternative here...)
+                 + "See http://lucene.apache.org/java/4_0/demo.html for details.";
+    String indexPath = "index";
+    String docsPath = null;
+    boolean create = true;
+    for(int i=0;i<args.length;i++) {
+      if ("-index".equals(args[i])) {
+        indexPath = args[i+1];
+        i++;
+      } else if ("-docs".equals(args[i])) {
+        docsPath = args[i+1];
+        i++;
+      } else if ("-update".equals(args[i])) {
+        create = false;
+      }
     }
 
-    if (INDEX_DIR.exists()) {
-      System.out.println("Cannot save index to '" +INDEX_DIR+ "' directory, please delete it first");
+    if (docsPath == null) {
+      System.err.println("Usage: " + usage);
       System.exit(1);
     }
-    
-    final File docDir = new File(args[0]);
+
+    final File docDir = new File(docsPath);
     if (!docDir.exists() || !docDir.canRead()) {
       System.out.println("Document directory '" +docDir.getAbsolutePath()+ "' does not exist or is not readable, please check the path");
       System.exit(1);
@@ -57,13 +77,39 @@ public class IndexFiles {
     
     Date start = new Date();
     try {
-      IndexWriter writer = new IndexWriter(FSDirectory.open(INDEX_DIR),
-          new IndexWriterConfig(Version.LUCENE_CURRENT, new StandardAnalyzer(
-              Version.LUCENE_CURRENT)).setOpenMode(OpenMode.CREATE));
-      System.out.println("Indexing to directory '" +INDEX_DIR+ "'...");
+      System.out.println("Indexing to directory '" + indexPath + "'...");
+
+      Directory dir = FSDirectory.open(new File(indexPath));
+      Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_40);
+      IndexWriterConfig iwc = new IndexWriterConfig(Version.LUCENE_40, analyzer);
+
+      if (create) {
+        // Create a new index in the directory, removing any
+        // previously indexed documents:
+        iwc.setOpenMode(OpenMode.CREATE);
+      } else {
+        // Add new documents to an existing index:
+        iwc.setOpenMode(OpenMode.CREATE_OR_APPEND);
+      }
+
+      // Optional: for better indexing performance, if you
+      // are indexing many documents, increase the RAM
+      // buffer.  But if you do this, increase the max heap
+      // size to the JVM (eg add -Xmx512m or -Xmx1g):
+      //
+      // iwc.setRAMBufferSizeMB(256.0);
+
+      IndexWriter writer = new IndexWriter(dir, iwc);
       indexDocs(writer, docDir);
-      System.out.println("Optimizing...");
-      writer.optimize();
+
+      // NOTE: if you want to maximize search performance,
+      // you can optionally call optimize here.  This can be
+      // a costly operation, so generally it's only worth
+      // it when your index is relatively static (ie you're
+      // done adding documents to it):
+      //
+      // writer.optimize();
+
       writer.close();
 
       Date end = new Date();
@@ -75,6 +121,21 @@ public class IndexFiles {
     }
   }
 
+  /**
+   * Indexes the given file using the given writer, or if a directory is given,
+   * recurses over files and directories found under the given directory.
+   * 
+   * NOTE: This method indexes one document per input file.  This is slow.  For good
+   * throughput, put multiple documents into your input file(s).  An example of this is
+   * in the benchmark module, which can create "line doc" files, one document per line,
+   * using the
+   * <a href="../../../../../contrib-benchmark/org/apache/lucene/benchmark/byTask/tasks/WriteLineDocTask.html"
+   * >WriteLineDocTask</a>.
+   *  
+   * @param writer Writer to the index where the given file/dir info will be stored
+   * @param file The file to index, or the directory to recurse into to find files to index
+   * @throws IOException
+   */
   static void indexDocs(IndexWriter writer, File file)
     throws IOException {
     // do not try to index files that cannot be read
@@ -88,16 +149,62 @@ public class IndexFiles {
           }
         }
       } else {
-        System.out.println("adding " + file);
+
+        FileInputStream fis;
         try {
-          writer.addDocument(FileDocument.Document(file));
+          fis = new FileInputStream(file);
+        } catch (FileNotFoundException fnfe) {
+          // at least on windows, some temporary files raise this exception with an "access denied" message
+          // checking if the file can be read doesn't help
+          return;
         }
-        // at least on windows, some temporary files raise this exception with an "access denied" message
-        // checking if the file can be read doesn't help
-        catch (FileNotFoundException fnfe) {
+
+        try {
+
+          // make a new, empty document
+          Document doc = new Document();
+
+          // Add the path of the file as a field named "path".  Use a
+          // field that is indexed (i.e. searchable), but don't tokenize 
+          // the field into separate words and don't index term frequency
+          // or positional information:
+          Field pathField = new Field("path", file.getPath(), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS);
+          pathField.setOmitTermFreqAndPositions(true);
+          doc.add(pathField);
+
+          // Add the last modified date of the file a field named "modified".
+          // Use a NumericField that is indexed (i.e. efficiently filterable with
+          // NumericRangeFilter).  This indexes to milli-second resolution, which
+          // is often too fine.  You could instead create a number based on
+          // year/month/day/hour/minutes/seconds, down the resolution you require.
+          // For example the long value 2011021714 would mean
+          // February 17, 2011, 2-3 PM.
+          NumericField modifiedField = new NumericField("modified");
+          modifiedField.setLongValue(file.lastModified());
+          doc.add(modifiedField);
+
+          // Add the contents of the file to a field named "contents".  Specify a Reader,
+          // so that the text of the file is tokenized and indexed, but not stored.
+          // Note that FileReader expects the file to be in UTF-8 encoding.
+          // If that's not the case searching for special characters will fail.
+          doc.add(new Field("contents", new BufferedReader(new InputStreamReader(fis, "UTF-8"))));
+
+          if (writer.getConfig().getOpenMode() == OpenMode.CREATE) {
+            // New index, so we just add the document (no old document can be there):
+            System.out.println("adding " + file);
+            writer.addDocument(doc);
+          } else {
+            // Existing index (an old copy of this document may have been indexed) so 
+            // we use updateDocument instead to replace the old one matching the exact 
+            // path, if present:
+            System.out.println("updating " + file);
+            writer.updateDocument(new Term("path", file.getPath()), doc);
+          }
+          
+        } finally {
+          fis.close();
         }
       }
     }
   }
-  
 }

Modified: lucene/dev/branches/realtime_search/lucene/contrib/demo/src/java/org/apache/lucene/demo/SearchFiles.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/demo/src/java/org/apache/lucene/demo/SearchFiles.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/demo/src/java/org/apache/lucene/demo/SearchFiles.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/demo/src/java/org/apache/lucene/demo/SearchFiles.java Tue Feb 22 01:00:39 2011
@@ -27,15 +27,11 @@ import java.util.Date;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
 import org.apache.lucene.document.Document;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.IndexReader.AtomicReaderContext;
 import org.apache.lucene.queryParser.QueryParser;
-import org.apache.lucene.search.Collector;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.ScoreDoc;
-import org.apache.lucene.search.Scorer;
-import org.apache.lucene.search.TopScoreDocCollector;
+import org.apache.lucene.search.TopDocs;
 import org.apache.lucene.store.FSDirectory;
 import org.apache.lucene.util.Version;
 
@@ -47,8 +43,7 @@ public class SearchFiles {
   /** Simple command-line based search demo. */
   public static void main(String[] args) throws Exception {
     String usage =
-      "Usage:\tjava org.apache.lucene.demo.SearchFiles [-index dir] [-field f] [-repeat n] [-queries file] [-raw] [-paging hitsPerPage]";
-    usage += "\n\tSpecify 'false' for hitsPerPage to use streaming instead of paging search.";
+      "Usage:\tjava org.apache.lucene.demo.SearchFiles [-index dir] [-field f] [-repeat n] [-queries file] [-query string] [-raw] [-paging hitsPerPage]\n\nSee http://lucene.apache.org/java/4_0/demo.html for details.";
     if (args.length > 0 && ("-h".equals(args[0]) || "-help".equals(args[0]))) {
       System.out.println(usage);
       System.exit(0);
@@ -59,10 +54,10 @@ public class SearchFiles {
     String queries = null;
     int repeat = 0;
     boolean raw = false;
-    boolean paging = true;
+    String queryString = null;
     int hitsPerPage = 10;
     
-    for (int i = 0; i < args.length; i++) {
+    for(int i = 0;i < args.length;i++) {
       if ("-index".equals(args[i])) {
         index = args[i+1];
         i++;
@@ -72,28 +67,26 @@ public class SearchFiles {
       } else if ("-queries".equals(args[i])) {
         queries = args[i+1];
         i++;
+      } else if ("-query".equals(args[i])) {
+        queryString = args[i+1];
+        i++;
       } else if ("-repeat".equals(args[i])) {
         repeat = Integer.parseInt(args[i+1]);
         i++;
       } else if ("-raw".equals(args[i])) {
         raw = true;
       } else if ("-paging".equals(args[i])) {
-        if (args[i+1].equals("false")) {
-          paging = false;
-        } else {
-          hitsPerPage = Integer.parseInt(args[i+1]);
-          if (hitsPerPage == 0) {
-            paging = false;
-          }
+        hitsPerPage = Integer.parseInt(args[i+1]);
+        if (hitsPerPage <= 0) {
+          System.err.println("There must be at least 1 hit per page.");
+          System.exit(1);
         }
         i++;
       }
     }
     
-    IndexReader reader = IndexReader.open(FSDirectory.open(new File(index)), true); // only searching, so read-only=true
-
-    IndexSearcher searcher = new IndexSearcher(reader);
-    Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_CURRENT);
+    IndexSearcher searcher = new IndexSearcher(FSDirectory.open(new File(index)));
+    Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_40);
 
     BufferedReader in = null;
     if (queries != null) {
@@ -101,23 +94,25 @@ public class SearchFiles {
     } else {
       in = new BufferedReader(new InputStreamReader(System.in, "UTF-8"));
     }
-    QueryParser parser = new QueryParser(Version.LUCENE_CURRENT, field, analyzer);
+    QueryParser parser = new QueryParser(Version.LUCENE_40, field, analyzer);
     while (true) {
-      if (queries == null)                        // prompt the user
+      if (queries == null && queryString == null) {                        // prompt the user
         System.out.println("Enter query: ");
+      }
 
-      String line = in.readLine();
+      String line = queryString != null ? queryString : in.readLine();
 
-      if (line == null || line.length() == -1)
+      if (line == null || line.length() == -1) {
         break;
+      }
 
       line = line.trim();
-      if (line.length() == 0)
+      if (line.length() == 0) {
         break;
+      }
       
       Query query = parser.parse(line);
       System.out.println("Searching for: " + query.toString(field));
-
             
       if (repeat > 0) {                           // repeat & time as benchmark
         Date start = new Date();
@@ -128,52 +123,13 @@ public class SearchFiles {
         System.out.println("Time: "+(end.getTime()-start.getTime())+"ms");
       }
 
-      if (paging) {
-        doPagingSearch(in, searcher, query, hitsPerPage, raw, queries == null);
-      } else {
-        doStreamingSearch(searcher, query);
-      }
-    }
-    reader.close();
-  }
-  
-  /**
-   * This method uses a custom HitCollector implementation which simply prints out
-   * the docId and score of every matching document. 
-   * 
-   *  This simulates the streaming search use case, where all hits are supposed to
-   *  be processed, regardless of their relevance.
-   */
-  public static void doStreamingSearch(final IndexSearcher searcher, Query query) throws IOException {
-    Collector streamingHitCollector = new Collector() {
-      private Scorer scorer;
-      private int docBase;
-      
-      // simply print docId and score of every matching document
-      @Override
-      public void collect(int doc) throws IOException {
-        System.out.println("doc=" + doc + docBase + " score=" + scorer.score());
-      }
-
-      @Override
-      public boolean acceptsDocsOutOfOrder() {
-        return true;
-      }
-
-      @Override
-      public void setNextReader(AtomicReaderContext context)
-          throws IOException {
-        this.docBase = context.docBase;
-      }
+      doPagingSearch(in, searcher, query, hitsPerPage, raw, queries == null && queryString == null);
 
-      @Override
-      public void setScorer(Scorer scorer) throws IOException {
-        this.scorer = scorer;
+      if (queryString != null) {
+        break;
       }
-      
-    };
-    
-    searcher.search(query, streamingHitCollector);
+    }
+    searcher.close();
   }
 
   /**
@@ -190,12 +146,10 @@ public class SearchFiles {
                                      int hitsPerPage, boolean raw, boolean interactive) throws IOException {
  
     // Collect enough docs to show 5 pages
-    TopScoreDocCollector collector = TopScoreDocCollector.create(
-        5 * hitsPerPage, false);
-    searcher.search(query, collector);
-    ScoreDoc[] hits = collector.topDocs().scoreDocs;
+    TopDocs results = searcher.search(query, 5 * hitsPerPage);
+    ScoreDoc[] hits = results.scoreDocs;
     
-    int numTotalHits = collector.getTotalHits();
+    int numTotalHits = results.totalHits;
     System.out.println(numTotalHits + " total matching documents");
 
     int start = 0;
@@ -210,9 +164,7 @@ public class SearchFiles {
           break;
         }
 
-        collector = TopScoreDocCollector.create(numTotalHits, false);
-        searcher.search(query, collector);
-        hits = collector.topDocs().scoreDocs;
+        hits = searcher.search(query, numTotalHits).scoreDocs;
       }
       
       end = Math.min(hits.length, start + hitsPerPage);
@@ -237,7 +189,7 @@ public class SearchFiles {
                   
       }
 
-      if (!interactive) {
+      if (!interactive || end == 0) {
         break;
       }
 
@@ -279,8 +231,6 @@ public class SearchFiles {
         if (quit) break;
         end = Math.min(numTotalHits, start + hitsPerPage);
       }
-      
     }
-
   }
 }

Modified: lucene/dev/branches/realtime_search/lucene/contrib/demo/src/test/org/apache/lucene/demo/TestDemo.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/demo/src/test/org/apache/lucene/demo/TestDemo.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/demo/src/test/org/apache/lucene/demo/TestDemo.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/demo/src/test/org/apache/lucene/demo/TestDemo.java Tue Feb 22 01:00:39 2011
@@ -24,43 +24,30 @@ import java.io.PrintStream;
 import org.apache.lucene.util.LuceneTestCase;
 
 public class TestDemo extends LuceneTestCase {
-  // LUCENE-589
-  public void testUnicodeHtml() throws Exception {
-    File dir = getDataFile("test-files/html");
-    File indexDir = new File(TEMP_DIR, "demoIndex");
-    IndexHTML.main(new String[] { "-create", "-index", indexDir.getPath(), dir.getPath() });
-    File queries = getDataFile("test-files/queries.txt");
+
+  private void testOneSearch(String query, int expectedHitCount) throws Exception {
     PrintStream outSave = System.out;
     try {
       ByteArrayOutputStream bytes = new ByteArrayOutputStream();
       PrintStream fakeSystemOut = new PrintStream(bytes);
       System.setOut(fakeSystemOut);
-      SearchFiles.main(new String[] { "-index", indexDir.getPath(), "-queries", queries.getPath()});
+      SearchFiles.main(new String[] {"-query", query});
       fakeSystemOut.flush();
       String output = bytes.toString(); // intentionally use default encoding
-      assertTrue(output.contains("1 total matching documents"));
+      assertTrue("output=" + output, output.contains(expectedHitCount + " total matching documents"));
     } finally {
       System.setOut(outSave);
     }
   }
-  
-  // LUCENE-591
-  public void testIndexKeywords() throws Exception {
-    File dir = getDataFile("test-files/html");
-    File indexDir = new File(TEMP_DIR, "demoIndex2");
-    IndexHTML.main(new String[] { "-create", "-index", indexDir.getPath(), dir.getPath() });
-    File queries = getDataFile("test-files/queries2.txt");
-    PrintStream outSave = System.out;
-    try {
-      ByteArrayOutputStream bytes = new ByteArrayOutputStream();
-      PrintStream fakeSystemOut = new PrintStream(bytes);
-      System.setOut(fakeSystemOut);
-      SearchFiles.main(new String[] { "-index", indexDir.getPath(), "-queries", queries.getPath()});
-      fakeSystemOut.flush();
-      String output = bytes.toString(); // intentionally use default encoding
-      assertTrue(output.contains("1 total matching documents"));
-    } finally {
-      System.setOut(outSave);
-    }
+
+  public void testIndexSearch() throws Exception {
+    File dir = getDataFile("test-files/docs");
+    IndexFiles.main(new String[] { "-create", "-docs", dir.getPath() });
+    testOneSearch("apache", 3);
+    testOneSearch("patent", 8);
+    testOneSearch("lucene", 0);
+    testOneSearch("gnu", 6);
+    testOneSearch("derivative", 8);
+    testOneSearch("license", 13);
   }
 }

Modified: lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/package.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/package.html?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/package.html (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/package.html Tue Feb 22 01:00:39 2011
@@ -66,7 +66,7 @@ sample text.</p>
 <h3>Step 1.</h3>
 <p>In Step 1, Fast Vector Highlighter generates {@link org.apache.lucene.search.vectorhighlight.FieldQuery.QueryPhraseMap} from the user query.
 <code>QueryPhraseMap</code> consists of the following members:</p>
-<pre>
+<pre class="prettyprint">
 public class QueryPhraseMap {
   boolean terminal;
   int slop;   // valid if terminal == true and phraseHighlight == true

Modified: lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java Tue Feb 22 01:00:39 2011
@@ -70,7 +70,7 @@ public class HighlighterPhraseTest exten
     final IndexReader indexReader = IndexReader.open(directory, true);
     try {
       assertEquals(1, indexReader.numDocs());
-      final IndexSearcher indexSearcher = new IndexSearcher(indexReader);
+      final IndexSearcher indexSearcher = newSearcher(indexReader);
       try {
         final PhraseQuery phraseQuery = new PhraseQuery();
         phraseQuery.add(new Term(FIELD, "fox"));
@@ -114,7 +114,7 @@ public class HighlighterPhraseTest exten
     final IndexReader indexReader = IndexReader.open(directory, true);
     try {
       assertEquals(1, indexReader.numDocs());
-      final IndexSearcher indexSearcher = new IndexSearcher(indexReader);
+      final IndexSearcher indexSearcher = newSearcher(indexReader);
       try {
         final Query phraseQuery = new SpanNearQuery(new SpanQuery[] {
             new SpanTermQuery(new Term(FIELD, "fox")),
@@ -184,7 +184,7 @@ public class HighlighterPhraseTest exten
     final IndexReader indexReader = IndexReader.open(directory, true);
     try {
       assertEquals(1, indexReader.numDocs());
-      final IndexSearcher indexSearcher = new IndexSearcher(indexReader);
+      final IndexSearcher indexSearcher = newSearcher(indexReader);
       try {
         final PhraseQuery phraseQuery = new PhraseQuery();
         phraseQuery.add(new Term(FIELD, "did"));
@@ -227,7 +227,7 @@ public class HighlighterPhraseTest exten
     final IndexReader indexReader = IndexReader.open(directory, true);
     try {
       assertEquals(1, indexReader.numDocs());
-      final IndexSearcher indexSearcher = new IndexSearcher(indexReader);
+      final IndexSearcher indexSearcher = newSearcher(indexReader);
       try {
         final PhraseQuery phraseQuery = new PhraseQuery();
         phraseQuery.add(new Term(FIELD, "did"));
@@ -268,7 +268,7 @@ public class HighlighterPhraseTest exten
     final IndexReader indexReader = IndexReader.open(directory, true);
     try {
       assertEquals(1, indexReader.numDocs());
-      final IndexSearcher indexSearcher = new IndexSearcher(indexReader);
+      final IndexSearcher indexSearcher = newSearcher(indexReader);
       try {
         final Query phraseQuery = new SpanNearQuery(new SpanQuery[] {
             new SpanTermQuery(new Term(FIELD, "did")),

Modified: lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/TokenSourcesTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/TokenSourcesTest.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/TokenSourcesTest.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/TokenSourcesTest.java Tue Feb 22 01:00:39 2011
@@ -113,7 +113,7 @@ public class TokenSourcesTest extends Lu
     final IndexReader indexReader = IndexReader.open(directory, true);
     try {
       assertEquals(1, indexReader.numDocs());
-      final IndexSearcher indexSearcher = new IndexSearcher(indexReader);
+      final IndexSearcher indexSearcher = newSearcher(indexReader);
       try {
         final DisjunctionMaxQuery query = new DisjunctionMaxQuery(1);
         query.add(new SpanTermQuery(new Term(FIELD, "{fox}")));
@@ -159,7 +159,7 @@ public class TokenSourcesTest extends Lu
     final IndexReader indexReader = IndexReader.open(directory, true);
     try {
       assertEquals(1, indexReader.numDocs());
-      final IndexSearcher indexSearcher = new IndexSearcher(indexReader);
+      final IndexSearcher indexSearcher = newSearcher(indexReader);
       try {
         final DisjunctionMaxQuery query = new DisjunctionMaxQuery(1);
         query.add(new SpanTermQuery(new Term(FIELD, "{fox}")));

Modified: lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/FieldSetting.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/FieldSetting.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/FieldSetting.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/FieldSetting.java Tue Feb 22 01:00:39 2011
@@ -1,7 +1,5 @@
 package org.apache.lucene.store.instantiated;
 
-import java.io.Serializable;
-
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -22,7 +20,7 @@ import java.io.Serializable;
 /**
  * For non package access see {@link org.apache.lucene.index.IndexReader#getFieldNames(org.apache.lucene.index.IndexReader.FieldOption)} 
  */
-class FieldSetting implements Serializable {
+class FieldSetting  {
   String fieldName;
 
   boolean storeTermVector = false;

Modified: lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/FieldSettings.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/FieldSettings.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/FieldSettings.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/FieldSettings.java Tue Feb 22 01:00:39 2011
@@ -3,7 +3,6 @@ package org.apache.lucene.store.instanti
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Collection;
-import java.io.Serializable;
 
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -25,7 +24,7 @@ import java.io.Serializable;
 /**
  * Essentially a Map<FieldName, {@link org.apache.lucene.store.instantiated.FieldSetting}> 
  */
-class FieldSettings implements Serializable {
+class FieldSettings {
 
 
   FieldSettings() {

Modified: lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedDocsAndPositionsEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedDocsAndPositionsEnum.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedDocsAndPositionsEnum.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedDocsAndPositionsEnum.java Tue Feb 22 01:00:39 2011
@@ -82,14 +82,17 @@ public class InstantiatedDocsAndPosition
     return currentDoc.getTermPositions().length;
   }
   
+  @Override
   public int nextPosition() {
     return currentDoc.getTermPositions()[++posUpto];
   }
 
+  @Override
   public boolean hasPayload() {
     return currentDoc.getPayloads()[posUpto] != null;
   }
 
+  @Override
   public BytesRef getPayload() {
     payload.bytes = currentDoc.getPayloads()[posUpto];
     payload.length = payload.bytes.length;

Modified: lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedDocument.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedDocument.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedDocument.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedDocument.java Tue Feb 22 01:00:39 2011
@@ -18,7 +18,6 @@ package org.apache.lucene.store.instanti
 
 import org.apache.lucene.document.Document;
 
-import java.io.Serializable;
 import java.util.List;
 import java.util.Map;
 
@@ -27,10 +26,7 @@ import java.util.Map;
  *
  * @see org.apache.lucene.document.Document
  */
-public class InstantiatedDocument
-    implements Serializable {
-
-  private static final long serialVersionUID = 1l;
+public class InstantiatedDocument {
 
   private Document document;
 

Modified: lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java Tue Feb 22 01:00:39 2011
@@ -18,7 +18,6 @@ package org.apache.lucene.store.instanti
 
 import java.io.Closeable;
 import java.io.IOException;
-import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -60,9 +59,7 @@ import org.apache.lucene.util.BytesRef;
  * Consider using InstantiatedIndex as if it was immutable.
  */
 public class InstantiatedIndex
-    implements Serializable,Closeable {
-
-  private static final long serialVersionUID = 1l;
+    implements Closeable {
 
   private long version = System.currentTimeMillis();
 

Modified: lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexReader.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexReader.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexReader.java Tue Feb 22 01:00:39 2011
@@ -19,6 +19,7 @@ package org.apache.lucene.store.instanti
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -52,6 +53,7 @@ public class InstantiatedIndexReader ext
   public InstantiatedIndexReader(InstantiatedIndex index) {
     super();
     this.index = index;
+    readerFinishedListeners = Collections.synchronizedSet(new HashSet<ReaderFinishedListener>());
   }
 
   /**

Modified: lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java Tue Feb 22 01:00:39 2011
@@ -114,14 +114,14 @@ public class InstantiatedIndexWriter imp
    *  MAddDocs_20000 -   7 4000 100 false -  -   1 -  -   20000 -  -   535,8 -  -  37,33 - 309 680 640 -  501 968 896
    * </pre>
    *
-   * @see org.apache.lucene.index.IndexWriter#setMergeFactor(int)
+   * @see org.apache.lucene.index.LogMergePolicy#setMergeFactor(int)
    */
   public void setMergeFactor(int mergeFactor) {
     this.mergeFactor = mergeFactor;
   }
 
   /**
-   * @see org.apache.lucene.index.IndexWriter#getMergeFactor()
+   * @see org.apache.lucene.index.LogMergePolicy#getMergeFactor()
    */
   public int getMergeFactor() {
     return mergeFactor;
@@ -241,7 +241,7 @@ public class InstantiatedIndexWriter imp
           final FieldInvertState invertState = new FieldInvertState();
           invertState.setBoost(eFieldTermDocInfoFactoriesByTermText.getKey().boost * document.getDocument().getBoost());
           invertState.setLength(eFieldTermDocInfoFactoriesByTermText.getKey().fieldLength);
-          final float norm = similarityProvider.get(fieldName).computeNorm(fieldName, invertState);
+          final float norm = similarityProvider.get(fieldName).computeNorm(invertState);
           normsByFieldNameAndDocumentNumber.get(fieldName)[document.getDocumentNumber()] = similarityProvider.get(fieldName).encodeNormValue(norm);
         } else {
           System.currentTimeMillis();

Modified: lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTerm.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTerm.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTerm.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTerm.java Tue Feb 22 01:00:39 2011
@@ -16,7 +16,6 @@ package org.apache.lucene.store.instanti
  * limitations under the License.
  */
 
-import java.io.Serializable;
 import java.util.Comparator;
 
 import org.apache.lucene.index.Term;
@@ -26,10 +25,7 @@ import org.apache.lucene.index.Term;
  *
  * @see org.apache.lucene.index.Term
  */
-public class InstantiatedTerm
-    implements Serializable {
-
-  private static final long serialVersionUID = 1l;
+public class InstantiatedTerm {
 
   public static final Comparator<InstantiatedTerm> comparator = new Comparator<InstantiatedTerm>() {
     public int compare(InstantiatedTerm instantiatedTerm, InstantiatedTerm instantiatedTerm1) {

Modified: lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermDocumentInformation.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermDocumentInformation.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermDocumentInformation.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermDocumentInformation.java Tue Feb 22 01:00:39 2011
@@ -2,7 +2,6 @@ package org.apache.lucene.store.instanti
 
 import org.apache.lucene.index.TermVectorOffsetInfo;
 
-import java.io.Serializable;
 import java.util.Comparator;
 
 /**
@@ -38,10 +37,7 @@ import java.util.Comparator;
  * </pre>
  * 
  */
-public class InstantiatedTermDocumentInformation
-    implements Serializable {
-
-  private static final long serialVersionUID = 1l;
+public class InstantiatedTermDocumentInformation {
 
   public static final Comparator<InstantiatedTermDocumentInformation> termComparator = new Comparator<InstantiatedTermDocumentInformation>() {
     public int compare(InstantiatedTermDocumentInformation instantiatedTermDocumentInformation, InstantiatedTermDocumentInformation instantiatedTermDocumentInformation1) {

Modified: lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermFreqVector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermFreqVector.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermFreqVector.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermFreqVector.java Tue Feb 22 01:00:39 2011
@@ -3,7 +3,6 @@ package org.apache.lucene.store.instanti
 import org.apache.lucene.index.TermFreqVector;
 import org.apache.lucene.util.BytesRef;
 
-import java.io.Serializable;
 import java.util.Arrays;
 import java.util.List;
 
@@ -29,9 +28,7 @@ import java.util.List;
  * @see org.apache.lucene.index.TermFreqVector
  */
 public class InstantiatedTermFreqVector
-    implements TermFreqVector, Serializable {
-
-  private static final long serialVersionUID = 1l;
+    implements TermFreqVector {
 
   private final List<InstantiatedTermDocumentInformation> termDocumentInformations;
   private final String field;

Modified: lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermPositionVector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermPositionVector.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermPositionVector.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermPositionVector.java Tue Feb 22 01:00:39 2011
@@ -19,8 +19,6 @@ package org.apache.lucene.store.instanti
 import org.apache.lucene.index.TermPositionVector;
 import org.apache.lucene.index.TermVectorOffsetInfo;
 
-import java.io.Serializable;
-
 /**
  * Extended vector space view of a document in an {@link InstantiatedIndexReader}.
  *
@@ -28,9 +26,7 @@ import java.io.Serializable;
  */
 public class InstantiatedTermPositionVector
     extends InstantiatedTermFreqVector
-    implements TermPositionVector, Serializable {
-
-  private static final long serialVersionUID = 1l;
+    implements TermPositionVector {
 
   public InstantiatedTermPositionVector(InstantiatedDocument document, String field) {
     super(document, field);

Modified: lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestEmptyIndex.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestEmptyIndex.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestEmptyIndex.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestEmptyIndex.java Tue Feb 22 01:00:39 2011
@@ -37,7 +37,7 @@ public class TestEmptyIndex extends Luce
     InstantiatedIndex ii = new InstantiatedIndex();
 
     IndexReader r = new InstantiatedIndexReader(ii);
-    IndexSearcher s = new IndexSearcher(r);
+    IndexSearcher s = newSearcher(r);
 
     TopDocs td = s.search(new TermQuery(new Term("foo", "bar")), 1);
 

Modified: lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java Tue Feb 22 01:00:39 2011
@@ -65,7 +65,7 @@ public class TestIndicesEquals extends L
 
     // create dir data
     IndexWriter indexWriter = new IndexWriter(dir, newIndexWriterConfig(
-        TEST_VERSION_CURRENT, new MockAnalyzer()));
+        TEST_VERSION_CURRENT, new MockAnalyzer()).setMergePolicy(newInOrderLogMergePolicy()));
     
     for (int i = 0; i < 20; i++) {
       Document document = new Document();
@@ -91,7 +91,7 @@ public class TestIndicesEquals extends L
 
     // create dir data
     IndexWriter indexWriter = new IndexWriter(dir, newIndexWriterConfig(
-        TEST_VERSION_CURRENT, new MockAnalyzer()));
+                                                                        TEST_VERSION_CURRENT, new MockAnalyzer()).setMergePolicy(newInOrderLogMergePolicy()));
     indexWriter.setInfoStream(VERBOSE ? System.out : null);
     if (VERBOSE) {
       System.out.println("TEST: make test index");

Modified: lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestRealTime.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestRealTime.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestRealTime.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestRealTime.java Tue Feb 22 01:00:39 2011
@@ -36,7 +36,7 @@ public class TestRealTime extends Lucene
 
     InstantiatedIndex index = new InstantiatedIndex();
     InstantiatedIndexReader reader = new InstantiatedIndexReader(index);
-    IndexSearcher searcher = new IndexSearcher(reader);
+    IndexSearcher searcher = newSearcher(reader);
     InstantiatedIndexWriter writer = new InstantiatedIndexWriter(index);
 
     Document doc;

Modified: lucene/dev/branches/realtime_search/lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java Tue Feb 22 01:00:39 2011
@@ -18,13 +18,13 @@ package org.apache.lucene.index.memory;
  */
 
 import java.io.IOException;
-import java.io.Serializable;
 import java.io.StringReader;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
 
@@ -185,7 +185,7 @@ import org.apache.lucene.util.Constants;
  * hprof tracing </a>).
  *
  */
-public class MemoryIndex implements Serializable {
+public class MemoryIndex {
 
   /** info for each field: Map<String fieldName, Info field> */
   private final HashMap<String,Info> fields = new HashMap<String,Info>();
@@ -198,8 +198,6 @@ public class MemoryIndex implements Seri
   
   /** Could be made configurable; See {@link Document#setBoost(float)} */
   private static final float docBoost = 1.0f;
-  
-  private static final long serialVersionUID = 2782195016849084649L;
 
   private static final boolean DEBUG = false;
   
@@ -588,7 +586,7 @@ public class MemoryIndex implements Seri
    * Index data structure for a field; Contains the tokenized term texts and
    * their positions.
    */
-  private static final class Info implements Serializable {
+  private static final class Info {
     
     /**
      * Term strings and their positions for this field: Map <String
@@ -613,8 +611,6 @@ public class MemoryIndex implements Seri
 
     private final long sumTotalTermFreq;
 
-    private static final long serialVersionUID = 2882195016849084649L;  
-
     public Info(HashMap<BytesRef,ArrayIntList> terms, int numTokens, int numOverlapTokens, float boost) {
       this.terms = terms;
       this.numTokens = numTokens;
@@ -667,12 +663,10 @@ public class MemoryIndex implements Seri
    * Efficient resizable auto-expanding list holding <code>int</code> elements;
    * implemented with arrays.
    */
-  private static final class ArrayIntList implements Serializable {
+  private static final class ArrayIntList {
 
     private int[] elements;
     private int size = 0;
-    
-    private static final long serialVersionUID = 2282195016849084649L;  
       
     public ArrayIntList() {
       this(10);
@@ -758,6 +752,7 @@ public class MemoryIndex implements Seri
     
     private MemoryIndexReader() {
       super(); // avoid as much superclass baggage as possible
+      readerFinishedListeners = Collections.synchronizedSet(new HashSet<ReaderFinishedListener>());
     }
     
     private Info getInfo(String fieldName) {
@@ -1195,7 +1190,7 @@ public class MemoryIndex implements Seri
         int numOverlapTokens = info != null ? info.numOverlapTokens : 0;
         float boost = info != null ? info.getBoost() : 1.0f; 
         FieldInvertState invertState = new FieldInvertState(0, numTokens, numOverlapTokens, 0, boost);
-        float n = fieldSim.computeNorm(fieldName, invertState);
+        float n = fieldSim.computeNorm(invertState);
         byte norm = fieldSim.encodeNormValue(n);
         norms = new byte[] {norm};
         

Modified: lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java Tue Feb 22 01:00:39 2011
@@ -149,7 +149,7 @@ public class FieldNormModifier {
         for (int d = 0; d < termCounts.length; d++) {
           if (delDocs == null || !delDocs.get(d)) {
             invertState.setLength(termCounts[d]);
-            subReader.setNorm(d, fieldName, fieldSim.encodeNormValue(fieldSim.computeNorm(fieldName, invertState)));
+            subReader.setNorm(d, fieldName, fieldSim.encodeNormValue(fieldSim.computeNorm(invertState)));
           }
         }
       }

Modified: lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingCodec.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingCodec.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingCodec.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingCodec.java Tue Feb 22 01:00:39 2011
@@ -71,7 +71,7 @@ public class AppendingCodec extends Code
     }
     success = false;
     try {
-      FieldsConsumer ret = new AppendingTermsDictWriter(indexWriter, state, docsWriter, BytesRef.getUTF8SortedAsUnicodeComparator());
+      FieldsConsumer ret = new AppendingTermsDictWriter(indexWriter, state, docsWriter);
       success = true;
       return ret;
     } finally {
@@ -111,7 +111,6 @@ public class AppendingCodec extends Code
               state.dir, state.fieldInfos, state.segmentInfo.name,
               docsReader,
               state.readBufferSize,
-              BytesRef.getUTF8SortedAsUnicodeComparator(),
               StandardCodec.TERMS_CACHE_SIZE,
               state.codecId);
       success = true;

Modified: lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsDictReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsDictReader.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsDictReader.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsDictReader.java Tue Feb 22 01:00:39 2011
@@ -18,7 +18,6 @@ package org.apache.lucene.index.codecs.a
  */
 
 import java.io.IOException;
-import java.util.Comparator;
 
 import org.apache.lucene.index.FieldInfos;
 import org.apache.lucene.index.codecs.PostingsReaderBase;
@@ -27,7 +26,6 @@ import org.apache.lucene.index.codecs.Bl
 import org.apache.lucene.index.codecs.TermsIndexReaderBase;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.IndexInput;
-import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.CodecUtil;
 
 public class AppendingTermsDictReader extends BlockTermsReader {
@@ -35,9 +33,9 @@ public class AppendingTermsDictReader ex
   public AppendingTermsDictReader(TermsIndexReaderBase indexReader,
           Directory dir, FieldInfos fieldInfos, String segment,
           PostingsReaderBase postingsReader, int readBufferSize,
-          Comparator<BytesRef> termComp, int termsCacheSize, String codecId) throws IOException {
+          int termsCacheSize, String codecId) throws IOException {
     super(indexReader, dir, fieldInfos, segment, postingsReader, readBufferSize,
-            termComp, termsCacheSize, codecId);
+          termsCacheSize, codecId);
   }
   
   @Override

Modified: lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsDictWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsDictWriter.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsDictWriter.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsDictWriter.java Tue Feb 22 01:00:39 2011
@@ -18,23 +18,21 @@ package org.apache.lucene.index.codecs.a
  */
 
 import java.io.IOException;
-import java.util.Comparator;
 
 import org.apache.lucene.index.SegmentWriteState;
 import org.apache.lucene.index.codecs.PostingsWriterBase;
 import org.apache.lucene.index.codecs.BlockTermsWriter;
 import org.apache.lucene.index.codecs.TermsIndexWriterBase;
 import org.apache.lucene.store.IndexOutput;
-import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.CodecUtil;
 
 public class AppendingTermsDictWriter extends BlockTermsWriter {
   final static String CODEC_NAME = "APPENDING_TERMS_DICT";
 
   public AppendingTermsDictWriter(TermsIndexWriterBase indexWriter,
-          SegmentWriteState state, PostingsWriterBase postingsWriter,
-          Comparator<BytesRef> termComp) throws IOException {
-    super(indexWriter, state, postingsWriter, termComp);
+                                  SegmentWriteState state, PostingsWriterBase postingsWriter)
+    throws IOException {
+    super(indexWriter, state, postingsWriter);
   }
   
   @Override

Modified: lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/misc/SweetSpotSimilarity.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/misc/SweetSpotSimilarity.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/misc/SweetSpotSimilarity.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/misc/SweetSpotSimilarity.java Tue Feb 22 01:00:39 2011
@@ -20,9 +20,6 @@ package org.apache.lucene.misc;
 import org.apache.lucene.search.DefaultSimilarity;
 import org.apache.lucene.index.FieldInvertState;
 
-import java.util.Map;
-import java.util.HashMap;
-
 /**
  * A similarity with a lengthNorm that provides for a "plateau" of
  * equally good lengths, and tf helper functions.
@@ -50,11 +47,6 @@ public class SweetSpotSimilarity extends
   private int ln_max = 1;
   private float ln_steep = 0.5f;
 
-  private Map<String,Number> ln_maxs = new HashMap<String,Number>(7);
-  private Map<String,Number> ln_mins = new HashMap<String,Number>(7);
-  private Map<String,Float> ln_steeps = new HashMap<String,Float>(7);
-  private Map<String,Boolean> ln_overlaps = new HashMap<String,Boolean>(7);
-
   private float tf_base = 0.0f;
   private float tf_min = 0.0f;
 
@@ -98,55 +90,31 @@ public class SweetSpotSimilarity extends
    * Sets the default function variables used by lengthNorm when no field
    * specific variables have been set.
    *
-   * @see #lengthNorm
+   * @see #computeLengthNorm
    */
-  public void setLengthNormFactors(int min, int max, float steepness) {
+  public void setLengthNormFactors(int min, int max, float steepness, boolean discountOverlaps) {
     this.ln_min = min;
     this.ln_max = max;
     this.ln_steep = steepness;
-  }
-
-  /**
-   * Sets the function variables used by lengthNorm for a specific named field.
-   * 
-   * @param field field name
-   * @param min minimum value
-   * @param max maximum value
-   * @param steepness steepness of the curve
-   * @param discountOverlaps if true, <code>numOverlapTokens</code> will be
-   * subtracted from <code>numTokens</code>; if false then
-   * <code>numOverlapTokens</code> will be assumed to be 0 (see
-   * {@link DefaultSimilarity#computeNorm(String, FieldInvertState)} for details).
-   *
-   * @see #lengthNorm
-   */
-  public void setLengthNormFactors(String field, int min, int max,
-                                   float steepness, boolean discountOverlaps) {
-    ln_mins.put(field, Integer.valueOf(min));
-    ln_maxs.put(field, Integer.valueOf(max));
-    ln_steeps.put(field, Float.valueOf(steepness));
-    ln_overlaps.put(field, new Boolean(discountOverlaps));
+    this.discountOverlaps = discountOverlaps;
   }
     
   /**
    * Implemented as <code> state.getBoost() *
-   * lengthNorm(fieldName, numTokens) </code> where
+   * computeLengthNorm(numTokens) </code> where
    * numTokens does not count overlap tokens if
    * discountOverlaps is true by default or true for this
    * specific field. */
   @Override
-  public float computeNorm(String fieldName, FieldInvertState state) {
+  public float computeNorm(FieldInvertState state) {
     final int numTokens;
-    boolean overlaps = discountOverlaps;
-    if (ln_overlaps.containsKey(fieldName)) {
-      overlaps = ln_overlaps.get(fieldName).booleanValue();
-    }
-    if (overlaps)
+
+    if (discountOverlaps)
       numTokens = state.getLength() - state.getNumOverlap();
     else
       numTokens = state.getLength();
 
-    return state.getBoost() * computeLengthNorm(fieldName, numTokens);
+    return state.getBoost() * computeLengthNorm(numTokens);
   }
 
   /**
@@ -167,20 +135,10 @@ public class SweetSpotSimilarity extends
    *
    * @see #setLengthNormFactors
    */
-  public float computeLengthNorm(String fieldName, int numTerms) {
-    int l = ln_min;
-    int h = ln_max;
-    float s = ln_steep;
-  
-    if (ln_mins.containsKey(fieldName)) {
-      l = ln_mins.get(fieldName).intValue();
-    }
-    if (ln_maxs.containsKey(fieldName)) {
-      h = ln_maxs.get(fieldName).intValue();
-    }
-    if (ln_steeps.containsKey(fieldName)) {
-      s = ln_steeps.get(fieldName).floatValue();
-    }
+  public float computeLengthNorm(int numTerms) {
+    final int l = ln_min;
+    final int h = ln_max;
+    final float s = ln_steep;
   
     return (float)
       (1.0f /

Modified: lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/store/NativePosixUtil.cpp
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/store/NativePosixUtil.cpp?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/store/NativePosixUtil.cpp (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/store/NativePosixUtil.cpp Tue Feb 22 01:00:39 2011
@@ -1,3 +1,20 @@
+/**
+ * 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.
+ */
+
 #include <jni.h>
 #include <fcntl.h>   // posix_fadvise, constants for open
 #include <string.h>   // strerror

Modified: lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java Tue Feb 22 01:00:39 2011
@@ -64,6 +64,7 @@ public class WindowsDirectory extends FS
     super(path, null);
   }
 
+  @Override
   public IndexInput openInput(String name, int bufferSize) throws IOException {
     ensureOpen();
     return new WindowsIndexInput(new File(getDirectory(), name), Math.max(bufferSize, DEFAULT_BUFFERSIZE));
@@ -82,14 +83,17 @@ public class WindowsDirectory extends FS
       isOpen = true;
     }
     
+    @Override
     protected void readInternal(byte[] b, int offset, int length) throws IOException {
       if (WindowsDirectory.read(fd, b, offset, length, getFilePointer()) != length)
         throw new IOException("Read past EOF");
     }
 
+    @Override
     protected void seekInternal(long pos) throws IOException {
     }
 
+    @Override
     public synchronized void close() throws IOException {
       // NOTE: we synchronize and track "isOpen" because Lucene sometimes closes IIs twice!
       if (!isClone && isOpen) {
@@ -98,6 +102,7 @@ public class WindowsDirectory extends FS
       }
     }
 
+    @Override
     public long length() {
       return length;
     }

Modified: lucene/dev/branches/realtime_search/lucene/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java Tue Feb 22 01:00:39 2011
@@ -44,7 +44,7 @@ public class TestFieldNormModifier exten
   /** inverts the normal notion of lengthNorm */
   public static SimilarityProvider s = new DefaultSimilarity() {
     @Override
-    public float computeNorm(String fieldName, FieldInvertState state) {
+    public float computeNorm(FieldInvertState state) {
       return state.getBoost() * (discountOverlaps ? state.getLength() - state.getNumOverlap() : state.getLength());
     }
   };
@@ -54,7 +54,7 @@ public class TestFieldNormModifier exten
     super.setUp();
     store = newDirectory();
     IndexWriter writer = new IndexWriter(store, newIndexWriterConfig(
-        TEST_VERSION_CURRENT, new MockAnalyzer()));
+                                                                     TEST_VERSION_CURRENT, new MockAnalyzer()).setMergePolicy(newInOrderLogMergePolicy()));
     
     for (int i = 0; i < NUM_DOCS; i++) {
       Document d = new Document();

Modified: lucene/dev/branches/realtime_search/lucene/contrib/misc/src/test/org/apache/lucene/index/TestMultiPassIndexSplitter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/contrib/misc/src/test/org/apache/lucene/index/TestMultiPassIndexSplitter.java?rev=1073192&r1=1073191&r2=1073192&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/contrib/misc/src/test/org/apache/lucene/index/TestMultiPassIndexSplitter.java (original)
+++ lucene/dev/branches/realtime_search/lucene/contrib/misc/src/test/org/apache/lucene/index/TestMultiPassIndexSplitter.java Tue Feb 22 01:00:39 2011
@@ -32,7 +32,7 @@ public class TestMultiPassIndexSplitter 
   public void setUp() throws Exception {
     super.setUp();
     dir = newDirectory();
-    IndexWriter w = new IndexWriter(dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));
+    IndexWriter w = new IndexWriter(dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()).setMergePolicy(newInOrderLogMergePolicy()));
     Document doc;
     for (int i = 0; i < NUM_DOCS; i++) {
       doc = new Document();