LUCENE-2881: fix intermittent failing test by clearing term vectors bits in FieldInfos for segments that had only docs with non-aborting exceptions

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1073947 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Busch 2011-02-23 21:02:39 +00:00
parent 0045e0f4ea
commit 7fc46ffab1
2 changed files with 15 additions and 0 deletions

View File

@ -59,6 +59,13 @@ final class DocFieldProcessor extends DocConsumer {
// FreqProxTermsWriter does this with
// FieldInfo.storePayload.
final String fileName = IndexFileNames.segmentFileName(state.segmentName, "", IndexFileNames.FIELD_INFOS_EXTENSION);
// If this segment only has docs that hit non-aborting exceptions,
// then no term vectors files will have been written; therefore we
// need to update the fieldInfos and clear the term vectors bits
if (!state.hasVectors) {
state.fieldInfos.clearVectors();
}
state.fieldInfos.write(state.directory, fileName);
}

View File

@ -403,6 +403,14 @@ public final class FieldInfos implements Iterable<FieldInfo> {
return false;
}
void clearVectors() {
for (FieldInfo fi : this) {
fi.storeTermVector = false;
fi.storeOffsetWithTermVector = false;
fi.storePositionWithTermVector = false;
}
}
public boolean hasNorms() {
for (FieldInfo fi : this) {
if (!fi.omitNorms) {