lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject svn commit: r330177 - /lucene/java/trunk/src/test/org/apache/lucene/index/TestDocumentWriter.java
Date Wed, 02 Nov 2005 03:22:05 GMT
Author: yonik
Date: Tue Nov  1 19:22:01 2005
New Revision: 330177

URL: http://svn.apache.org/viewcvs?rev=330177&view=rev
Log:
test for presence/absence of physical norms file

Modified:
    lucene/java/trunk/src/test/org/apache/lucene/index/TestDocumentWriter.java

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestDocumentWriter.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/test/org/apache/lucene/index/TestDocumentWriter.java?rev=330177&r1=330176&r2=330177&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestDocumentWriter.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestDocumentWriter.java Tue Nov  1
19:22:01 2005
@@ -54,9 +54,10 @@
     DocumentWriter writer = new DocumentWriter(dir, analyzer, similarity, 50);
     assertTrue(writer != null);
     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
-      SegmentReader reader = SegmentReader.get(new SegmentInfo("test", 1, dir));
+      SegmentReader reader = SegmentReader.get(new SegmentInfo(segName, 1, dir));
       assertTrue(reader != null);
       Document doc = reader.document(0);
       assertTrue(doc != null);
@@ -83,6 +84,14 @@
       fields = doc.getFields(DocHelper.TEXT_FIELD_3_KEY);
       assertTrue(fields != null && fields.length == 1);
       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) {
       e.printStackTrace();



Mime
View raw message