You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by ot...@apache.org on 2007/01/11 11:53:26 UTC

svn commit: r495190 - in /lucene/java/trunk: CHANGES.txt src/java/org/apache/lucene/index/IndexReader.java

Author: otis
Date: Thu Jan 11 02:53:25 2007
New Revision: 495190

URL: http://svn.apache.org/viewvc?view=rev&rev=495190
Log:
- Added isOptimized() to IndexReader

Modified:
    lucene/java/trunk/CHANGES.txt
    lucene/java/trunk/src/java/org/apache/lucene/index/IndexReader.java

Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?view=diff&rev=495190&r1=495189&r2=495190
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Thu Jan 11 02:53:25 2007
@@ -174,6 +174,9 @@
     setters for both the default Resolution, and per-field Resolution.
     For backwards compatibility, DateField is still used if no Resolutions
     are specified. (Michael Busch via Chris Hostetter)
+
+15. Added isOptimized() method to IndexReader.
+    (Otis Gospodnetic)
     
 Bug fixes
 

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/IndexReader.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/IndexReader.java?view=diff&rev=495190&r1=495189&r2=495190
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/IndexReader.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/IndexReader.java Thu Jan 11 02:53:25 2007
@@ -278,6 +278,14 @@
   }
 
   /**
+   * Checks is the index is optimized (if it has a single segment and no deletions)
+   * @return <code>true</code> if the index is optimized; <code>false</code> otherwise
+   */
+  public boolean isOptimized() {
+      return segmentInfos.size() == 1 && hasDeletions() == false;
+  }
+
+  /**
    *  Return an array of term frequency vectors for the specified document.
    *  The array contains a vector for each vectorized field in the document.
    *  Each vector contains terms and frequencies for all terms in a given vectorized field.