fix TestNorms

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene4547@1433725 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2013-01-15 23:01:32 +00:00
parent 46f7f12455
commit 02b70405bf
3 changed files with 6 additions and 3 deletions

View File

@ -43,6 +43,8 @@ final class NormsConsumerPerField extends InvertedDocEndConsumerPerField impleme
void finish() throws IOException {
if (fieldInfo.isIndexed() && !fieldInfo.omitsNorms()) {
if (consumer == null) {
// nocommit wrongish? what about the
// only-doc-with-norms-enabled-hits-exc case?
fieldInfo.setNormValueType(FieldInfo.DocValuesType.NUMERIC);
consumer = new NumberDVWriter(fieldInfo, docState.docWriter.bytesUsed);
}
@ -53,7 +55,9 @@ final class NormsConsumerPerField extends InvertedDocEndConsumerPerField impleme
void flush(SegmentWriteState state, SimpleDVConsumer normsWriter) throws IOException {
int docCount = state.segmentInfo.getDocCount();
if (consumer == null) {
return; // null type - not omitted but not written
return; // null type - not omitted but not written -
// nocommit meaning the only docs that had
// norms hit exceptions?
}
consumer.finish(docCount);
consumer.flush(state, normsWriter);

View File

@ -188,7 +188,6 @@ final class TermVectorsConsumerPerField extends TermsHashConsumerPerField {
termsHashPerField.reset();
// commit the termVectors once successful - FI will otherwise reset them
fieldInfo.setStoreTermVectors();
}

View File

@ -106,7 +106,7 @@ public class TestNorms extends LuceneTestCase {
for (int i = 0; i < open.maxDoc(); i++) {
StoredDocument document = open.document(i);
int expected = Integer.parseInt(document.get(byteTestField));
assertEquals((byte)expected, normValues.get(i));
assertEquals((byte)expected, (byte)normValues.get(i));
}
open.close();
dir.close();