LUCENE-1609: un-deprecate IndexReader.getTermInfosIndexDivisor

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@796916 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2009-07-23 00:02:48 +00:00
parent 374822897c
commit 91e37bf1fb
5 changed files with 12 additions and 4 deletions

View File

@ -846,6 +846,10 @@ class DirectoryReader extends IndexReader implements Cloneable {
return directory;
}
public int getTermInfosIndexDivisor() {
return termInfosIndexDivisor;
}
/**
* Expert: return the IndexCommit that this reader has opened.
* <p/>

View File

@ -736,12 +736,11 @@ public abstract class IndexReader implements Cloneable {
/** <p>For IndexReader implementations that use
* TermInfosReader to read terms, this returns the
* current indexDivisor.
* @see #setTermInfosIndexDivisor
* @deprecated Please use {@link IndexReader#open(Directory, IndexDeletionPolicy, boolean, int)} to specify the required TermInfos index divisor instead.
* current indexDivisor as specified when the reader was
* opened.
*/
public int getTermInfosIndexDivisor() {
throw new UnsupportedOperationException("Please pass termInfosIndexDivisor up-front when opening IndexReader");
throw new UnsupportedOperationException("This reader does not support this method.");
}
/**

View File

@ -1355,4 +1355,7 @@ public class SegmentReader extends IndexReader implements Cloneable {
throw new IllegalArgumentException(reader + " is not a SegmentReader or a single-segment DirectoryReader");
}
public int getTermInfosIndexDivisor() {
return core.termsIndexDivisor;
}
}

View File

@ -1821,6 +1821,7 @@ public class TestIndexReader extends LuceneTestCase
}
assertFalse(((SegmentReader) r.getSequentialSubReaders()[0]).termsIndexLoaded());
assertEquals(-1, r.getTermInfosIndexDivisor());
writer = new IndexWriter(dir, new WhitespaceAnalyzer(), IndexWriter.MaxFieldLength.UNLIMITED);
writer.addDocument(doc);
writer.close();

View File

@ -54,6 +54,7 @@ public class TestSegmentTermDocs extends LuceneTestCase {
//After adding the document, we should be able to read it back in
SegmentReader reader = SegmentReader.get(true, info, indexDivisor);
assertTrue(reader != null);
assertEquals(indexDivisor, reader.getTermInfosIndexDivisor());
SegmentTermDocs segTermDocs = new SegmentTermDocs(reader);
assertTrue(segTermDocs != null);
segTermDocs.seek(new Term(DocHelper.TEXT_FIELD_2_KEY, "field"));