lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r733449 - /lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/trie/TrieRangeFilter.java
Date Sun, 11 Jan 2009 11:04:56 GMT
Author: uschindler
Date: Sun Jan 11 03:04:56 2009
New Revision: 733449

URL: http://svn.apache.org/viewvc?rev=733449&view=rev
Log:
Small optimization because an Object is not needed here

Modified:
    lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/trie/TrieRangeFilter.java

Modified: lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/trie/TrieRangeFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/trie/TrieRangeFilter.java?rev=733449&r1=733448&r2=733449&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/trie/TrieRangeFilter.java
(original)
+++ lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/trie/TrieRangeFilter.java
Sun Jan 11 03:04:56 2009
@@ -254,15 +254,14 @@
   //@Override
   public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
     final OpenBitSet bits = new OpenBitSet(reader.maxDoc());
-    final TermDocs termDocs=reader.termDocs();
+    final TermDocs termDocs = reader.termDocs();
     try {
-      final int count=splitRange(
+      lastNumberOfTerms=splitRange(
         reader,termDocs,bits,
         min,trieVariant.TRIE_CODED_NUMERIC_MIN.equals(min),
         max,trieVariant.TRIE_CODED_NUMERIC_MAX.equals(max)
       );
-      lastNumberOfTerms=new Integer(count);
-      //System.out.println("Found "+count+" distinct terms in filtered range for field '"+field+"'.");
+      //System.out.println("Found "+lastNumberOfTerms+" distinct terms in filtered range
for field '"+field+"'.");
     } finally {
       termDocs.close();
     }
@@ -275,15 +274,14 @@
    * This method is not thread safe, be sure to only call it when no query is running!
    * @throws IllegalStateException if {@link #getDocIdSet} was not yet executed.
    */
-  //@Override
   public int getLastNumberOfTerms() {
-    if (lastNumberOfTerms==null) throw new IllegalStateException();
-    return lastNumberOfTerms.intValue();
+    if (lastNumberOfTerms < 0) throw new IllegalStateException();
+    return lastNumberOfTerms;
   }
 
   // members
   private final String field,min,max;
   private final TrieUtils trieVariant;
   private Object minUnconverted,maxUnconverted;
-  private Integer lastNumberOfTerms=null;
+  private int lastNumberOfTerms=-1;
 }



Mime
View raw message