- Added isOptimized() to IndexReader

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@495190 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Otis Gospodnetic 2007-01-11 10:53:25 +00:00
parent da7c50925d
commit 9b0986ae37
2 changed files with 11 additions and 0 deletions

View File

@ -174,6 +174,9 @@ API Changes
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

View File

@ -277,6 +277,14 @@ public abstract class IndexReader {
return SegmentInfos.readCurrentVersion(directory) == segmentInfos.getVersion();
}
/**
* 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.