mirror of https://github.com/apache/lucene.git
separated docvalues merging from terms merging
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1143795 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fc0ecb9bb1
commit
9e353584f9
|
@ -115,6 +115,7 @@ final class SegmentMerger {
|
|||
|
||||
mergedDocs = mergeFields();
|
||||
mergeTerms();
|
||||
mergePerDoc();
|
||||
mergeNorms();
|
||||
|
||||
if (fieldInfos.hasVectors())
|
||||
|
@ -483,17 +484,10 @@ final class SegmentMerger {
|
|||
int docBase = 0;
|
||||
|
||||
final List<Fields> fields = new ArrayList<Fields>();
|
||||
|
||||
final List<ReaderUtil.Slice> slices = new ArrayList<ReaderUtil.Slice>();
|
||||
final List<Bits> bits = new ArrayList<Bits>();
|
||||
final List<Integer> bitsStarts = new ArrayList<Integer>();
|
||||
|
||||
// TODO: move this into its own method - this merges currently only docvalues
|
||||
final List<PerDocValues> perDocProducers = new ArrayList<PerDocValues>();
|
||||
final List<ReaderUtil.Slice> perDocSlices = new ArrayList<ReaderUtil.Slice>();
|
||||
final List<Bits> perDocBits = new ArrayList<Bits>();
|
||||
final List<Integer> perDocBitsStarts = new ArrayList<Integer>();
|
||||
|
||||
for(IndexReader r : readers) {
|
||||
final Fields f = r.fields();
|
||||
final int maxDoc = r.maxDoc();
|
||||
|
@ -503,18 +497,10 @@ final class SegmentMerger {
|
|||
bits.add(r.getLiveDocs());
|
||||
bitsStarts.add(docBase);
|
||||
}
|
||||
final PerDocValues producer = r.perDocValues();
|
||||
if (producer != null) {
|
||||
perDocSlices.add(new ReaderUtil.Slice(docBase, maxDoc, fields.size()));
|
||||
perDocProducers.add(producer);
|
||||
perDocBits.add(r.getLiveDocs());
|
||||
perDocBitsStarts.add(docBase);
|
||||
}
|
||||
docBase += maxDoc;
|
||||
}
|
||||
|
||||
bitsStarts.add(docBase);
|
||||
perDocBitsStarts.add(docBase);
|
||||
|
||||
// we may gather more readers than mergeState.readerCount
|
||||
mergeState = new MergeState();
|
||||
|
@ -580,6 +566,26 @@ final class SegmentMerger {
|
|||
} finally {
|
||||
consumer.close();
|
||||
}
|
||||
}
|
||||
|
||||
private void mergePerDoc() throws IOException {
|
||||
final List<PerDocValues> perDocProducers = new ArrayList<PerDocValues>();
|
||||
final List<ReaderUtil.Slice> perDocSlices = new ArrayList<ReaderUtil.Slice>();
|
||||
final List<Bits> perDocBits = new ArrayList<Bits>();
|
||||
final List<Integer> perDocBitsStarts = new ArrayList<Integer>();
|
||||
int docBase = 0;
|
||||
for(IndexReader r : readers) {
|
||||
final int maxDoc = r.maxDoc();
|
||||
final PerDocValues producer = r.perDocValues();
|
||||
if (producer != null) {
|
||||
perDocSlices.add(new ReaderUtil.Slice(docBase, maxDoc, perDocProducers.size()));
|
||||
perDocProducers.add(producer);
|
||||
perDocBits.add(r.getLiveDocs());
|
||||
perDocBitsStarts.add(docBase);
|
||||
}
|
||||
docBase += maxDoc;
|
||||
}
|
||||
perDocBitsStarts.add(docBase);
|
||||
if (!perDocSlices.isEmpty()) {
|
||||
mergeState.multiLiveDocs = new MultiBits(perDocBits, perDocBitsStarts, true);
|
||||
final PerDocConsumer docsConsumer = codec
|
||||
|
|
Loading…
Reference in New Issue