mirror of https://github.com/apache/lucene.git
LUCENE-3037: fix skiplevel computation for some cases where skipInterval^N == df
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1095125 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a440c8c018
commit
8906ff3cc2
|
@ -186,7 +186,8 @@ public abstract class MultiLevelSkipListReader {
|
|||
|
||||
/** Loads the skip levels */
|
||||
private void loadSkipLevels() throws IOException {
|
||||
numberOfSkipLevels = docCount == 0 ? 0 : (int) Math.floor(Math.log(docCount) / Math.log(skipInterval[0]));
|
||||
// TODO: would be preferable to use integer math here instead.
|
||||
numberOfSkipLevels = docCount == 0 ? 0 : (int) Math.floor(StrictMath.log(docCount) / StrictMath.log(skipInterval[0]));
|
||||
if (numberOfSkipLevels > maxNumberOfSkipLevels) {
|
||||
numberOfSkipLevels = maxNumberOfSkipLevels;
|
||||
}
|
||||
|
|
|
@ -61,7 +61,8 @@ public abstract class MultiLevelSkipListWriter {
|
|||
this.skipInterval = skipInterval;
|
||||
|
||||
// calculate the maximum number of skip levels for this document frequency
|
||||
numberOfSkipLevels = df == 0 ? 0 : (int) Math.floor(Math.log(df) / Math.log(skipInterval));
|
||||
// TODO: would be preferable to use integer math here instead.
|
||||
numberOfSkipLevels = df == 0 ? 0 : (int) Math.floor(StrictMath.log(df) / StrictMath.log(skipInterval));
|
||||
|
||||
// make sure it does not exceed maxSkipLevels
|
||||
if (numberOfSkipLevels > maxSkipLevels) {
|
||||
|
|
|
@ -122,7 +122,7 @@ public class MockRandomCodec extends Codec {
|
|||
public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
|
||||
// we pull this before the seed intentionally: because its not consumed at runtime
|
||||
// (the skipInterval is written into postings header)
|
||||
int skipInterval = _TestUtil.nextInt(seedRandom, 2, 64);
|
||||
int skipInterval = _TestUtil.nextInt(seedRandom, 2, 10);
|
||||
|
||||
if (LuceneTestCase.VERBOSE) {
|
||||
System.out.println("MockRandomCodec: skipInterval=" + skipInterval);
|
||||
|
|
Loading…
Reference in New Issue