mirror of https://github.com/apache/lucene.git
remove redundant numDocs: its in the segmentwritestate
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene4547@1410923 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7a60da69e7
commit
8850c5973a
|
@ -140,13 +140,15 @@ public class SimpleTextSimpleDocValuesFormat extends SimpleDocValuesFormat {
|
|||
static class SimpleTextDocValuesWriter extends SimpleDVConsumer {
|
||||
final IndexOutput data;
|
||||
final BytesRef scratch = new BytesRef();
|
||||
final int numDocs; // for asserting
|
||||
|
||||
SimpleTextDocValuesWriter(Directory dir, SegmentInfo si, IOContext context) throws IOException {
|
||||
data = dir.createOutput(IndexFileNames.segmentFileName(si.name, "", "dat"), context);
|
||||
numDocs = si.getDocCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NumericDocValuesConsumer addNumericField(FieldInfo field, final long minValue, long maxValue, final int numDocs) throws IOException {
|
||||
public NumericDocValuesConsumer addNumericField(FieldInfo field, final long minValue, long maxValue) throws IOException {
|
||||
writeFieldEntry(field);
|
||||
|
||||
// write our minimum value to the .dat, all entries are deltas from that
|
||||
|
@ -186,7 +188,7 @@ public class SimpleTextSimpleDocValuesFormat extends SimpleDocValuesFormat {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BinaryDocValuesConsumer addBinaryField(FieldInfo field, boolean fixedLength, final int maxLength, final int numDocs) throws IOException {
|
||||
public BinaryDocValuesConsumer addBinaryField(FieldInfo field, boolean fixedLength, final int maxLength) throws IOException {
|
||||
writeFieldEntry(field);
|
||||
// write maxLength
|
||||
SimpleTextUtil.write(data, MAXLENGTH);
|
||||
|
@ -235,7 +237,7 @@ public class SimpleTextSimpleDocValuesFormat extends SimpleDocValuesFormat {
|
|||
|
||||
// nocommit
|
||||
@Override
|
||||
public SortedDocValuesConsumer addSortedField(FieldInfo field, int valueCount, boolean fixedLength, final int maxLength, final int numDocs) throws IOException {
|
||||
public SortedDocValuesConsumer addSortedField(FieldInfo field, int valueCount, boolean fixedLength, final int maxLength) throws IOException {
|
||||
writeFieldEntry(field);
|
||||
// write numValues
|
||||
SimpleTextUtil.write(data, NUMVALUES);
|
||||
|
|
|
@ -37,10 +37,10 @@ public abstract class SimpleDVConsumer implements Closeable {
|
|||
// we want codec to get necessary stuff from IW, but trading off against merge complexity.
|
||||
|
||||
// nocommit should we pass SegmentWriteState...?
|
||||
public abstract NumericDocValuesConsumer addNumericField(FieldInfo field, long minValue, long maxValue, int numDocs) throws IOException;
|
||||
public abstract BinaryDocValuesConsumer addBinaryField(FieldInfo field, boolean fixedLength, int maxLength, int numDocs) throws IOException;
|
||||
public abstract NumericDocValuesConsumer addNumericField(FieldInfo field, long minValue, long maxValue) throws IOException;
|
||||
public abstract BinaryDocValuesConsumer addBinaryField(FieldInfo field, boolean fixedLength, int maxLength) throws IOException;
|
||||
// nocommit: figure out whats fair here.
|
||||
public abstract SortedDocValuesConsumer addSortedField(FieldInfo field, int valueCount, boolean fixedLength, int maxLength, int numDocs) throws IOException;
|
||||
public abstract SortedDocValuesConsumer addSortedField(FieldInfo field, int valueCount, boolean fixedLength, int maxLength) throws IOException;
|
||||
|
||||
public void merge(MergeState mergeState) throws IOException {
|
||||
for (FieldInfo field : mergeState.fieldInfos) {
|
||||
|
@ -97,7 +97,7 @@ public abstract class SimpleDVConsumer implements Closeable {
|
|||
}
|
||||
}
|
||||
// now we can merge
|
||||
NumericDocValuesConsumer field = addNumericField(mergeState.fieldInfo, minValue, maxValue, mergeState.segmentInfo.getDocCount());
|
||||
NumericDocValuesConsumer field = addNumericField(mergeState.fieldInfo, minValue, maxValue);
|
||||
field.merge(mergeState);
|
||||
}
|
||||
|
||||
|
@ -129,14 +129,14 @@ public abstract class SimpleDVConsumer implements Closeable {
|
|||
}
|
||||
// now we can merge
|
||||
assert maxLength >= 0; // could this happen (nothing to do?)
|
||||
BinaryDocValuesConsumer field = addBinaryField(mergeState.fieldInfo, fixedLength, maxLength, mergeState.segmentInfo.getDocCount());
|
||||
BinaryDocValuesConsumer field = addBinaryField(mergeState.fieldInfo, fixedLength, maxLength);
|
||||
field.merge(mergeState);
|
||||
}
|
||||
|
||||
protected void mergeSortedField(MergeState mergeState) throws IOException {
|
||||
SortedDocValuesConsumer.Merger merger = new SortedDocValuesConsumer.Merger();
|
||||
merger.merge(mergeState);
|
||||
SortedDocValuesConsumer consumer = addSortedField(mergeState.fieldInfo, merger.numMergedTerms, merger.fixedLength >= 0, merger.maxLength, mergeState.segmentInfo.getDocCount());
|
||||
SortedDocValuesConsumer consumer = addSortedField(mergeState.fieldInfo, merger.numMergedTerms, merger.fixedLength >= 0, merger.maxLength);
|
||||
consumer.merge(mergeState, merger);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ public class Lucene41DocValuesConsumer extends SimpleDVConsumer {
|
|||
|
||||
@Override
|
||||
public NumericDocValuesConsumer addNumericField(FieldInfo field,
|
||||
long minValue, long maxValue, int numDocs) throws IOException {
|
||||
long minValue, long maxValue) throws IOException {
|
||||
String name = IndexFileNames.segmentFileName(this.info.name + "_"
|
||||
+ field.number, DV_SEGMENT_SUFFIX, DATA_EXTENSION);
|
||||
IndexOutput dataOut = null;
|
||||
|
@ -67,7 +67,7 @@ public class Lucene41DocValuesConsumer extends SimpleDVConsumer {
|
|||
try {
|
||||
dataOut = dir.createOutput(name, context);
|
||||
Lucene41NumericDocValuesConsumer consumer = new Lucene41NumericDocValuesConsumer(
|
||||
dataOut, minValue, maxValue, numDocs);
|
||||
dataOut, minValue, maxValue, info.getDocCount());
|
||||
success = true;
|
||||
return consumer;
|
||||
} finally {
|
||||
|
@ -79,7 +79,7 @@ public class Lucene41DocValuesConsumer extends SimpleDVConsumer {
|
|||
|
||||
@Override
|
||||
public BinaryDocValuesConsumer addBinaryField(FieldInfo field,
|
||||
boolean fixedLength, int maxLength, int numDocs) throws IOException {
|
||||
boolean fixedLength, int maxLength) throws IOException {
|
||||
String nameData = IndexFileNames.segmentFileName(this.info.name + "_"
|
||||
+ field.number, DV_SEGMENT_SUFFIX, DATA_EXTENSION);
|
||||
String idxOut = IndexFileNames.segmentFileName(this.info.name + "_"
|
||||
|
@ -103,7 +103,7 @@ public class Lucene41DocValuesConsumer extends SimpleDVConsumer {
|
|||
|
||||
@Override
|
||||
public SortedDocValuesConsumer addSortedField(FieldInfo field,
|
||||
int valueCount, boolean fixedLength, int maxLength, int numDocs)
|
||||
int valueCount, boolean fixedLength, int maxLength)
|
||||
throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ final class DocFieldProcessor extends DocConsumer {
|
|||
field.bytesDVWriter.flush(field.fieldInfo, state,
|
||||
dvConsumer.addBinaryField(field.fieldInfo,
|
||||
field.bytesDVWriter.fixedLength >= 0,
|
||||
field.bytesDVWriter.maxLength, state.segmentInfo.getDocCount()));
|
||||
field.bytesDVWriter.maxLength));
|
||||
// nocommit must null it out now else next seg
|
||||
// will flush even if no docs had DV...?
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ final class DocFieldProcessor extends DocConsumer {
|
|||
dvConsumer.addSortedField(field.fieldInfo,
|
||||
field.sortedBytesDVWriter.hash.size(),
|
||||
field.sortedBytesDVWriter.fixedLength >= 0,
|
||||
field.sortedBytesDVWriter.maxLength, state.segmentInfo.getDocCount()));
|
||||
field.sortedBytesDVWriter.maxLength));
|
||||
// nocommit must null it out now else next seg
|
||||
// will flush even if no docs had DV...?
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ final class DocFieldProcessor extends DocConsumer {
|
|||
field.numberDVWriter.flush(field.fieldInfo, state,
|
||||
dvConsumer.addNumericField(field.fieldInfo,
|
||||
field.numberDVWriter.minValue,
|
||||
field.numberDVWriter.maxValue, state.segmentInfo.getDocCount()));
|
||||
field.numberDVWriter.maxValue));
|
||||
// nocommit must null it out now else next seg
|
||||
// will flush even if no docs had DV...?
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue