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

svn commit: r1070514 - in /lucene/dev/branches/bulkpostings: ./ dev-tools/idea/.idea/ lucene/ lucene/contrib/ lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/ lucene/contrib/memory/src/java/org/apache/lucene/index/memory/ luce...

Author: rmuir
Date: Mon Feb 14 14:58:04 2011
New Revision: 1070514

URL: http://svn.apache.org/viewvc?rev=1070514&view=rev
Log:
merge trunk (1069908:1070494)

Added:
    lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestStressAdvance.java
      - copied unchanged from r1070494, lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestStressAdvance.java
    lucene/dev/branches/bulkpostings/solr/example/solr/zoo.cfg
      - copied unchanged from r1070494, lucene/dev/trunk/solr/example/solr/zoo.cfg
Modified:
    lucene/dev/branches/bulkpostings/   (props changed)
    lucene/dev/branches/bulkpostings/dev-tools/idea/.idea/compiler.xml
    lucene/dev/branches/bulkpostings/lucene/   (props changed)
    lucene/dev/branches/bulkpostings/lucene/CHANGES.txt
    lucene/dev/branches/bulkpostings/lucene/MIGRATE.txt
    lucene/dev/branches/bulkpostings/lucene/contrib/CHANGES.txt
    lucene/dev/branches/bulkpostings/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java
    lucene/dev/branches/bulkpostings/lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java
    lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java
    lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/misc/SweetSpotSimilarity.java
    lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java
    lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/test/org/apache/lucene/misc/SweetSpotSimilarityTest.java
    lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/test/org/apache/lucene/misc/TestLengthNormModifier.java
    lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/document/AbstractField.java
    lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/document/Fieldable.java
    lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/IndexReader.java
    lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/NormsWriterPerField.java
    lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/queryParser/QueryParserBase.java
    lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/DefaultSimilarity.java
    lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/Similarity.java
    lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/payloads/PayloadNearQuery.java
    lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/payloads/PayloadTermQuery.java
    lucene/dev/branches/bulkpostings/lucene/src/test-framework/org/apache/lucene/index/codecs/mockrandom/MockRandomCodec.java
    lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestDoc.java
    lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java
    lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestMaxTermFrequency.java
    lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestNorms.java
    lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestOmitTf.java
    lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java
    lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/JustCompileSearch.java
    lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java
    lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java
    lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/TestSimilarity.java
    lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/TestSimilarityProvider.java
    lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java
    lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java
    lucene/dev/branches/bulkpostings/modules/   (props changed)
    lucene/dev/branches/bulkpostings/solr/   (props changed)
    lucene/dev/branches/bulkpostings/solr/CHANGES.txt   (props changed)
    lucene/dev/branches/bulkpostings/solr/KEYS   (props changed)
    lucene/dev/branches/bulkpostings/solr/LICENSE.txt   (props changed)
    lucene/dev/branches/bulkpostings/solr/NOTICE.txt   (props changed)
    lucene/dev/branches/bulkpostings/solr/README.txt   (props changed)
    lucene/dev/branches/bulkpostings/solr/build.xml   (contents, props changed)
    lucene/dev/branches/bulkpostings/solr/client/   (props changed)
    lucene/dev/branches/bulkpostings/solr/common-build.xml   (props changed)
    lucene/dev/branches/bulkpostings/solr/contrib/   (props changed)
    lucene/dev/branches/bulkpostings/solr/contrib/uima/README.txt
    lucene/dev/branches/bulkpostings/solr/example/   (props changed)
    lucene/dev/branches/bulkpostings/solr/example/solr/solr.xml
    lucene/dev/branches/bulkpostings/solr/lib/   (props changed)
    lucene/dev/branches/bulkpostings/solr/site/   (props changed)
    lucene/dev/branches/bulkpostings/solr/src/   (props changed)
    lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/SpellCheckCollator.java
    lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/function/TestFunctionQuery.java
    lucene/dev/branches/bulkpostings/solr/testlogging.properties   (props changed)

Modified: lucene/dev/branches/bulkpostings/dev-tools/idea/.idea/compiler.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/dev-tools/idea/.idea/compiler.xml?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/dev-tools/idea/.idea/compiler.xml (original)
+++ lucene/dev/branches/bulkpostings/dev-tools/idea/.idea/compiler.xml Mon Feb 14 14:58:04 2011
@@ -33,5 +33,8 @@
       <entry name="README*" />
     </wildcardResourcePatterns>
   </component>
+  <component name="JavacSettings">
+    <option name="ADDITIONAL_OPTIONS_STRING" value="-encoding utf-8" />
+  </component>
 </project>
 

Modified: lucene/dev/branches/bulkpostings/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/CHANGES.txt?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/bulkpostings/lucene/CHANGES.txt Mon Feb 14 14:58:04 2011
@@ -195,6 +195,10 @@ API Changes
   for building top-level norms. If you really need a top-level norms, use 
   MultiNorms or SlowMultiReaderWrapper. (Robert Muir, Mike Mccandless)
 
+* LUCENE-2892: Add QueryParser.newFieldQuery (called by getFieldQuery by default)
+  which takes Analyzer as a parameter, for easier customization by subclasses.
+  (Robert Muir)
+
 New features
 
 * LUCENE-2604: Added RegexpQuery support to QueryParser. Regular expressions

Modified: lucene/dev/branches/bulkpostings/lucene/MIGRATE.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/MIGRATE.txt?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/MIGRATE.txt (original)
+++ lucene/dev/branches/bulkpostings/lucene/MIGRATE.txt Mon Feb 14 14:58:04 2011
@@ -332,8 +332,12 @@ LUCENE-1458, LUCENE-2111: Flexible Index
   toString(), port your customization over to reflectWith(). reflectAsString() would
   then return what toString() did before.
 
-* LUCENE-2236: DefaultSimilarity can no longer be set statically (and dangerously) for the entire JVM.
+* LUCENE-2236, LUCENE-2912: DefaultSimilarity can no longer be set statically 
+  (and dangerously) for the entire JVM.
   Instead, IndexWriterConfig and IndexSearcher now take a SimilarityProvider.
   Similarity can now be configured on a per-field basis.
   Similarity retains only the field-specific relevance methods such as tf() and idf().
+  Previously some (but not all) of these methods, such as computeNorm and scorePayload took 
+  field as a parameter, this is removed due to the fact the entire Similarity (all methods)
+  can now be configured per-field.
   Methods that apply to the entire query such as coord() and queryNorm() exist in SimilarityProvider.

Modified: lucene/dev/branches/bulkpostings/lucene/contrib/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/CHANGES.txt?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/CHANGES.txt (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/CHANGES.txt Mon Feb 14 14:58:04 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

Modified: lucene/dev/branches/bulkpostings/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java Mon Feb 14 14:58:04 2011
@@ -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/bulkpostings/lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java Mon Feb 14 14:58:04 2011
@@ -1359,7 +1359,7 @@ public class MemoryIndex {
         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/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java Mon Feb 14 14:58:04 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/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/misc/SweetSpotSimilarity.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/misc/SweetSpotSimilarity.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/misc/SweetSpotSimilarity.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/misc/SweetSpotSimilarity.java Mon Feb 14 14:58:04 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/bulkpostings/lucene/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java Mon Feb 14 14:58:04 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());
     }
   };

Modified: lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/test/org/apache/lucene/misc/SweetSpotSimilarityTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/test/org/apache/lucene/misc/SweetSpotSimilarityTest.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/test/org/apache/lucene/misc/SweetSpotSimilarityTest.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/test/org/apache/lucene/misc/SweetSpotSimilarityTest.java Mon Feb 14 14:58:04 2011
@@ -20,6 +20,7 @@ package org.apache.lucene.misc;
 
 import org.apache.lucene.search.DefaultSimilarity;
 import org.apache.lucene.search.Similarity;
+import org.apache.lucene.search.SimilarityProvider;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.index.FieldInvertState;
 
@@ -30,8 +31,8 @@ public class SweetSpotSimilarityTest ext
 
   public void testSweetSpotComputeNorm() {
   
-    SweetSpotSimilarity ss = new SweetSpotSimilarity();
-    ss.setLengthNormFactors(1,1,0.5f);
+    final SweetSpotSimilarity ss = new SweetSpotSimilarity();
+    ss.setLengthNormFactors(1,1,0.5f,true);
 
     Similarity d = new DefaultSimilarity();
     Similarity s = ss;
@@ -43,28 +44,28 @@ public class SweetSpotSimilarityTest ext
     for (int i = 1; i < 1000; i++) {
       invertState.setLength(i);
       assertEquals("base case: i="+i,
-                   d.computeNorm("foo", invertState),
-                   s.computeNorm("foo", invertState),
+                   d.computeNorm(invertState),
+                   s.computeNorm(invertState),
                    0.0f);
     }
 
     // make a sweet spot
   
-    ss.setLengthNormFactors(3,10,0.5f);
+    ss.setLengthNormFactors(3,10,0.5f,true);
   
     for (int i = 3; i <=10; i++) {
       invertState.setLength(i);
       assertEquals("3,10: spot i="+i,
                    1.0f,
-                   s.computeNorm("foo", invertState),
+                   s.computeNorm(invertState),
                    0.0f);
     }
   
     for (int i = 10; i < 1000; i++) {
       invertState.setLength(i-9);
-      final float normD = d.computeNorm("foo", invertState);
+      final float normD = d.computeNorm(invertState);
       invertState.setLength(i);
-      final float normS = s.computeNorm("foo", invertState);
+      final float normS = s.computeNorm(invertState);
       assertEquals("3,10: 10<x : i="+i,
                    normD,
                    normS,
@@ -74,22 +75,42 @@ public class SweetSpotSimilarityTest ext
 
     // seperate sweet spot for certain fields
 
-    ss.setLengthNormFactors("bar",8,13, 0.5f, false);
-    ss.setLengthNormFactors("yak",6,9, 0.5f, false);
-
+    final SweetSpotSimilarity ssBar = new SweetSpotSimilarity();
+    ssBar.setLengthNormFactors(8,13, 0.5f, false);
+    final SweetSpotSimilarity ssYak = new SweetSpotSimilarity();
+    ssYak.setLengthNormFactors(6,9, 0.5f, false);
+    final SweetSpotSimilarity ssA = new SweetSpotSimilarity();
+    ssA.setLengthNormFactors(5,8,0.5f, false);
+    final SweetSpotSimilarity ssB = new SweetSpotSimilarity();
+    ssB.setLengthNormFactors(5,8,0.1f, false);
+    
+    SimilarityProvider sp = new SweetSpotSimilarity() {
+      public Similarity get(String field) {
+        if (field.equals("bar"))
+          return ssBar;
+        else if (field.equals("yak"))
+          return ssYak;
+        else if (field.equals("a"))
+          return ssA;
+        else if (field.equals("b"))
+          return ssB;
+        else
+          return ss;
+      }
+    };
   
     for (int i = 3; i <=10; i++) {
       invertState.setLength(i);
       assertEquals("f: 3,10: spot i="+i,
                    1.0f,
-                   s.computeNorm("foo", invertState),
+                   sp.get("foo").computeNorm(invertState),
                    0.0f);
     }
     for (int i = 10; i < 1000; i++) {
       invertState.setLength(i-9);
-      final float normD = d.computeNorm("foo", invertState);
+      final float normD = d.computeNorm(invertState);
       invertState.setLength(i);
-      final float normS = s.computeNorm("foo", invertState);
+      final float normS = sp.get("foo").computeNorm(invertState);
       assertEquals("f: 3,10: 10<x : i="+i,
                    normD,
                    normS,
@@ -99,21 +120,21 @@ public class SweetSpotSimilarityTest ext
       invertState.setLength(i);
       assertEquals("f: 8,13: spot i="+i,
                    1.0f,
-                   s.computeNorm("bar", invertState),
+                   sp.get("bar").computeNorm(invertState),
                    0.0f);
     }
     for (int i = 6; i <=9; i++) {
       invertState.setLength(i);
       assertEquals("f: 6,9: spot i="+i,
                    1.0f,
-                   s.computeNorm("yak", invertState),
+                   sp.get("yak").computeNorm(invertState),
                    0.0f);
     }
     for (int i = 13; i < 1000; i++) {
       invertState.setLength(i-12);
-      final float normD = d.computeNorm("foo", invertState);
+      final float normD = d.computeNorm(invertState);
       invertState.setLength(i);
-      final float normS = s.computeNorm("bar", invertState);
+      final float normS = sp.get("bar").computeNorm(invertState);
       assertEquals("f: 8,13: 13<x : i="+i,
                    normD,
                    normS,
@@ -121,9 +142,9 @@ public class SweetSpotSimilarityTest ext
     }
     for (int i = 9; i < 1000; i++) {
       invertState.setLength(i-8);
-      final float normD = d.computeNorm("foo", invertState);
+      final float normD = d.computeNorm(invertState);
       invertState.setLength(i);
-      final float normS = s.computeNorm("yak", invertState);
+      final float normS = sp.get("yak").computeNorm(invertState);
       assertEquals("f: 6,9: 9<x : i="+i,
                    normD,
                    normS,
@@ -133,13 +154,10 @@ public class SweetSpotSimilarityTest ext
 
     // steepness
 
-    ss.setLengthNormFactors("a",5,8,0.5f, false);
-    ss.setLengthNormFactors("b",5,8,0.1f, false);
-
     for (int i = 9; i < 1000; i++) {
       invertState.setLength(i);
-      final float normSS = ss.computeNorm("a", invertState);
-      final float normS = s.computeNorm("b", invertState);
+      final float normSS = sp.get("a").computeNorm(invertState);
+      final float normS = sp.get("b").computeNorm(invertState);
       assertTrue("s: i="+i+" : a="+normSS+
                  " < b="+normS,
                  normSS < normS);

Modified: lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/test/org/apache/lucene/misc/TestLengthNormModifier.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/test/org/apache/lucene/misc/TestLengthNormModifier.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/test/org/apache/lucene/misc/TestLengthNormModifier.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/test/org/apache/lucene/misc/TestLengthNormModifier.java Mon Feb 14 14:58:04 2011
@@ -49,7 +49,7 @@ public class TestLengthNormModifier exte
     /** 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());
         }
       };
@@ -165,7 +165,7 @@ public class TestLengthNormModifier exte
 	// override the norms to be inverted
 	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());
             }
           };

Modified: lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/document/AbstractField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/document/AbstractField.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/document/AbstractField.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/document/AbstractField.java Mon Feb 14 14:58:04 2011
@@ -76,17 +76,14 @@ public abstract class AbstractField impl
    * name, all such values are multiplied together.  This product is then
    * used to compute the norm factor for the field.  By
    * default, in the {@link
-   * org.apache.lucene.search.Similarity#computeNorm(String,
-   * FieldInvertState)} method, the boost value is multiplied
-   * by the {@link
-   * org.apache.lucene.search.Similarity#lengthNorm(String,
-   * int)} and then
+   * org.apache.lucene.search.Similarity#computeNorm(FieldInvertState)} method, the boost value is multiplied
+   * by the length normalization factor and then
    * rounded by {@link org.apache.lucene.search.Similarity#encodeNormValue(float)} before it is stored in the
    * index.  One should attempt to ensure that this product does not overflow
    * the range of that encoding.
    *
    * @see org.apache.lucene.document.Document#setBoost(float)
-   * @see org.apache.lucene.search.Similarity#computeNorm(String, FieldInvertState)
+   * @see org.apache.lucene.search.Similarity#computeNorm(FieldInvertState)
    * @see org.apache.lucene.search.Similarity#encodeNormValue(float)
    */
   public void setBoost(float boost) {

Modified: lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/document/Fieldable.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/document/Fieldable.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/document/Fieldable.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/document/Fieldable.java Mon Feb 14 14:58:04 2011
@@ -43,16 +43,14 @@ public interface Fieldable {
    * name, all such values are multiplied together.  This product is then
    * used to compute the norm factor for the field.  By
    * default, in the {@link
-   * org.apache.lucene.search.Similarity#computeNorm(String,
-   * FieldInvertState)} method, the boost value is multiplied
-   * by the {@link
-   * org.apache.lucene.search.Similarity#lengthNorm(String,
-   * int)} and then rounded by {@link org.apache.lucene.search.Similarity#encodeNormValue(float)} before it is stored in the
+   * org.apache.lucene.search.Similarity#computeNorm(FieldInvertState)} method, the boost value is multiplied
+   * by the length normalization factor
+   * and then rounded by {@link org.apache.lucene.search.Similarity#encodeNormValue(float)} before it is stored in the
    * index.  One should attempt to ensure that this product does not overflow
    * the range of that encoding.
    *
    * @see org.apache.lucene.document.Document#setBoost(float)
-   * @see org.apache.lucene.search.Similarity#computeNorm(String, FieldInvertState)
+   * @see org.apache.lucene.search.Similarity#computeNorm(FieldInvertState)
    * @see org.apache.lucene.search.Similarity#encodeNormValue(float)
    */
   void setBoost(float boost);

Modified: lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/IndexReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/IndexReader.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/IndexReader.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/IndexReader.java Mon Feb 14 14:58:04 2011
@@ -1004,8 +1004,8 @@ public abstract class IndexReader implem
 
   /** Expert: Resets the normalization factor for the named field of the named
    * document.  The norm represents the product of the field's {@link
-   * org.apache.lucene.document.Fieldable#setBoost(float) boost} and its {@link Similarity#lengthNorm(String,
-   * int) length normalization}.  Thus, to preserve the length normalization
+   * org.apache.lucene.document.Fieldable#setBoost(float) boost} and its
+   * length normalization}.  Thus, to preserve the length normalization
    * values when resetting this, one should base the new value upon the old.
    *
    * <b>NOTE:</b> If this field does not store norms, then

Modified: lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/NormsWriterPerField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/NormsWriterPerField.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/NormsWriterPerField.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/NormsWriterPerField.java Mon Feb 14 14:58:04 2011
@@ -74,7 +74,7 @@ final class NormsWriterPerField extends 
         assert norms.length == upto;
         norms = ArrayUtil.grow(norms, 1+upto);
       }
-      final float norm = similarity.computeNorm(fieldInfo.name, fieldState);
+      final float norm = similarity.computeNorm(fieldState);
       norms[upto] = similarity.encodeNormValue(norm);
       docIDs[upto] = docState.docID;
       upto++;

Modified: lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/queryParser/QueryParserBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/queryParser/QueryParserBase.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/queryParser/QueryParserBase.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/queryParser/QueryParserBase.java Mon Feb 14 14:58:04 2011
@@ -467,7 +467,14 @@ public abstract class QueryParserBase {
   /**
    * @exception org.apache.lucene.queryParser.ParseException throw in overridden method to disallow
    */
-  protected Query getFieldQuery(String field, String queryText, boolean quoted)  throws ParseException {
+  protected Query getFieldQuery(String field, String queryText, boolean quoted) throws ParseException {
+    return newFieldQuery(analyzer, field, queryText, quoted);
+  }
+  
+  /**
+   * @exception org.apache.lucene.queryParser.ParseException throw in overridden method to disallow
+   */
+  protected Query newFieldQuery(Analyzer analyzer, String field, String queryText, boolean quoted)  throws ParseException {
     // Use the analyzer to get all the tokens, and then build a TermQuery,
     // PhraseQuery, or nothing based on the term count
 

Modified: lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/DefaultSimilarity.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/DefaultSimilarity.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/DefaultSimilarity.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/DefaultSimilarity.java Mon Feb 14 14:58:04 2011
@@ -31,7 +31,7 @@ public class DefaultSimilarity extends S
    *
    *  @lucene.experimental */
   @Override
-  public float computeNorm(String field, FieldInvertState state) {
+  public float computeNorm(FieldInvertState state) {
     final int numTerms;
     if (discountOverlaps)
       numTerms = state.getLength() - state.getNumOverlap();

Modified: lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/Similarity.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/Similarity.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/Similarity.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/Similarity.java Mon Feb 14 14:58:04 2011
@@ -561,49 +561,13 @@ public abstract class Similarity {
    * Thus they have limited precision, and documents
    * must be re-indexed if this method is altered.
    *
-   * <p>For backward compatibility this method by default calls
-   * {@link #lengthNorm(String, int)} passing
-   * {@link FieldInvertState#getLength()} as the second argument, and
-   * then multiplies this value by {@link FieldInvertState#getBoost()}.</p>
-   * 
    * @lucene.experimental
    * 
-   * @param field field name
    * @param state current processing state for this field
    * @return the calculated float norm
    */
-  public abstract float computeNorm(String field, FieldInvertState state);
+  public abstract float computeNorm(FieldInvertState state);
   
-  /** Computes the normalization value for a field given the total number of
-   * terms contained in a field.  These values, together with field boosts, are
-   * stored in an index and multipled into scores for hits on each field by the
-   * search code.
-   *
-   * <p>Matches in longer fields are less precise, so implementations of this
-   * method usually return smaller values when <code>numTokens</code> is large,
-   * and larger values when <code>numTokens</code> is small.
-   * 
-   * <p>Note that the return values are computed under 
-   * {@link org.apache.lucene.index.IndexWriter#addDocument(org.apache.lucene.document.Document)} 
-   * and then stored using
-   * {@link #encodeNormValue(float)}.  
-   * Thus they have limited precision, and documents
-   * must be re-indexed if this method is altered.
-   *
-   * @param fieldName the name of the field
-   * @param numTokens the total number of tokens contained in fields named
-   * <i>fieldName</i> of <i>doc</i>.
-   * @return a normalization factor for hits on this field of this document
-   *
-   * @see org.apache.lucene.document.Field#setBoost(float)
-   *
-   * @deprecated Please override computeNorm instead
-   */
-  @Deprecated
-  public final float lengthNorm(String fieldName, int numTokens) {
-    throw new UnsupportedOperationException("please use computeNorm instead");
-  }
-
   /** Encodes a normalization factor for storage in an index.
    *
    * <p>The encoding uses a three-bit mantissa, a five-bit exponent, and
@@ -781,7 +745,6 @@ public abstract class Similarity {
    * The default implementation returns 1.
    *
    * @param docId The docId currently being scored.  If this value is {@link #NO_DOC_ID_PROVIDED}, then it should be assumed that the PayloadQuery implementation does not provide document information
-   * @param fieldName The fieldName of the term this payload belongs to
    * @param start The start position of the payload
    * @param end The end position of the payload
    * @param payload The payload byte array to be scored
@@ -791,7 +754,7 @@ public abstract class Similarity {
    *
    */
   // TODO: maybe switch this API to BytesRef?
-  public float scorePayload(int docId, String fieldName, int start, int end, byte [] payload, int offset, int length)
+  public float scorePayload(int docId, int start, int end, byte [] payload, int offset, int length)
   {
     return 1;
   }

Modified: lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/payloads/PayloadNearQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/payloads/PayloadNearQuery.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/payloads/PayloadNearQuery.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/payloads/PayloadNearQuery.java Mon Feb 14 14:58:04 2011
@@ -192,7 +192,7 @@ public class PayloadNearQuery extends Sp
     protected void processPayloads(Collection<byte[]> payLoads, int start, int end) {
       for (final byte[] thePayload : payLoads) {
         payloadScore = function.currentScore(doc, fieldName, start, end,
-            payloadsSeen, payloadScore, similarity.scorePayload(doc, fieldName,
+            payloadsSeen, payloadScore, similarity.scorePayload(doc,
                 spans.start(), spans.end(), thePayload, 0, thePayload.length));
         ++payloadsSeen;
       }

Modified: lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/payloads/PayloadTermQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/payloads/PayloadTermQuery.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/payloads/PayloadTermQuery.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/search/payloads/PayloadTermQuery.java Mon Feb 14 14:58:04 2011
@@ -41,7 +41,7 @@ import java.io.IOException;
  * {@link org.apache.lucene.index.Term} occurs.
  * <p>
  * In order to take advantage of this, you must override
- * {@link org.apache.lucene.search.Similarity#scorePayload(int, String, int, int, byte[],int,int)}
+ * {@link org.apache.lucene.search.Similarity#scorePayload(int, int, int, byte[],int,int)}
  * which returns 1 by default.
  * <p>
  * Payload scores are aggregated using a pluggable {@link PayloadFunction}.
@@ -119,14 +119,14 @@ public class PayloadTermQuery extends Sp
           if (payload != null) {
             payloadScore = function.currentScore(doc, term.field(),
                                                  spans.start(), spans.end(), payloadsSeen, payloadScore,
-                                                 similarity.scorePayload(doc, term.field(), spans.start(),
+                                                 similarity.scorePayload(doc, spans.start(),
                                                                          spans.end(), payload.bytes,
                                                                          payload.offset,
                                                                          payload.length));
           } else {
             payloadScore = function.currentScore(doc, term.field(),
                                                  spans.start(), spans.end(), payloadsSeen, payloadScore,
-                                                 similarity.scorePayload(doc, term.field(), spans.start(),
+                                                 similarity.scorePayload(doc, spans.start(),
                                                                          spans.end(), null,
                                                                          0,
                                                                          0));

Modified: lucene/dev/branches/bulkpostings/lucene/src/test-framework/org/apache/lucene/index/codecs/mockrandom/MockRandomCodec.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/test-framework/org/apache/lucene/index/codecs/mockrandom/MockRandomCodec.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/test-framework/org/apache/lucene/index/codecs/mockrandom/MockRandomCodec.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/src/test-framework/org/apache/lucene/index/codecs/mockrandom/MockRandomCodec.java Mon Feb 14 14:58:04 2011
@@ -18,15 +18,17 @@ package org.apache.lucene.index.codecs.m
  */
 
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Random;
 import java.util.Set;
 
+import org.apache.lucene.index.FieldInfo;
 import org.apache.lucene.index.IndexFileNames;
 import org.apache.lucene.index.SegmentInfo;
 import org.apache.lucene.index.SegmentReadState;
 import org.apache.lucene.index.SegmentWriteState;
-import org.apache.lucene.index.FieldInfo;
 import org.apache.lucene.index.codecs.BlockTermsReader;
 import org.apache.lucene.index.codecs.BlockTermsWriter;
 import org.apache.lucene.index.codecs.Codec;
@@ -46,6 +48,9 @@ import org.apache.lucene.index.codecs.mo
 import org.apache.lucene.index.codecs.mocksep.MockSingleIntFactory;
 import org.apache.lucene.index.codecs.pulsing.PulsingPostingsReaderImpl;
 import org.apache.lucene.index.codecs.pulsing.PulsingPostingsWriterImpl;
+import org.apache.lucene.index.codecs.sep.IntIndexInput;
+import org.apache.lucene.index.codecs.sep.IntIndexOutput;
+import org.apache.lucene.index.codecs.sep.IntStreamFactory;
 import org.apache.lucene.index.codecs.sep.SepPostingsReaderImpl;
 import org.apache.lucene.index.codecs.sep.SepPostingsWriterImpl;
 import org.apache.lucene.index.codecs.standard.StandardPostingsReader;
@@ -71,11 +76,57 @@ public class MockRandomCodec extends Cod
     this.seedRandom = new Random(random.nextLong());
   }
 
+  // Chooses random IntStreamFactory depending on file's extension
+  private static class MockIntStreamFactory extends IntStreamFactory {
+    private final int salt;
+    private final List<IntStreamFactory> delegates = new ArrayList<IntStreamFactory>();
+
+    public MockIntStreamFactory(Random random) {
+      salt = random.nextInt();
+      delegates.add(new MockSingleIntFactory());
+      final int blockSize = _TestUtil.nextInt(random, 1, 2000);
+      delegates.add(new MockFixedIntBlockCodec.MockIntFactory(blockSize));
+      final int baseBlockSize = _TestUtil.nextInt(random, 1, 127);
+      delegates.add(new MockVariableIntBlockCodec.MockIntFactory(baseBlockSize));
+      // TODO: others
+    }
+
+    private static String getExtension(String fileName) {
+      final int idx = fileName.indexOf('.');
+      assert idx != -1;
+      return fileName.substring(idx);
+    }
+
+    @Override
+    public IntIndexInput openInput(Directory dir, String fileName, int readBufferSize) throws IOException {
+      // Must only use extension, because IW.addIndexes can
+      // rename segment!
+      final IntStreamFactory f = delegates.get((Math.abs(salt ^ getExtension(fileName).hashCode())) % delegates.size());
+      if (LuceneTestCase.VERBOSE) {
+        System.out.println("MockRandomCodec: read using int factory " + f + " from fileName=" + fileName);
+      }
+      return f.openInput(dir, fileName, readBufferSize);
+    }
+
+    @Override
+    public IntIndexOutput createOutput(Directory dir, String fileName) throws IOException {
+      final IntStreamFactory f = delegates.get((Math.abs(salt ^ getExtension(fileName).hashCode())) % delegates.size());
+      if (LuceneTestCase.VERBOSE) {
+        System.out.println("MockRandomCodec: write using int factory " + f + " to fileName=" + fileName);
+      }
+      return f.createOutput(dir, fileName);
+    }
+  }
+
   @Override
   public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
 
     final long seed = seedRandom.nextLong();
 
+    if (LuceneTestCase.VERBOSE) {
+      System.out.println("MockRandomCodec: writing to seg=" + state.segmentName + " seed=" + seed);
+    }
+
     final String seedFileName = IndexFileNames.segmentFileName(state.segmentName, state.codecId, SEED_EXT);
     final IndexOutput out = state.directory.createOutput(seedFileName);
     out.writeLong(seed);
@@ -83,25 +134,9 @@ public class MockRandomCodec extends Cod
 
     final Random random = new Random(seed);
     PostingsWriterBase postingsWriter;
-    final int n = random.nextInt(4);
 
-    if (n == 0) {
-      if (LuceneTestCase.VERBOSE) {
-        System.out.println("MockRandomCodec: writing MockSep postings");
-      }
-      postingsWriter = new SepPostingsWriterImpl(state, new MockSingleIntFactory());
-    } else if (n == 1) {
-      final int blockSize = _TestUtil.nextInt(random, 1, 2000);
-      if (LuceneTestCase.VERBOSE) {
-        System.out.println("MockRandomCodec: writing MockFixedIntBlock(" + blockSize + ") postings");
-      }
-      postingsWriter = new SepPostingsWriterImpl(state, new MockFixedIntBlockCodec.MockIntFactory(blockSize));
-    } else if (n == 2) {
-      final int baseBlockSize = _TestUtil.nextInt(random, 1, 127);
-      if (LuceneTestCase.VERBOSE) {
-        System.out.println("MockRandomCodec: writing MockVariableIntBlock(" + baseBlockSize + ") postings");
-      }
-      postingsWriter = new SepPostingsWriterImpl(state, new MockVariableIntBlockCodec.MockIntFactory(baseBlockSize));
+    if (random.nextBoolean()) {
+      postingsWriter = new SepPostingsWriterImpl(state, new MockIntStreamFactory(random));
     } else {
       if (LuceneTestCase.VERBOSE) {
         System.out.println("MockRandomCodec: writing Standard postings");
@@ -190,32 +225,17 @@ public class MockRandomCodec extends Cod
     final String seedFileName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.codecId, SEED_EXT);
     final IndexInput in = state.dir.openInput(seedFileName);
     final long seed = in.readLong();
+    if (LuceneTestCase.VERBOSE) {
+      System.out.println("MockRandomCodec: reading from seg=" + state.segmentInfo.name + " seed=" + seed);
+    }
     in.close();
 
     final Random random = new Random(seed);
     PostingsReaderBase postingsReader;
-    final int n = random.nextInt(4);
 
-    if (n == 0) {
-      if (LuceneTestCase.VERBOSE) {
-        System.out.println("MockRandomCodec: reading MockSep postings");
-      }
-      postingsReader = new SepPostingsReaderImpl(state.dir, state.segmentInfo,
-                                                 state.readBufferSize, new MockSingleIntFactory(), state.codecId);
-    } else if (n == 1) {
-      final int blockSize = _TestUtil.nextInt(random, 1, 2000);
-      if (LuceneTestCase.VERBOSE) {
-        System.out.println("MockRandomCodec: reading MockFixedIntBlock(" + blockSize + ") postings");
-      }
-      postingsReader = new SepPostingsReaderImpl(state.dir, state.segmentInfo,
-                                                 state.readBufferSize, new MockFixedIntBlockCodec.MockIntFactory(blockSize), state.codecId);
-    } else if (n == 2) {
-      final int baseBlockSize = _TestUtil.nextInt(random, 1, 127);
-      if (LuceneTestCase.VERBOSE) {
-        System.out.println("MockRandomCodec: reading MockVariableIntBlock(" + baseBlockSize + ") postings");
-      }
+    if (random.nextBoolean()) {
       postingsReader = new SepPostingsReaderImpl(state.dir, state.segmentInfo,
-                                                 state.readBufferSize, new MockVariableIntBlockCodec.MockIntFactory(baseBlockSize), state.codecId);
+                                                 state.readBufferSize, new MockIntStreamFactory(random), state.codecId);
     } else {
       if (LuceneTestCase.VERBOSE) {
         System.out.println("MockRandomCodec: reading Standard postings");

Modified: lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestDoc.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestDoc.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestDoc.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestDoc.java Mon Feb 14 14:58:04 2011
@@ -57,6 +57,9 @@ public class TestDoc extends LuceneTestC
     @Override
     public void setUp() throws Exception {
         super.setUp();
+        if (VERBOSE) {
+          System.out.println("TEST: setUp");
+        }
         workDir = new File(TEMP_DIR,"TestDoc");
         workDir.mkdirs();
 

Modified: lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java Mon Feb 14 14:58:04 2011
@@ -43,7 +43,7 @@ public class TestIndexReaderCloneNorms e
 
   private class SimilarityOne extends DefaultSimilarity {
     @Override
-    public float computeNorm(String fieldName, FieldInvertState state) {
+    public float computeNorm(FieldInvertState state) {
       // diable length norm
       return state.getBoost();
     }
@@ -106,13 +106,17 @@ public class TestIndexReaderCloneNorms e
     Directory dir3 = newDirectory();
 
     createIndex(random, dir3);
+    if (VERBOSE) {
+      System.out.println("TEST: now addIndexes/optimize");
+    }
     IndexWriter iw = new IndexWriter(
         dir3,
         newIndexWriterConfig(TEST_VERSION_CURRENT, anlzr).
             setOpenMode(OpenMode.APPEND).
             setMaxBufferedDocs(5).
-            setMergePolicy(newLogMergePolicy(3))
+        setMergePolicy(newLogMergePolicy(3))
     );
+    iw.setInfoStream(VERBOSE ? System.out : null);
     iw.addIndexes(dir1, dir2);
     iw.optimize();
     iw.close();
@@ -146,6 +150,9 @@ public class TestIndexReaderCloneNorms e
 
   // try cloning and reopening the norms
   private void doTestNorms(Random random, Directory dir) throws IOException {
+    if (VERBOSE) {
+      System.out.println("TEST: now doTestNorms");
+    }
     addDocs(random, dir, 12, true);
     IndexReader ir = IndexReader.open(dir, false);
     verifyIndex(ir);
@@ -237,13 +244,20 @@ public class TestIndexReaderCloneNorms e
   }
   
   private void createIndex(Random random, Directory dir) throws IOException {
+    if (VERBOSE) {
+      System.out.println("TEST: createIndex");
+    }
     IndexWriter iw = new IndexWriter(dir, newIndexWriterConfig(
         TEST_VERSION_CURRENT, anlzr).setOpenMode(OpenMode.CREATE)
                                      .setMaxBufferedDocs(5).setSimilarityProvider(similarityOne).setMergePolicy(newLogMergePolicy()));
+
     LogMergePolicy lmp = (LogMergePolicy) iw.getConfig().getMergePolicy();
     lmp.setMergeFactor(3);
     lmp.setUseCompoundFile(true);
     iw.close();
+    if (VERBOSE) {
+      System.out.println("TEST: done createIndex");
+    }
   }
 
   private void modifyNormsForF1(IndexReader ir) throws IOException {
@@ -298,6 +312,7 @@ public class TestIndexReaderCloneNorms e
     lmp.setMergeFactor(3);
     lmp.setUseCompoundFile(compound);
     IndexWriter iw = new IndexWriter(dir, conf);
+    iw.setInfoStream(VERBOSE ? System.out : null);
     for (int i = 0; i < ndocs; i++) {
       iw.addDocument(newDoc());
     }

Modified: lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestMaxTermFrequency.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestMaxTermFrequency.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestMaxTermFrequency.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestMaxTermFrequency.java Mon Feb 14 14:58:04 2011
@@ -109,7 +109,7 @@ public class TestMaxTermFrequency extend
     }
 
     @Override
-    public float computeNorm(String field, FieldInvertState state) {
+    public float computeNorm(FieldInvertState state) {
       return (float) state.getMaxTermFrequency();
     }
   }

Modified: lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestNorms.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestNorms.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestNorms.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestNorms.java Mon Feb 14 14:58:04 2011
@@ -42,7 +42,7 @@ public class TestNorms extends LuceneTes
 
   private class SimilarityOne extends DefaultSimilarity {
     @Override
-    public float computeNorm(String fieldName, FieldInvertState state) {
+    public float computeNorm(FieldInvertState state) {
       // Disable length norm
       return state.getBoost();
     }
@@ -252,7 +252,7 @@ public class TestNorms extends LuceneTes
     }
 
     @Override
-    public float computeNorm(String field, FieldInvertState state) {
+    public float computeNorm(FieldInvertState state) {
       return (float) state.getLength();
     }
   }

Modified: lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestOmitTf.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestOmitTf.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestOmitTf.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/index/TestOmitTf.java Mon Feb 14 14:58:04 2011
@@ -36,7 +36,7 @@ import org.apache.lucene.search.Explanat
 public class TestOmitTf extends LuceneTestCase {
   
   public static class SimpleSimilarity extends Similarity implements SimilarityProvider {
-    @Override public float computeNorm(String field, FieldInvertState state) { return state.getBoost(); }
+    @Override public float computeNorm(FieldInvertState state) { return state.getBoost(); }
     @Override public float tf(float freq) { return freq; }
     @Override public float sloppyFreq(int distance) { return 2.0f; }
     @Override public float idf(int docFreq, int numDocs) { return 1.0f; }

Modified: lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java Mon Feb 14 14:58:04 2011
@@ -35,6 +35,7 @@ import org.apache.lucene.analysis.TokenS
 import org.apache.lucene.analysis.Tokenizer;
 import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
 import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
+import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
 import org.apache.lucene.document.DateTools;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
@@ -58,6 +59,7 @@ import org.apache.lucene.search.Wildcard
 import org.apache.lucene.search.BooleanClause.Occur;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.Version;
 import org.apache.lucene.util.automaton.BasicAutomata;
 import org.apache.lucene.util.automaton.CharacterRunAutomaton;
 import org.apache.lucene.util.automaton.RegExp;
@@ -1175,5 +1177,87 @@ public class TestQueryParser extends Luc
       // expected
     }
   }
+  
+  /**
+   * adds synonym of "dog" for "dogs".
+   */
+  private class MockSynonymFilter extends TokenFilter {
+    CharTermAttribute termAtt = addAttribute(CharTermAttribute.class);
+    PositionIncrementAttribute posIncAtt = addAttribute(PositionIncrementAttribute.class);
+    boolean addSynonym = false;
+    
+    public MockSynonymFilter(TokenStream input) {
+      super(input);
+    }
+
+    @Override
+    public final boolean incrementToken() throws IOException {
+      if (addSynonym) { // inject our synonym
+        clearAttributes();
+        termAtt.setEmpty().append("dog");
+        posIncAtt.setPositionIncrement(0);
+        addSynonym = false;
+        return true;
+      }
+      
+      if (input.incrementToken()) {
+        addSynonym = termAtt.toString().equals("dogs");
+        return true;
+      } else {
+        return false;
+      }
+    } 
+  }
+  
+  /** whitespace+lowercase analyzer with synonyms */
+  private class Analyzer1 extends Analyzer {
+    @Override
+    public TokenStream tokenStream(String fieldName, Reader reader) {
+      return new MockSynonymFilter(new MockTokenizer(reader, MockTokenizer.WHITESPACE, true));
+    }
+  }
+  
+  /** whitespace+lowercase analyzer without synonyms */
+  private class Analyzer2 extends Analyzer {
+    @Override
+    public TokenStream tokenStream(String fieldName, Reader reader) {
+      return new MockTokenizer(reader, MockTokenizer.WHITESPACE, true);
+    }
+  }
+  
+  /** query parser that doesn't expand synonyms when users use double quotes */
+  private class SmartQueryParser extends QueryParser {
+    Analyzer morePrecise = new Analyzer2();
+    
+    public SmartQueryParser() {
+      super(TEST_VERSION_CURRENT, "field", new Analyzer1());
+    }
 
+    @Override
+    protected Query getFieldQuery(String field, String queryText, boolean quoted)
+        throws ParseException {
+      if (quoted)
+        return newFieldQuery(morePrecise, field, queryText, quoted);
+      else
+        return super.getFieldQuery(field, queryText, quoted);
+    }
+  }
+  
+  public void testNewFieldQuery() throws Exception {
+    /** ordinary behavior, synonyms form uncoordinated boolean query */
+    QueryParser dumb = new QueryParser(TEST_VERSION_CURRENT, "field", new Analyzer1());
+    BooleanQuery expanded = new BooleanQuery(true);
+    expanded.add(new TermQuery(new Term("field", "dogs")), BooleanClause.Occur.SHOULD);
+    expanded.add(new TermQuery(new Term("field", "dog")), BooleanClause.Occur.SHOULD);
+    assertEquals(expanded, dumb.parse("\"dogs\""));
+    /** even with the phrase operator the behavior is the same */
+    assertEquals(expanded, dumb.parse("dogs"));
+    
+    /** custom behavior, the synonyms are expanded, unless you use quote operator */
+    QueryParser smart = new SmartQueryParser();
+    assertEquals(expanded, smart.parse("dogs"));
+    
+    Query unexpanded = new TermQuery(new Term("field", "dogs"));
+    assertEquals(unexpanded, smart.parse("\"dogs\""));
+  }
 }

Modified: lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/JustCompileSearch.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/JustCompileSearch.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/JustCompileSearch.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/JustCompileSearch.java Mon Feb 14 14:58:04 2011
@@ -248,7 +248,7 @@ final class JustCompileSearch {
     }
 
     @Override
-    public float computeNorm(String fieldName, FieldInvertState state) {
+    public float computeNorm(FieldInvertState state) {
       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
     }
 

Modified: lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java Mon Feb 14 14:58:04 2011
@@ -62,7 +62,7 @@ public class TestDisjunctionMaxQuery ext
     }
     
     @Override
-    public float computeNorm(String fieldName, FieldInvertState state) {
+    public float computeNorm(FieldInvertState state) {
       // Disable length norm
       return state.getBoost();
     }

Modified: lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java Mon Feb 14 14:58:04 2011
@@ -23,6 +23,7 @@ import org.apache.lucene.document.Docume
 import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.index.RandomIndexWriter;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.store.Directory;
@@ -59,7 +60,9 @@ public class TestMultiTermConstantScore 
         "X       4 5 6" };
 
     small = newDirectory();
-    RandomIndexWriter writer = new RandomIndexWriter(random, small, new MockAnalyzer(MockTokenizer.WHITESPACE, false));
+    RandomIndexWriter writer = new RandomIndexWriter(random, small, 
+        newIndexWriterConfig(TEST_VERSION_CURRENT, 
+            new MockAnalyzer(MockTokenizer.WHITESPACE, false)).setMergePolicy(newInOrderLogMergePolicy()));
 
     for (int i = 0; i < data.length; i++) {
       Document doc = new Document();

Modified: lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/TestSimilarity.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/TestSimilarity.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/TestSimilarity.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/TestSimilarity.java Mon Feb 14 14:58:04 2011
@@ -40,7 +40,7 @@ import org.apache.lucene.search.Explanat
 public class TestSimilarity extends LuceneTestCase {
   
   public static class SimpleSimilarity extends Similarity implements SimilarityProvider {
-    @Override public float computeNorm(String field, FieldInvertState state) { return state.getBoost(); }
+    @Override public float computeNorm(FieldInvertState state) { return state.getBoost(); }
     @Override public float tf(float freq) { return freq; }
     @Override public float sloppyFreq(int distance) { return 2.0f; }
     @Override public float idf(int docFreq, int numDocs) { return 1.0f; }

Modified: lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/TestSimilarityProvider.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/TestSimilarityProvider.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/TestSimilarityProvider.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/TestSimilarityProvider.java Mon Feb 14 14:58:04 2011
@@ -107,7 +107,7 @@ public class TestSimilarityProvider exte
   
   private class Sim1 extends Similarity {
     @Override
-    public float computeNorm(String field, FieldInvertState state) {
+    public float computeNorm(FieldInvertState state) {
       return 1f;
     }
 
@@ -129,7 +129,7 @@ public class TestSimilarityProvider exte
   
   private class Sim2 extends Similarity {
     @Override
-    public float computeNorm(String field, FieldInvertState state) {
+    public float computeNorm(FieldInvertState state) {
       return 10f;
     }
 

Modified: lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java Mon Feb 14 14:58:04 2011
@@ -299,14 +299,14 @@ public class TestPayloadNearQuery extend
   // must be static for weight serialization tests 
   static class BoostingSimilarity extends DefaultSimilarity {
 
-    @Override public float scorePayload(int docId, String fieldName, int start, int end, byte[] payload, int offset, int length) {
+    @Override public float scorePayload(int docId, int start, int end, byte[] payload, int offset, int length) {
       //we know it is size 4 here, so ignore the offset/length
       return payload[offset];
     }
     //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     //Make everything else 1 so we see the effect of the payload
     //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-    @Override public float computeNorm(String fieldName, FieldInvertState state) {
+    @Override public float computeNorm(FieldInvertState state) {
       return state.getBoost();
     }
 

Modified: lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java Mon Feb 14 14:58:04 2011
@@ -287,7 +287,7 @@ public class TestPayloadTermQuery extend
 
     // TODO: Remove warning after API has been finalized
     @Override
-    public float scorePayload(int docId, String fieldName, int start, int end, byte[] payload, int offset, int length) {
+    public float scorePayload(int docId, int start, int end, byte[] payload, int offset, int length) {
       //we know it is size 4 here, so ignore the offset/length
       return payload[offset];
     }
@@ -296,7 +296,7 @@ public class TestPayloadTermQuery extend
     //Make everything else 1 so we see the effect of the payload
     //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     @Override
-    public float computeNorm(String fieldName, FieldInvertState state) {
+    public float computeNorm(FieldInvertState state) {
       return state.getBoost();
     }
 

Modified: lucene/dev/branches/bulkpostings/solr/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/build.xml?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/build.xml (original)
+++ lucene/dev/branches/bulkpostings/solr/build.xml Mon Feb 14 14:58:04 2011
@@ -756,6 +756,12 @@
         excludes="*.tgz *.zip *.md5 **/*src*.jar **/*docs*.jar" />
       <tarfileset dir="${build.docs}"
         prefix="${fullnamever}/docs/" />
+      <tarfileset dir="../lucene"
+        prefix="lucene"
+        excludes="**/build/" />
+      <tarfileset dir="../modules"
+        prefix="modules"
+        excludes="**/build/" />
     </tar>
     <solr-checksum file="${dist}/${fullnamever}.tgz"/>
 
@@ -775,6 +781,12 @@
         prefix="${fullnamever}"
         includes="**/*.sh **/bin/ src/scripts/"
         filemode="755" />
+      <zipfileset dir="../lucene"
+        prefix="lucene"
+        excludes="**/build/" />
+      <zipfileset dir="../modules"
+        prefix="modules"
+        excludes="**/build/" />
     </zip>
     <solr-checksum file="${dist}/${fullnamever}.zip"/>
 

Modified: lucene/dev/branches/bulkpostings/solr/contrib/uima/README.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/contrib/uima/README.txt?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/contrib/uima/README.txt (original)
+++ lucene/dev/branches/bulkpostings/solr/contrib/uima/README.txt Mon Feb 14 14:58:04 2011
@@ -35,6 +35,12 @@ To start using Solr UIMA Metadata Extrac
       </type>
     </fieldMapping>
   </uimaConfig>
+
+   where VALID_ALCHEMYAPI_KEY is your AlchemyAPI Access Key. You need to register AlchemyAPI Access
+   key to exploit the AlchemyAPI services: http://www.alchemyapi.com/api/register.html
+
+   where VALID_OPENCALAIS_KEY is your Calais Service Key. You need to register Calais Service
+   key to exploit the Calais services: http://www.opencalais.com/apikey
   
 5. the analysisEngine tag must contain an AE descriptor inside the specified path in the classpath
 
@@ -45,7 +51,7 @@ To start using Solr UIMA Metadata Extrac
 
 8. define in your solrconfig.xml an UpdateRequestProcessorChain as following:
   <updateRequestProcessorChain name="uima">
-    <processor class="org.apache.solr.uima.processor.UIMAProcessorFactory"/>
+    <processor class="org.apache.solr.uima.processor.UIMAUpdateRequestProcessorFactory"/>
     <processor class="solr.LogUpdateProcessorFactory" />
     <processor class="solr.RunUpdateProcessorFactory" />
   </updateRequestProcessorChain>

Modified: lucene/dev/branches/bulkpostings/solr/example/solr/solr.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/example/solr/solr.xml?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/example/solr/solr.xml (original)
+++ lucene/dev/branches/bulkpostings/solr/example/solr/solr.xml Mon Feb 14 14:58:04 2011
@@ -29,6 +29,6 @@
     If 'null' (or absent), cores will not be manageable via request handler
   -->
   <cores adminPath="/admin/cores" defaultCoreName="collection1">
-    <core name="collection1" instanceDir="." />
+    <core name="collection1" instanceDir="." shard="shard1"/>
   </cores>
 </solr>

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/SpellCheckCollator.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/SpellCheckCollator.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/SpellCheckCollator.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/SpellCheckCollator.java Mon Feb 14 14:58:04 2011
@@ -29,7 +29,6 @@ import org.apache.solr.handler.component
 import org.apache.solr.handler.component.SearchComponent;
 import org.apache.solr.request.LocalSolrQueryRequest;
 import org.apache.solr.response.SolrQueryResponse;
-import org.mortbay.log.Log;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -91,7 +90,7 @@ public class SpellCheckCollator {
           queryComponent.process(checkResponse);
           hits = (Integer) checkResponse.rsp.getToLog().get("hits");
         } catch (Exception e) {
-          Log.warn("Exception trying to re-query to check if a spell check possibility would return any hits.", e);
+          LOG.warn("Exception trying to re-query to check if a spell check possibility would return any hits.", e);
         } finally {
           checkResponse.req.close();  
         }

Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/function/TestFunctionQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/function/TestFunctionQuery.java?rev=1070514&r1=1070513&r2=1070514&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/function/TestFunctionQuery.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/search/function/TestFunctionQuery.java Mon Feb 14 14:58:04 2011
@@ -299,7 +299,7 @@ public class TestFunctionQuery extends S
     state.setBoost(1.0f);
     state.setLength(4);
     assertQ(req("fl","*,score","q", "{!func}norm(a_t)", "fq","id:2"),
-        "//float[@name='score']='" + similarity.computeNorm("a_t",state)  + "'");  // sqrt(4)==2 and is exactly representable when quantized to a byte
+        "//float[@name='score']='" + similarity.computeNorm(state)  + "'");  // sqrt(4)==2 and is exactly representable when quantized to a byte
 
     // test that ord and rord are working on a global index basis, not just
     // at the segment level (since Lucene 2.9 has switched to per-segment searching)