mirror of https://github.com/apache/lucene.git
LUCENE-3628: consolidate exceptional cases and move comment to where it should be
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1227832 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bbfc831d52
commit
fd7664d92b
|
@ -66,14 +66,14 @@ final class NormsConsumer extends InvertedDocEndConsumer {
|
|||
if (state.fieldInfos.hasNorms()) {
|
||||
for (FieldInfo fi : state.fieldInfos) {
|
||||
final NormsConsumerPerField toWrite = (NormsConsumerPerField) fieldsToFlush.get(fi);
|
||||
// we must check the final value of omitNorms for the fieldinfo, it could have
|
||||
// changed for this field since the first time we added it.
|
||||
if (!fi.omitNorms) {
|
||||
if (toWrite != null) {
|
||||
if (toWrite != null && toWrite.initialized()) {
|
||||
anythingFlushed = true;
|
||||
toWrite.flush(state.numDocs);
|
||||
} else if (fi.isIndexed) {
|
||||
anythingFlushed = true;
|
||||
// we must check the final value of omitNorms for the fieldinfo, it could have
|
||||
// changed for this field since the first time we added it.
|
||||
final DocValuesConsumer valuesConsumer = newConsumer(new PerDocWriteState(state), fi);
|
||||
final DocValuesField value = new DocValuesField("");
|
||||
value.setBytes(new BytesRef(new byte[] {0x00}), Type.BYTES_FIXED_STRAIGHT);
|
||||
|
|
|
@ -60,16 +60,8 @@ public class NormsConsumerPerField extends InvertedDocEndConsumerPerField implem
|
|||
}
|
||||
|
||||
void flush(int docCount) throws IOException {
|
||||
DocValuesConsumer consumer = this.consumer;
|
||||
if (consumer == null && fieldInfo.isIndexed) {
|
||||
consumer = getConsumer();
|
||||
spare.bytes[0] = 0x00;
|
||||
value.setBytes(spare, Type.BYTES_FIXED_STRAIGHT);
|
||||
consumer.add(docCount-1, value);
|
||||
}
|
||||
if (consumer != null) {
|
||||
consumer.finish(docCount);
|
||||
}
|
||||
assert initialized();
|
||||
consumer.finish(docCount);
|
||||
}
|
||||
|
||||
private DocValuesConsumer getConsumer() throws IOException {
|
||||
|
@ -79,6 +71,9 @@ public class NormsConsumerPerField extends InvertedDocEndConsumerPerField implem
|
|||
return consumer;
|
||||
}
|
||||
|
||||
boolean initialized() {
|
||||
return consumer != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
void abort() {
|
||||
|
|
Loading…
Reference in New Issue