lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r920240 - in /lucene/java/branches/flex_1458: ./ contrib/ contrib/analyzers/common/src/java/org/tartarus/snowball/ contrib/highlighter/src/test/ contrib/instantiated/src/test/org/apache/lucene/store/instantiated/ contrib/queryparser/src/jav...
Date Mon, 08 Mar 2010 09:17:06 GMT
Author: uschindler
Date: Mon Mar  8 09:17:03 2010
New Revision: 920240

URL: http://svn.apache.org/viewvc?rev=920240&view=rev
Log:
Merge flex up to trunk rev 920237.

This revision was left out, because it conflicted "heavy": 919060
Message: LUCENE-2283: use shared byte[] pool to buffer pending stored fields & term vectors during indexing; fixes excessive memory usage for mixed tiny & big docs with many threads

Mike, can you merge this manually?

Added:
    lucene/java/branches/flex_1458/contrib/queryparser/src/test/org/apache/lucene/queryParser/core/
      - copied from r919869, lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/core/
    lucene/java/branches/flex_1458/contrib/queryparser/src/test/org/apache/lucene/queryParser/core/nodes/
      - copied from r919869, lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/core/nodes/
    lucene/java/branches/flex_1458/contrib/queryparser/src/test/org/apache/lucene/queryParser/core/nodes/TestQueryNode.java
      - copied unchanged from r919869, lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/core/nodes/TestQueryNode.java
Modified:
    lucene/java/branches/flex_1458/   (props changed)
    lucene/java/branches/flex_1458/CHANGES.txt
    lucene/java/branches/flex_1458/build.xml   (props changed)
    lucene/java/branches/flex_1458/contrib/   (props changed)
    lucene/java/branches/flex_1458/contrib/CHANGES.txt   (contents, props changed)
    lucene/java/branches/flex_1458/contrib/analyzers/common/src/java/org/tartarus/snowball/Among.java
    lucene/java/branches/flex_1458/contrib/analyzers/common/src/java/org/tartarus/snowball/SnowballProgram.java
    lucene/java/branches/flex_1458/contrib/highlighter/src/test/   (props changed)
    lucene/java/branches/flex_1458/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java   (props changed)
    lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/QueryNodeImpl.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/analysis/Token.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/analysis/Tokenizer.java   (props changed)
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/analysis/tokenattributes/TermAttributeImpl.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/analysis/tokenattributes/TypeAttribute.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/analysis/tokenattributes/TypeAttributeImpl.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DirectoryReader.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/IndexWriter.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/SegmentInfos.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/DefaultSimilarity.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java   (props changed)
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/NumericRangeFilter.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/NumericRangeQuery.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/util/AttributeSource.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java   (props changed)
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/analysis/tokenattributes/TestSimpleAttributeImpls.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/document/TestDateTools.java   (props changed)
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/document/TestNumberTools.java   (props changed)
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java   (props changed)
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestAttributeSource.java   (props changed)

Propchange: lucene/java/branches/flex_1458/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Mar  8 09:17:03 2010
@@ -2,4 +2,4 @@
 /lucene/java/branches/lucene_2_9:817269-818600,829134,829881,831036,896850,909334
 /lucene/java/branches/lucene_2_9_back_compat_tests:818601-821336
 /lucene/java/branches/lucene_3_0:880793,896906
-/lucene/java/trunk:824912-825292,827043-833960,880727-886190,889185,889614-916543,916596,916685,916755,916769,917019
+/lucene/java/trunk:824912-825292,827043-833960,880727-886190,889185,889614-916543,916596,916685,916755,916769,917019,917148,917154,917161,917203-917204,919119,919718,919731,919869,920237

Modified: lucene/java/branches/flex_1458/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/CHANGES.txt?rev=920240&r1=920239&r2=920240&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/CHANGES.txt (original)
+++ lucene/java/branches/flex_1458/CHANGES.txt Mon Mar  8 09:17:03 2010
@@ -41,6 +41,10 @@
 
 * LUCENE-2190: Removed deprecated customScore() and customExplain()
   methods from experimental CustomScoreQuery.  (Uwe Schindler)
+  
+* LUCENE-2286: Enabled DefaultSimilarity.setDiscountOverlaps by default.
+  This means that terms with a position increment gap of zero do not
+  affect the norms calculation by default.  (Robert Muir)
 
 Changes in runtime behavior
 
@@ -208,6 +212,10 @@
 
 * LUCENE-2285: Code cleanup. (Shai Erera via Uwe Schindler)
 
+* LUCENE-2303: Remove code duplication in Token class by subclassing
+  TermAttributeImpl, move DEFAULT_TYPE constant to TypeInterface, improve
+  null-handling for TypeAttribute.  (Uwe Schindler)
+
 Build
 
  * LUCENE-2124: Moved the JDK-based collation support from contrib/collation 

Propchange: lucene/java/branches/flex_1458/build.xml
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Mar  8 09:17:03 2010
@@ -1,2 +1,2 @@
 /lucene/java/branches/lucene_2_9/build.xml:909334
-/lucene/java/trunk/build.xml:916596,916685,916755,916769,917019
+/lucene/java/trunk/build.xml:916596,916685,916755,916769,917019,917148,917154,917161,917203-917204,919119,919718,919731,919869,920237

Propchange: lucene/java/branches/flex_1458/contrib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Mar  8 09:17:03 2010
@@ -2,4 +2,4 @@
 /lucene/java/branches/lucene_2_9/contrib:817269-818600,825998,829134,829816,829881,831036,896850,909334
 /lucene/java/branches/lucene_2_9_back_compat_tests/contrib:818601-821336
 /lucene/java/branches/lucene_3_0/contrib:880793,896906
-/lucene/java/trunk/contrib:824912-825292,827043-833960,880727-886190,889185,889614-916543,916596,916685,916755,916769,917019
+/lucene/java/trunk/contrib:824912-825292,827043-833960,880727-886190,889185,889614-916543,916596,916685,916755,916769,917019,917148,917154,917161,917203-917204,919119,919718,919731,919869,920237

Modified: lucene/java/branches/flex_1458/contrib/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/CHANGES.txt?rev=920240&r1=920239&r2=920240&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/CHANGES.txt (original)
+++ lucene/java/branches/flex_1458/contrib/CHANGES.txt Mon Mar  8 09:17:03 2010
@@ -54,6 +54,9 @@
  
  * LUCENE-2284: MatchAllDocsQueryNode toString() created an invalid XML tag.
    (Frank Wesemann via Robert Muir)
+
+ * LUCENE-2277: QueryNodeImpl threw ConcurrentModificationException on 
+   add(List<QueryNode>). (Frank Wesemann via Robert Muir)
    
 API Changes
 
@@ -121,6 +124,10 @@
    take advantage of this for faster performance.
    (Steven Rowe, Uwe Schindler, Robert Muir)
 
+ * LUCENE-2194, LUCENE-2201, LUCENE-2288: Snowball stemmers in contrib/analyzers
+   have been optimized to work on char[] and remove unnecessary object creation.
+   (Shai Erera, Robert Muir)
+
 Test Cases
 
  * LUCENE-2115: Cutover contrib tests to use Java5 generics.  (Kay Kay

Propchange: lucene/java/branches/flex_1458/contrib/CHANGES.txt
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Mar  8 09:17:03 2010
@@ -2,4 +2,4 @@
 /lucene/java/branches/lucene_2_9/contrib/CHANGES.txt:817269-818600,825998,826775,829134,829816,829881,831036,896850
 /lucene/java/branches/lucene_2_9_back_compat_tests/contrib/CHANGES.txt:818601-821336
 /lucene/java/branches/lucene_3_0/contrib/CHANGES.txt:880793,896906
-/lucene/java/trunk/contrib/CHANGES.txt:829439-833960,880727-886190,889185,889622,889667,889866-899001,916596,916685,916755,916769,917019
+/lucene/java/trunk/contrib/CHANGES.txt:829439-833960,880727-886190,889185,889622,889667,889866-899001,916596,916685,916755,916769,917019,917148,917154,917161,917203-917204,919119,919718,919731,919869,920237

Modified: lucene/java/branches/flex_1458/contrib/analyzers/common/src/java/org/tartarus/snowball/Among.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/analyzers/common/src/java/org/tartarus/snowball/Among.java?rev=920240&r1=920239&r2=920240&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/analyzers/common/src/java/org/tartarus/snowball/Among.java (original)
+++ lucene/java/branches/flex_1458/contrib/analyzers/common/src/java/org/tartarus/snowball/Among.java Mon Mar  8 09:17:03 2010
@@ -34,6 +34,7 @@
 import java.lang.reflect.Method;
 
 public class Among {
+    private static final Class<?>[] EMPTY_PARAMS = new Class[0];
     public Among (String s, int substring_i, int result,
 		  String methodname, SnowballProgram methodobject) {
         this.s_size = s.length();
@@ -46,7 +47,7 @@
 	} else {
 	    try {
 		this.method = methodobject.getClass().
-		getDeclaredMethod(methodname, new Class[0]);
+		getDeclaredMethod(methodname, EMPTY_PARAMS);
 	    } catch (NoSuchMethodException e) {
 		throw new RuntimeException(e);
 	    }

Modified: lucene/java/branches/flex_1458/contrib/analyzers/common/src/java/org/tartarus/snowball/SnowballProgram.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/analyzers/common/src/java/org/tartarus/snowball/SnowballProgram.java?rev=920240&r1=920239&r2=920240&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/analyzers/common/src/java/org/tartarus/snowball/SnowballProgram.java (original)
+++ lucene/java/branches/flex_1458/contrib/analyzers/common/src/java/org/tartarus/snowball/SnowballProgram.java Mon Mar  8 09:17:03 2010
@@ -44,8 +44,11 @@
  * refactored StringBuffers to StringBuilder
  * uses char[] as buffer instead of StringBuffer/StringBuilder
  * eq_s,eq_s_b,insert,replace_s take CharSequence like eq_v and eq_v_b
+ * reflection calls (Lovins, etc) use EMPTY_ARGS/EMPTY_PARAMS
  */
 public abstract class SnowballProgram {
+    private static final Object[] EMPTY_ARGS = new Object[0];
+
     protected SnowballProgram()
     {
 	current = new char[8];
@@ -337,8 +340,7 @@
 		if (w.method == null) return w.result;
 		boolean res;
 		try {
-		    Object resobj = w.method.invoke(w.methodobject,
-						    new Object[0]);
+		    Object resobj = w.method.invoke(w.methodobject, EMPTY_ARGS);
 		    res = resobj.toString().equals("true");
 		} catch (InvocationTargetException e) {
 		    res = false;
@@ -406,8 +408,7 @@
 
 		boolean res;
 		try {
-		    Object resobj = w.method.invoke(w.methodobject,
-						    new Object[0]);
+		    Object resobj = w.method.invoke(w.methodobject, EMPTY_ARGS);
 		    res = resobj.toString().equals("true");
 		} catch (InvocationTargetException e) {
 		    res = false;

Propchange: lucene/java/branches/flex_1458/contrib/highlighter/src/test/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Mar  8 09:17:03 2010
@@ -2,4 +2,4 @@
 /lucene/java/branches/lucene_2_9/contrib/highlighter/src/test:817269-818600,825998,826775,829134,829816,829881,831036,896850,909334
 /lucene/java/branches/lucene_2_9_back_compat_tests/contrib/highlighter/src/test:818601-821336
 /lucene/java/branches/lucene_3_0/contrib/highlighter/src/test:880793,896906
-/lucene/java/trunk/contrib/highlighter/src/test:829439-833960,880727-886190,889185,889614-916543,916596,916685,916755,916769,917019
+/lucene/java/trunk/contrib/highlighter/src/test:829439-833960,880727-886190,889185,889614-916543,916596,916685,916755,916769,917019,917148,917154,917161,917203-917204,919119,919718,919731,919869,920237

Propchange: lucene/java/branches/flex_1458/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Mar  8 09:17:03 2010
@@ -1,2 +1,2 @@
 /lucene/java/branches/lucene_2_9/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:909334
-/lucene/java/trunk/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:916596,916685,916755,916769,917019
+/lucene/java/trunk/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:916596,916685,916755,916769,917019,917148,917154,917161,917203-917204,919119,919718,919731,919869,920237

Modified: lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/QueryNodeImpl.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/QueryNodeImpl.java?rev=920240&r1=920239&r2=920240&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/QueryNodeImpl.java (original)
+++ lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/QueryNodeImpl.java Mon Mar  8 09:17:03 2010
@@ -74,7 +74,7 @@
           .getLocalizedMessage(QueryParserMessages.NODE_ACTION_NOT_SUPPORTED));
     }
 
-    for (QueryNode child : getChildren()) {
+    for (QueryNode child : children) {
       add(child);
     }
 

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/analysis/Token.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/analysis/Token.java?rev=920240&r1=920239&r2=920240&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/analysis/Token.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/analysis/Token.java Mon Mar  8 09:17:03 2010
@@ -17,6 +17,7 @@
  * limitations under the License.
  */
 
+import org.apache.lucene.analysis.tokenattributes.TermAttributeImpl;
 import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
 import org.apache.lucene.analysis.tokenattributes.FlagsAttribute;
 import org.apache.lucene.analysis.tokenattributes.PayloadAttribute;
@@ -25,11 +26,9 @@
 import org.apache.lucene.analysis.tokenattributes.TypeAttribute;
 import org.apache.lucene.index.Payload;
 import org.apache.lucene.index.TermPositions;     // for javadoc
-import org.apache.lucene.util.ArrayUtil;
 import org.apache.lucene.util.Attribute;
 import org.apache.lucene.util.AttributeSource;
 import org.apache.lucene.util.AttributeImpl;
-import org.apache.lucene.util.RamUsageEstimator;
 
 /** 
   A Token is an occurrence of a term from the text of a field.  It consists of
@@ -116,16 +115,10 @@
 
   @see org.apache.lucene.index.Payload
 */
-public class Token extends AttributeImpl 
-                   implements Cloneable, TermAttribute, TypeAttribute, PositionIncrementAttribute,
+public class Token extends TermAttributeImpl 
+                   implements TypeAttribute, PositionIncrementAttribute,
                               FlagsAttribute, OffsetAttribute, PayloadAttribute {
 
-  public static final String DEFAULT_TYPE = "word";
-
-  private static int MIN_BUFFER_SIZE = 10;
-
-  private char[] termBuffer;
-  private int termLength;
   private int startOffset,endOffset;
   private String type = DEFAULT_TYPE;
   private int flags;
@@ -273,139 +266,6 @@
     return positionIncrement;
   }
 
-  /** Returns the Token's term text.
-   * 
-   * This method has a performance penalty
-   * because the text is stored internally in a char[].  If
-   * possible, use {@link #termBuffer()} and {@link
-   * #termLength()} directly instead.  If you really need a
-   * String, use this method, which is nothing more than
-   * a convenience call to <b>new String(token.termBuffer(), 0, token.termLength())</b>
-   */
-  public final String term() {
-    initTermBuffer();
-    return new String(termBuffer, 0, termLength);
-  }
-
-  /** Copies the contents of buffer, starting at offset for
-   *  length characters, into the termBuffer array.
-   *  @param buffer the buffer to copy
-   *  @param offset the index in the buffer of the first character to copy
-   *  @param length the number of characters to copy
-   */
-  public final void setTermBuffer(char[] buffer, int offset, int length) {
-    growTermBuffer(length);
-    System.arraycopy(buffer, offset, termBuffer, 0, length);
-    termLength = length;
-  }
-
-  /** Copies the contents of buffer into the termBuffer array.
-   *  @param buffer the buffer to copy
-   */
-  public final void setTermBuffer(String buffer) {
-    final int length = buffer.length();
-    growTermBuffer(length);
-    buffer.getChars(0, length, termBuffer, 0);
-    termLength = length;
-  }
-
-  /** Copies the contents of buffer, starting at offset and continuing
-   *  for length characters, into the termBuffer array.
-   *  @param buffer the buffer to copy
-   *  @param offset the index in the buffer of the first character to copy
-   *  @param length the number of characters to copy
-   */
-  public final void setTermBuffer(String buffer, int offset, int length) {
-    assert offset <= buffer.length();
-    assert offset + length <= buffer.length();
-    growTermBuffer(length);
-    buffer.getChars(offset, offset + length, termBuffer, 0);
-    termLength = length;
-  }
-
-  /** Returns the internal termBuffer character array which
-   *  you can then directly alter.  If the array is too
-   *  small for your token, use {@link
-   *  #resizeTermBuffer(int)} to increase it.  After
-   *  altering the buffer be sure to call {@link
-   *  #setTermLength} to record the number of valid
-   *  characters that were placed into the termBuffer. */
-  public final char[] termBuffer() {
-    initTermBuffer();
-    return termBuffer;
-  }
-
-  /** Grows the termBuffer to at least size newSize, preserving the
-   *  existing content. Note: If the next operation is to change
-   *  the contents of the term buffer use
-   *  {@link #setTermBuffer(char[], int, int)},
-   *  {@link #setTermBuffer(String)}, or
-   *  {@link #setTermBuffer(String, int, int)}
-   *  to optimally combine the resize with the setting of the termBuffer.
-   *  @param newSize minimum size of the new termBuffer
-   *  @return newly created termBuffer with length >= newSize
-   */
-  public char[] resizeTermBuffer(int newSize) {
-    if (termBuffer == null) {
-      // The buffer is always at least MIN_BUFFER_SIZE
-      termBuffer = new char[ArrayUtil.oversize(newSize < MIN_BUFFER_SIZE ? MIN_BUFFER_SIZE : newSize, RamUsageEstimator.NUM_BYTES_CHAR)]; 
-    } else {
-      if(termBuffer.length < newSize){
-        // Not big enough; create a new array with slight
-        // over allocation and preserve content
-        final char[] newCharBuffer = new char[ArrayUtil.oversize(newSize, RamUsageEstimator.NUM_BYTES_CHAR)];
-        System.arraycopy(termBuffer, 0, newCharBuffer, 0, termBuffer.length);
-        termBuffer = newCharBuffer;
-      }
-    } 
-    return termBuffer;   
-  }
-
-  /** Allocates a buffer char[] of at least newSize, without preserving the existing content.
-   * its always used in places that set the content 
-   *  @param newSize minimum size of the buffer
-   */
-  private void growTermBuffer(int newSize) {
-    if (termBuffer == null) {
-      // The buffer is always at least MIN_BUFFER_SIZE    
-      termBuffer = new char[ArrayUtil.oversize(newSize < MIN_BUFFER_SIZE ? MIN_BUFFER_SIZE : newSize, RamUsageEstimator.NUM_BYTES_CHAR)];
-    } else {
-      if(termBuffer.length < newSize){
-        // Not big enough; create a new array with slight
-        // over allocation:
-        termBuffer = new char[ArrayUtil.oversize(newSize, RamUsageEstimator.NUM_BYTES_CHAR)];
-      }
-    } 
-  }
-  
-  private void initTermBuffer() {
-    if (termBuffer == null) {
-      termBuffer = new char[ArrayUtil.oversize(MIN_BUFFER_SIZE, RamUsageEstimator.NUM_BYTES_CHAR)];
-      termLength = 0;
-    }
-  }
-
-  /** Return number of valid characters (length of the term)
-   *  in the termBuffer array. */
-  public final int termLength() {
-    initTermBuffer();
-    return termLength;
-  }
-
-  /** Set number of valid characters (length of the term) in
-   *  the termBuffer array. Use this to truncate the termBuffer
-   *  or to synchronize with external manipulation of the termBuffer.
-   *  Note: to grow the size of the array,
-   *  use {@link #resizeTermBuffer(int)} first.
-   *  @param length the truncated length
-   */
-  public final void setTermLength(int length) {
-    initTermBuffer();
-    if (length > termBuffer.length)
-      throw new IllegalArgumentException("length " + length + " exceeds the size of the termBuffer (" + termBuffer.length + ")");
-    termLength = length;
-  }
-
   /** Returns this Token's starting offset, the position of the first character
     corresponding to this token in the source text.
 
@@ -490,15 +350,10 @@
   
   @Override
   public String toString() {
-    StringBuilder sb = new StringBuilder();
-    sb.append('(');
-    initTermBuffer();
-    if (termBuffer == null)
-      sb.append("null");
-    else
-      sb.append(termBuffer, 0, termLength);
-      sb.append(',').append(startOffset).append(',').append(endOffset);
-    if (!type.equals("word"))
+    final StringBuilder sb = new StringBuilder();
+    sb.append('(').append(term()).append(',')
+      .append(startOffset).append(',').append(endOffset);
+    if (!"word".equals(type))
       sb.append(",type=").append(type);
     if (positionIncrement != 1)
       sb.append(",posIncr=").append(positionIncrement);
@@ -511,9 +366,8 @@
    */
   @Override
   public void clear() {
+    super.clear();
     payload = null;
-    // Leave termBuffer to allow re-use
-    termLength = 0;
     positionIncrement = 1;
     flags = 0;
     startOffset = endOffset = 0;
@@ -524,9 +378,6 @@
   public Object clone() {
     Token t = (Token)super.clone();
     // Do a deep clone
-    if (termBuffer != null) {
-      t.termBuffer = termBuffer.clone();
-    }
     if (payload != null) {
       t.payload = (Payload) payload.clone();
     }
@@ -554,46 +405,30 @@
       return true;
 
     if (obj instanceof Token) {
-      Token other = (Token) obj;
-
-      initTermBuffer();
-      other.initTermBuffer();
-      
-      if (termLength == other.termLength &&
-          startOffset == other.startOffset &&
+      final Token other = (Token) obj;
+      return (startOffset == other.startOffset &&
           endOffset == other.endOffset && 
           flags == other.flags &&
           positionIncrement == other.positionIncrement &&
-          subEqual(type, other.type) &&
-          subEqual(payload, other.payload)) {
-        for(int i=0;i<termLength;i++)
-          if (termBuffer[i] != other.termBuffer[i])
-            return false;
-        return true;
-      } else
-        return false;
+          (type == null ? other.type == null : type.equals(other.type)) &&
+          (payload == null ? other.payload == null : payload.equals(other.payload)) &&
+          super.equals(obj)
+      );
     } else
       return false;
   }
 
-  private boolean subEqual(Object o1, Object o2) {
-    if (o1 == null)
-      return o2 == null;
-    else
-      return o1.equals(o2);
-  }
-
   @Override
   public int hashCode() {
-    initTermBuffer();
-    int code = termLength;
+    int code = super.hashCode();
     code = code * 31 + startOffset;
     code = code * 31 + endOffset;
     code = code * 31 + flags;
     code = code * 31 + positionIncrement;
-    code = code * 31 + type.hashCode();
-    code = (payload == null ? code : code * 31 + payload.hashCode());
-    code = code * 31 + ArrayUtil.hashCode(termBuffer, 0, termLength);
+    if (type != null)
+      code = code * 31 + type.hashCode();
+    if (payload != null)
+      code = code * 31 + payload.hashCode();
     return code;
   }
       
@@ -703,8 +538,7 @@
    * @param prototype
    */
   public void reinit(Token prototype) {
-    prototype.initTermBuffer();
-    setTermBuffer(prototype.termBuffer, 0, prototype.termLength);
+    setTermBuffer(prototype.termBuffer(), 0, prototype.termLength());
     positionIncrement = prototype.positionIncrement;
     flags = prototype.flags;
     startOffset = prototype.startOffset;
@@ -755,8 +589,7 @@
         to.payload = (Payload) payload.clone();
       }
     } else {
-      initTermBuffer();
-      ((TermAttribute) target).setTermBuffer(termBuffer, 0, termLength);
+      super.copyTo(target);
       ((OffsetAttribute) target).setOffset(startOffset, endOffset);
       ((PositionIncrementAttribute) target).setPositionIncrement(positionIncrement);
       ((PayloadAttribute) target).setPayload((payload == null) ? null : (Payload) payload.clone());

Propchange: lucene/java/branches/flex_1458/src/java/org/apache/lucene/analysis/Tokenizer.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Mar  8 09:17:03 2010
@@ -1,2 +1,2 @@
 /lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/analysis/Tokenizer.java:909334
-/lucene/java/trunk/src/java/org/apache/lucene/analysis/Tokenizer.java:916596,916685,916755,916769,917019
+/lucene/java/trunk/src/java/org/apache/lucene/analysis/Tokenizer.java:916596,916685,916755,916769,917019,917148,917154,917161,917203-917204,919119,919718,919731,919869,920237

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/analysis/tokenattributes/TermAttributeImpl.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/analysis/tokenattributes/TermAttributeImpl.java?rev=920240&r1=920239&r2=920240&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/analysis/tokenattributes/TermAttributeImpl.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/analysis/tokenattributes/TermAttributeImpl.java Mon Mar  8 09:17:03 2010
@@ -194,7 +194,7 @@
       return true;
     }
     
-    if (other instanceof TermAttribute) {
+    if (other instanceof TermAttributeImpl) {
       initTermBuffer();
       TermAttributeImpl o = ((TermAttributeImpl) other);
       o.initTermBuffer();

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/analysis/tokenattributes/TypeAttribute.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/analysis/tokenattributes/TypeAttribute.java?rev=920240&r1=920239&r2=920240&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/analysis/tokenattributes/TypeAttribute.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/analysis/tokenattributes/TypeAttribute.java Mon Mar  8 09:17:03 2010
@@ -23,6 +23,10 @@
  * A Token's lexical type. The Default value is "word". 
  */
 public interface TypeAttribute extends Attribute {
+
+  /** the default type */
+  public static final String DEFAULT_TYPE = "word";
+
   /** Returns this Token's lexical type.  Defaults to "word". */
   public String type();
 

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/analysis/tokenattributes/TypeAttributeImpl.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/analysis/tokenattributes/TypeAttributeImpl.java?rev=920240&r1=920239&r2=920240&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/analysis/tokenattributes/TypeAttributeImpl.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/analysis/tokenattributes/TypeAttributeImpl.java Mon Mar  8 09:17:03 2010
@@ -26,7 +26,6 @@
  */
 public class TypeAttributeImpl extends AttributeImpl implements TypeAttribute, Cloneable, Serializable {
   private String type;
-  public static final String DEFAULT_TYPE = "word";
   
   public TypeAttributeImpl() {
     this(DEFAULT_TYPE); 
@@ -59,7 +58,8 @@
     }
     
     if (other instanceof TypeAttributeImpl) {
-      return type.equals(((TypeAttributeImpl) other).type);
+      final TypeAttributeImpl o = (TypeAttributeImpl) other;
+      return (this.type == null ? o.type == null : this.type.equals(o.type));
     }
     
     return false;
@@ -67,7 +67,7 @@
 
   @Override
   public int hashCode() {
-    return type.hashCode();
+    return (type == null) ? 0 : type.hashCode();
   }
   
   @Override

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DirectoryReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DirectoryReader.java?rev=920240&r1=920239&r2=920240&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DirectoryReader.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DirectoryReader.java Mon Mar  8 09:17:03 2010
@@ -350,8 +350,11 @@
     }
     buffer.append(getClass().getSimpleName());
     buffer.append('(');
-    for(SegmentReader r : subReaders) {
-      buffer.append(r);
+    for(int i=0;i<subReaders.length;i++) {
+      if (i > 0) {
+        buffer.append(' ');
+      }
+      buffer.append(subReaders[i]);
     }
     buffer.append(')');
     return buffer.toString();

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/IndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/IndexWriter.java?rev=920240&r1=920239&r2=920240&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/IndexWriter.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/IndexWriter.java Mon Mar  8 09:17:03 2010
@@ -4176,9 +4176,9 @@
 
 
     Map<String,String> details = new HashMap<String,String>();
-    details.put("optimize", merge.optimize+"");
-    details.put("mergeFactor", end+"");
-    details.put("mergeDocStores", mergeDocStores+"");
+    details.put("optimize", Boolean.toString(merge.optimize));
+    details.put("mergeFactor", Integer.toString(end));
+    details.put("mergeDocStores", Boolean.toString(mergeDocStores));
     setDiagnostics(merge.info, "merge", details);
 
     // Also enroll the merged segment into mergingSegments;
@@ -4196,11 +4196,11 @@
     Map<String,String> diagnostics = new HashMap<String,String>();
     diagnostics.put("source", source);
     diagnostics.put("lucene.version", Constants.LUCENE_VERSION);
-    diagnostics.put("os", Constants.OS_NAME+"");
-    diagnostics.put("os.arch", Constants.OS_ARCH+"");
-    diagnostics.put("os.version", Constants.OS_VERSION+"");
-    diagnostics.put("java.version", Constants.JAVA_VERSION+"");
-    diagnostics.put("java.vendor", Constants.JAVA_VENDOR+"");
+    diagnostics.put("os", Constants.OS_NAME);
+    diagnostics.put("os.arch", Constants.OS_ARCH);
+    diagnostics.put("os.version", Constants.OS_VERSION);
+    diagnostics.put("java.version", Constants.JAVA_VERSION);
+    diagnostics.put("java.vendor", Constants.JAVA_VENDOR);
     if (details != null) {
       diagnostics.putAll(details);
     }

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/SegmentInfos.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/SegmentInfos.java?rev=920240&r1=920239&r2=920240&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/SegmentInfos.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/SegmentInfos.java Mon Mar  8 09:17:03 2010
@@ -504,10 +504,14 @@
     return infoStream;
   }
 
+  /**
+   * Prints the given message to the infoStream. Note, this method does not
+   * check for null infoStream. It assumes this check has been performed by the
+   * caller, which is recommended to avoid the (usually) expensive message
+   * creation.
+   */
   private static void message(String message) {
-    if (infoStream != null) {
-      infoStream.println("SIS [" + Thread.currentThread().getName() + "]: " + message);
-    }
+    infoStream.println("SIS [" + Thread.currentThread().getName() + "]: " + message);
   }
 
   /**
@@ -580,7 +584,9 @@
           if (files != null)
             genA = getCurrentSegmentGeneration(files);
 
-          message("directory listing genA=" + genA);
+          if (infoStream != null) {
+            message("directory listing genA=" + genA);
+          }
 
           // Method 2: open segments.gen and read its
           // contents.  Then we take the larger of the two
@@ -593,10 +599,14 @@
             try {
               genInput = directory.openInput(IndexFileNames.SEGMENTS_GEN);
             } catch (FileNotFoundException e) {
-              message("segments.gen open: FileNotFoundException " + e);
+              if (infoStream != null) {
+                message("segments.gen open: FileNotFoundException " + e);
+              }
               break;
             } catch (IOException e) {
-              message("segments.gen open: IOException " + e);
+              if (infoStream != null) {
+                message("segments.gen open: IOException " + e);
+              }
             }
   
             if (genInput != null) {
@@ -605,7 +615,9 @@
                 if (version == FORMAT_LOCKLESS) {
                   long gen0 = genInput.readLong();
                   long gen1 = genInput.readLong();
-                  message("fallback check: " + gen0 + "; " + gen1);
+                  if (infoStream != null) {
+                    message("fallback check: " + gen0 + "; " + gen1);
+                  }
                   if (gen0 == gen1) {
                     // The file is consistent.
                     genB = gen0;
@@ -625,7 +637,9 @@
             }
           }
 
-          message(IndexFileNames.SEGMENTS_GEN + " check: genB=" + genB);
+          if (infoStream != null) {
+            message(IndexFileNames.SEGMENTS_GEN + " check: genB=" + genB);
+          }
 
           // Pick the larger of the two gen's:
           if (genA > genB)
@@ -650,7 +664,9 @@
           if (genLookaheadCount < defaultGenLookaheadCount) {
             gen++;
             genLookaheadCount++;
-            message("look ahead increment gen to " + gen);
+            if (infoStream != null) {
+              message("look ahead increment gen to " + gen);
+            }
           }
         }
 
@@ -685,7 +701,7 @@
 
         try {
           Object v = doBody(segmentFileName);
-          if (exc != null) {
+          if (exc != null && infoStream != null) {
             message("success on " + segmentFileName);
           }
           return v;
@@ -696,7 +712,9 @@
             exc = err;
           }
 
-          message("primary Exception on '" + segmentFileName + "': " + err + "'; will retry: retry=" + retry + "; gen = " + gen);
+          if (infoStream != null) {
+            message("primary Exception on '" + segmentFileName + "': " + err + "'; will retry: retry=" + retry + "; gen = " + gen);
+          }
 
           if (!retry && gen > 1) {
 
@@ -713,13 +731,19 @@
             prevExists = directory.fileExists(prevSegmentFileName);
 
             if (prevExists) {
-              message("fallback to prior segment file '" + prevSegmentFileName + "'");
+              if (infoStream != null) {
+                message("fallback to prior segment file '" + prevSegmentFileName + "'");
+              }
               try {
                 Object v = doBody(prevSegmentFileName);
-                message("success on fallback " + prevSegmentFileName);
+                if (infoStream != null) {
+                  message("success on fallback " + prevSegmentFileName);
+                }
                 return v;
               } catch (IOException err2) {
-                message("secondary Exception on '" + prevSegmentFileName + "': " + err2 + "'; will retry");
+                if (infoStream != null) {
+                  message("secondary Exception on '" + prevSegmentFileName + "': " + err2 + "'; will retry");
+                }
               }
             }
           }

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/DefaultSimilarity.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/DefaultSimilarity.java?rev=920240&r1=920239&r2=920240&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/DefaultSimilarity.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/DefaultSimilarity.java Mon Mar  8 09:17:03 2010
@@ -76,13 +76,13 @@
     return overlap / (float)maxOverlap;
   }
 
-  // Default false
-  protected boolean discountOverlaps;
+  // Default true
+  protected boolean discountOverlaps = true;
 
   /** Determines whether overlap tokens (Tokens with
    *  0 position increment) are ignored when computing
-   *  norm.  By default this is false, meaning overlap
-   *  tokens are counted just like non-overlap tokens.
+   *  norm.  By default this is true, meaning overlap
+   *  tokens do not count when computing norms.
    *
    *  @lucene.experimental
    *

Propchange: lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Mar  8 09:17:03 2010
@@ -1,2 +1,2 @@
 /lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java:909334
-/lucene/java/trunk/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java:916596,916685,916755,916769,917019
+/lucene/java/trunk/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java:916596,916685,916755,916769,917019,917148,917154,917161,917203-917204,919119,919718,919731,919869,920237

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/NumericRangeFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/NumericRangeFilter.java?rev=920240&r1=920239&r2=920240&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/NumericRangeFilter.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/NumericRangeFilter.java Mon Mar  8 09:17:03 2010
@@ -31,7 +31,7 @@
  * factory methods, eg:
  *
  * <pre>
- * Filter f = NumericRangeFilter.newFloatRange("weight", 0.3f, 0.10f, true, true);
+ * Filter f = NumericRangeFilter.newFloatRange("weight", 0.03f, 0.10f, true, true);
  * </pre>
  *
  * accepts all documents whose float valued "weight" field

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/NumericRangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/NumericRangeQuery.java?rev=920240&r1=920239&r2=920240&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/NumericRangeQuery.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/NumericRangeQuery.java Mon Mar  8 09:17:03 2010
@@ -41,7 +41,7 @@
  * factory methods, eg:
  *
  * <pre>
- * Query q = NumericRangeQuery.newFloatRange("weight", 0.3f, 0.10f, true, true);
+ * Query q = NumericRangeQuery.newFloatRange("weight", 0.03f, 0.10f, true, true);
  * </pre>
  *
  * matches all documents whose float valued "weight" field

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/util/AttributeSource.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/util/AttributeSource.java?rev=920240&r1=920239&r2=920240&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/util/AttributeSource.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/util/AttributeSource.java Mon Mar  8 09:17:03 2010
@@ -285,8 +285,8 @@
    * @see #restoreState
    */
   public static final class State implements Cloneable {
-    private AttributeImpl attribute;
-    private State next;
+    AttributeImpl attribute;
+    State next;
     
     @Override
     public Object clone() {

Propchange: lucene/java/branches/flex_1458/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Mar  8 09:17:03 2010
@@ -1,4 +1,4 @@
 /lucene/java/branches/lucene_2_4/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:748824
 /lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:829134,829881,831036,896850,909334
 /lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:880793,896906
-/lucene/java/trunk/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:824912-825292,826213-833960,880727-886190,889185,889614-916543,916596,916685,916755,916769,917019
+/lucene/java/trunk/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:824912-825292,826213-833960,880727-886190,889185,889614-916543,916596,916685,916755,916769,917019,917148,917154,917161,917203-917204,919119,919718,919731,919869,920237

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/analysis/tokenattributes/TestSimpleAttributeImpls.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/analysis/tokenattributes/TestSimpleAttributeImpls.java?rev=920240&r1=920239&r2=920240&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/analysis/tokenattributes/TestSimpleAttributeImpls.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/analysis/tokenattributes/TestSimpleAttributeImpls.java Mon Mar  8 09:17:03 2010
@@ -64,7 +64,7 @@
   
   public void testTypeAttribute() throws Exception {
     TypeAttributeImpl att = new TypeAttributeImpl();
-    assertEquals(TypeAttributeImpl.DEFAULT_TYPE, att.type());
+    assertEquals(TypeAttribute.DEFAULT_TYPE, att.type());
 
     att.setType("hallo");
     assertEquals("type=hallo", att.toString());
@@ -76,7 +76,7 @@
     assertEquals("hallo", att2.type());
     
     att.clear();
-    assertEquals(TypeAttributeImpl.DEFAULT_TYPE, att.type());
+    assertEquals(TypeAttribute.DEFAULT_TYPE, att.type());
   }
   
   public void testPayloadAttribute() throws Exception {

Propchange: lucene/java/branches/flex_1458/src/test/org/apache/lucene/document/TestDateTools.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Mar  8 09:17:03 2010
@@ -1,4 +1,4 @@
 /lucene/java/branches/lucene_2_4/src/test/org/apache/lucene/document/TestDateTools.java:748824
 /lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/document/TestDateTools.java:829134,829881,831036,896850,909334
 /lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/document/TestDateTools.java:880793,896906
-/lucene/java/trunk/src/test/org/apache/lucene/document/TestDateTools.java:824912-825292,826213-833960,880727-886190,889185,889614-916543,916596,916685,916755,916769,917019
+/lucene/java/trunk/src/test/org/apache/lucene/document/TestDateTools.java:824912-825292,826213-833960,880727-886190,889185,889614-916543,916596,916685,916755,916769,917019,917148,917154,917161,917203-917204,919119,919718,919731,919869,920237

Propchange: lucene/java/branches/flex_1458/src/test/org/apache/lucene/document/TestNumberTools.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Mar  8 09:17:03 2010
@@ -1,4 +1,4 @@
 /lucene/java/branches/lucene_2_4/src/test/org/apache/lucene/document/TestNumberTools.java:748824
 /lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/document/TestNumberTools.java:829134,829881,831036,896850,909334
 /lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/document/TestNumberTools.java:880793,896906
-/lucene/java/trunk/src/test/org/apache/lucene/document/TestNumberTools.java:824912-825292,826213-833960,880727-886190,889185,889614-916543,916596,916685,916755,916769,917019
+/lucene/java/trunk/src/test/org/apache/lucene/document/TestNumberTools.java:824912-825292,826213-833960,880727-886190,889185,889614-916543,916596,916685,916755,916769,917019,917148,917154,917161,917203-917204,919119,919718,919731,919869,920237

Propchange: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Mar  8 09:17:03 2010
@@ -1,4 +1,4 @@
 /lucene/java/branches/lucene_2_4/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:748824
 /lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:829134,829881,831036,896850,909334
 /lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:880793,896906
-/lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:824912-825292,826213-833960,880727-886190,889185,889614-916543,916596,916685,916755,916769,917019
+/lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:824912-825292,826213-833960,880727-886190,889185,889614-916543,916596,916685,916755,916769,917019,917148,917154,917161,917203-917204,919119,919718,919731,919869,920237

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java?rev=920240&r1=920239&r2=920240&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java Mon Mar  8 09:17:03 2010
@@ -205,6 +205,16 @@
     assertEquals("First doc", startOffset, Integer.parseInt(doc.get(field)) );
     doc=searcher.doc(sd[sd.length-1].doc);
     assertEquals("Last doc", (count-1)*distance+startOffset, Integer.parseInt(doc.get(field)) );
+    
+    q=NumericRangeQuery.newIntRange(field, precisionStep, null, upper, false, true);
+    topDocs = searcher.search(q, null, noDocs, Sort.INDEXORDER);
+    sd = topDocs.scoreDocs;
+    assertNotNull(sd);
+    assertEquals("Score doc count", count, sd.length );
+    doc=searcher.doc(sd[0].doc);
+    assertEquals("First doc", startOffset, Integer.parseInt(doc.get(field)) );
+    doc=searcher.doc(sd[sd.length-1].doc);
+    assertEquals("Last doc", (count-1)*distance+startOffset, Integer.parseInt(doc.get(field)) );
   }
   
   @Test
@@ -236,6 +246,16 @@
     assertEquals("First doc", count*distance+startOffset, Integer.parseInt(doc.get(field)) );
     doc=searcher.doc(sd[sd.length-1].doc);
     assertEquals("Last doc", (noDocs-1)*distance+startOffset, Integer.parseInt(doc.get(field)) );
+
+    q=NumericRangeQuery.newIntRange(field, precisionStep, lower, null, true, false);
+    topDocs = searcher.search(q, null, noDocs, Sort.INDEXORDER);
+    sd = topDocs.scoreDocs;
+    assertNotNull(sd);
+    assertEquals("Score doc count", noDocs-count, sd.length );
+    doc=searcher.doc(sd[0].doc);
+    assertEquals("First doc", count*distance+startOffset, Integer.parseInt(doc.get(field)) );
+    doc=searcher.doc(sd[sd.length-1].doc);
+    assertEquals("Last doc", (noDocs-1)*distance+startOffset, Integer.parseInt(doc.get(field)) );
   }
   
   @Test
@@ -253,6 +273,57 @@
     testRightOpenRange(2);
   }
   
+  @Test
+  public void testInfiniteValues() throws Exception {
+    RAMDirectory dir = new RAMDirectory();
+    IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
+      true, MaxFieldLength.UNLIMITED);
+    Document doc = new Document();
+    doc.add(new NumericField("float").setFloatValue(Float.NEGATIVE_INFINITY));
+    doc.add(new NumericField("int").setIntValue(Integer.MIN_VALUE));
+    writer.addDocument(doc);
+    
+    doc = new Document();
+    doc.add(new NumericField("float").setFloatValue(Float.POSITIVE_INFINITY));
+    doc.add(new NumericField("int").setIntValue(Integer.MAX_VALUE));
+    writer.addDocument(doc);
+    
+    doc = new Document();
+    doc.add(new NumericField("float").setFloatValue(0.0f));
+    doc.add(new NumericField("int").setIntValue(0));
+    writer.addDocument(doc);
+    writer.close();
+    
+    IndexSearcher s = new IndexSearcher(dir);
+    
+    Query q=NumericRangeQuery.newIntRange("int", null, null, true, true);
+    TopDocs topDocs = s.search(q, 10);
+    assertEquals("Score doc count", 3,  topDocs.scoreDocs.length );
+    
+    q=NumericRangeQuery.newIntRange("int", null, null, false, false);
+    topDocs = s.search(q, 10);
+    assertEquals("Score doc count", 3,  topDocs.scoreDocs.length );
+
+    q=NumericRangeQuery.newIntRange("int", Integer.MIN_VALUE, Integer.MAX_VALUE, true, true);
+    topDocs = s.search(q, 10);
+    assertEquals("Score doc count", 3,  topDocs.scoreDocs.length );
+    
+    q=NumericRangeQuery.newIntRange("int", Integer.MIN_VALUE, Integer.MAX_VALUE, false, false);
+    topDocs = s.search(q, 10);
+    assertEquals("Score doc count", 1,  topDocs.scoreDocs.length );
+
+    q=NumericRangeQuery.newFloatRange("float", null, null, true, true);
+    topDocs = s.search(q, 10);
+    assertEquals("Score doc count", 3,  topDocs.scoreDocs.length );
+
+    q=NumericRangeQuery.newFloatRange("float", null, null, false, false);
+    topDocs = s.search(q, 10);
+    assertEquals("Score doc count", 3,  topDocs.scoreDocs.length );
+
+    s.close();
+    dir.close();
+  }
+  
   private void testRandomTrieAndClassicRangeQuery(int precisionStep) throws Exception {
     final Random rnd=newRandom();
     String field="field"+precisionStep;

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java?rev=920240&r1=920239&r2=920240&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java Mon Mar  8 09:17:03 2010
@@ -212,6 +212,16 @@
     assertEquals("First doc", startOffset, Long.parseLong(doc.get(field)) );
     doc=searcher.doc(sd[sd.length-1].doc);
     assertEquals("Last doc", (count-1)*distance+startOffset, Long.parseLong(doc.get(field)) );
+
+    q=NumericRangeQuery.newLongRange(field, precisionStep, null, upper, false, true);
+    topDocs = searcher.search(q, null, noDocs, Sort.INDEXORDER);
+    sd = topDocs.scoreDocs;
+    assertNotNull(sd);
+    assertEquals("Score doc count", count, sd.length );
+    doc=searcher.doc(sd[0].doc);
+    assertEquals("First doc", startOffset, Long.parseLong(doc.get(field)) );
+    doc=searcher.doc(sd[sd.length-1].doc);
+    assertEquals("Last doc", (count-1)*distance+startOffset, Long.parseLong(doc.get(field)) );
   }
   
   @Test
@@ -248,6 +258,16 @@
     assertEquals("First doc", count*distance+startOffset, Long.parseLong(doc.get(field)) );
     doc=searcher.doc(sd[sd.length-1].doc);
     assertEquals("Last doc", (noDocs-1)*distance+startOffset, Long.parseLong(doc.get(field)) );
+
+    q=NumericRangeQuery.newLongRange(field, precisionStep, lower, null, true, false);
+    topDocs = searcher.search(q, null, noDocs, Sort.INDEXORDER);
+    sd = topDocs.scoreDocs;
+    assertNotNull(sd);
+    assertEquals("Score doc count", noDocs-count, sd.length );
+    doc=searcher.doc(sd[0].doc);
+    assertEquals("First doc", count*distance+startOffset, Long.parseLong(doc.get(field)) );
+    doc=searcher.doc(sd[sd.length-1].doc);
+    assertEquals("Last doc", (noDocs-1)*distance+startOffset, Long.parseLong(doc.get(field)) );
   }
   
   @Test
@@ -270,6 +290,57 @@
     testRightOpenRange(2);
   }
   
+  @Test
+  public void testInfiniteValues() throws Exception {
+    RAMDirectory dir = new RAMDirectory();
+    IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
+      true, MaxFieldLength.UNLIMITED);
+    Document doc = new Document();
+    doc.add(new NumericField("double").setDoubleValue(Double.NEGATIVE_INFINITY));
+    doc.add(new NumericField("long").setLongValue(Long.MIN_VALUE));
+    writer.addDocument(doc);
+    
+    doc = new Document();
+    doc.add(new NumericField("double").setDoubleValue(Double.POSITIVE_INFINITY));
+    doc.add(new NumericField("long").setLongValue(Long.MAX_VALUE));
+    writer.addDocument(doc);
+    
+    doc = new Document();
+    doc.add(new NumericField("double").setDoubleValue(0.0));
+    doc.add(new NumericField("long").setLongValue(0L));
+    writer.addDocument(doc);
+    writer.close();
+    
+    IndexSearcher s = new IndexSearcher(dir);
+    
+    Query q=NumericRangeQuery.newLongRange("long", null, null, true, true);
+    TopDocs topDocs = s.search(q, 10);
+    assertEquals("Score doc count", 3,  topDocs.scoreDocs.length );
+    
+    q=NumericRangeQuery.newLongRange("long", null, null, false, false);
+    topDocs = s.search(q, 10);
+    assertEquals("Score doc count", 3,  topDocs.scoreDocs.length );
+
+    q=NumericRangeQuery.newLongRange("long", Long.MIN_VALUE, Long.MAX_VALUE, true, true);
+    topDocs = s.search(q, 10);
+    assertEquals("Score doc count", 3,  topDocs.scoreDocs.length );
+    
+    q=NumericRangeQuery.newLongRange("long", Long.MIN_VALUE, Long.MAX_VALUE, false, false);
+    topDocs = s.search(q, 10);
+    assertEquals("Score doc count", 1,  topDocs.scoreDocs.length );
+
+    q=NumericRangeQuery.newDoubleRange("double", null, null, true, true);
+    topDocs = s.search(q, 10);
+    assertEquals("Score doc count", 3,  topDocs.scoreDocs.length );
+
+    q=NumericRangeQuery.newDoubleRange("double", null, null, false, false);
+    topDocs = s.search(q, 10);
+    assertEquals("Score doc count", 3,  topDocs.scoreDocs.length );
+
+    s.close();
+    dir.close();
+  }
+  
   private void testRandomTrieAndClassicRangeQuery(int precisionStep) throws Exception {
     final Random rnd=newRandom();
     String field="field"+precisionStep;

Propchange: lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestAttributeSource.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Mar  8 09:17:03 2010
@@ -1,2 +1,2 @@
 /lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/util/TestAttributeSource.java:909334
-/lucene/java/trunk/src/test/org/apache/lucene/util/TestAttributeSource.java:916596,916685,916755,916769,917019
+/lucene/java/trunk/src/test/org/apache/lucene/util/TestAttributeSource.java:916596,916685,916755,916769,917019,917148,917154,917161,917203-917204,919119,919718,919731,919869,920237



Mime
View raw message