LUCENE-3224: checkindex fails if docfreq >= skipInterval and term is indexed more than once at same position

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1147578 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2011-07-17 10:53:51 +00:00
parent fb70c7c06c
commit adf6eee90e
3 changed files with 22 additions and 2 deletions

View File

@ -514,6 +514,10 @@ Bug fixes
causing the file to sometimes be larger than it needed to be. (Mike causing the file to sometimes be larger than it needed to be. (Mike
McCandless) McCandless)
* LUCENE-3224: Fixed a big where CheckIndex would incorrectly report a
corrupt index if a term with docfreq >= 16 was indexed more than once
at the same position. (Robert Muir)
New Features New Features
* LUCENE-3290: Added FieldInvertState.numUniqueTerms * LUCENE-3290: Added FieldInvertState.numUniqueTerms

View File

@ -835,8 +835,8 @@ public class CheckIndex {
if (pos < 0) { if (pos < 0) {
throw new RuntimeException("position " + pos + " is out of bounds"); throw new RuntimeException("position " + pos + " is out of bounds");
} }
if (pos <= lastPosition) { if (pos < lastPosition) {
throw new RuntimeException("position " + pos + " is <= lastPosition " + lastPosition); throw new RuntimeException("position " + pos + " is < lastPosition " + lastPosition);
} }
lastPosition = pos; lastPosition = pos;
} }

View File

@ -47,6 +47,22 @@ public class TestSameTokenSamePosition extends LuceneTestCase {
riw.close(); riw.close();
dir.close(); dir.close();
} }
/**
* Same as the above, but with more docs
*/
public void testMoreDocs() throws Exception {
Directory dir = newDirectory();
RandomIndexWriter riw = new RandomIndexWriter(random, dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new BugReproAnalyzer()));
Document doc = new Document();
doc.add(new Field("eng", "Six drunken" /*This shouldn't matter. */,
Field.Store.YES, Field.Index.ANALYZED));
for (int i = 0; i < 100; i++) {
riw.addDocument(doc);
}
riw.close();
dir.close();
}
} }
final class BugReproAnalyzer extends Analyzer{ final class BugReproAnalyzer extends Analyzer{