mirror of https://github.com/apache/lucene.git
test for presence/absence of physical norms file
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@330177 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5a76aaa06f
commit
9698aac274
|
@ -54,9 +54,10 @@ public class TestDocumentWriter extends TestCase {
|
||||||
DocumentWriter writer = new DocumentWriter(dir, analyzer, similarity, 50);
|
DocumentWriter writer = new DocumentWriter(dir, analyzer, similarity, 50);
|
||||||
assertTrue(writer != null);
|
assertTrue(writer != null);
|
||||||
try {
|
try {
|
||||||
writer.addDocument("test", testDoc);
|
String segName="test";
|
||||||
|
writer.addDocument(segName, testDoc);
|
||||||
//After adding the document, we should be able to read it back in
|
//After adding the document, we should be able to read it back in
|
||||||
SegmentReader reader = SegmentReader.get(new SegmentInfo("test", 1, dir));
|
SegmentReader reader = SegmentReader.get(new SegmentInfo(segName, 1, dir));
|
||||||
assertTrue(reader != null);
|
assertTrue(reader != null);
|
||||||
Document doc = reader.document(0);
|
Document doc = reader.document(0);
|
||||||
assertTrue(doc != null);
|
assertTrue(doc != null);
|
||||||
|
@ -84,6 +85,14 @@ public class TestDocumentWriter extends TestCase {
|
||||||
assertTrue(fields != null && fields.length == 1);
|
assertTrue(fields != null && fields.length == 1);
|
||||||
assertTrue(fields[0].stringValue().equals(DocHelper.FIELD_3_TEXT));
|
assertTrue(fields[0].stringValue().equals(DocHelper.FIELD_3_TEXT));
|
||||||
|
|
||||||
|
// test that the norm file is not present if omitNorms is true
|
||||||
|
for (int i=0; i<reader.fieldInfos.size(); i++) {
|
||||||
|
FieldInfo fi = reader.fieldInfos.fieldInfo(i);
|
||||||
|
if (fi.isIndexed) {
|
||||||
|
assertTrue(fi.omitNorms == !dir.fileExists(segName + ".f" + i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
|
|
Loading…
Reference in New Issue