lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From o...@apache.org
Subject svn commit: r479458 - in /lucene/java/trunk: CHANGES.txt src/java/org/apache/lucene/index/DocumentWriter.java src/java/org/apache/lucene/index/FieldsWriter.java src/java/org/apache/lucene/index/ParallelReader.java
Date Sun, 26 Nov 2006 23:40:19 GMT
Author: otis
Date: Sun Nov 26 15:40:18 2006
New Revision: 479458

URL: http://svn.apache.org/viewvc?view=rev&rev=479458
Log:
- LUCENE-726: removed the use of a deprecated method

Modified:
    lucene/java/trunk/CHANGES.txt
    lucene/java/trunk/src/java/org/apache/lucene/index/DocumentWriter.java
    lucene/java/trunk/src/java/org/apache/lucene/index/FieldsWriter.java
    lucene/java/trunk/src/java/org/apache/lucene/index/ParallelReader.java

Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?view=diff&rev=479458&r1=479457&r2=479458
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Sun Nov 26 15:40:18 2006
@@ -35,6 +35,10 @@
     StringIndexOutOfBoundsException was thrown.
     (Michael Busch via Erik Hatcher)
 
+ 7. LUCENE-726: Removed the use of deprecated doc.fields() method and
+    Enumeration.
+    (Michael Busch via Otis Gospodnetic)
+
 New features
 
  1. LUCENE-503: New ThaiAnalyzer and ThaiWordFilter in contrib/analyzers

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/DocumentWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/DocumentWriter.java?view=diff&rev=479458&r1=479457&r2=479458
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/DocumentWriter.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/DocumentWriter.java Sun Nov 26 15:40:18
2006
@@ -33,6 +33,7 @@
 import java.util.Arrays;
 import java.util.Enumeration;
 import java.util.Hashtable;
+import java.util.Iterator;
 
 final class DocumentWriter {
   private Analyzer analyzer;
@@ -128,9 +129,9 @@
   // Tokenizes the fields of a document into Postings.
   private final void invertDocument(Document doc)
           throws IOException {
-    Enumeration fields = doc.fields();
-    while (fields.hasMoreElements()) {
-      Fieldable field = (Fieldable) fields.nextElement();
+    Iterator fieldIterator = doc.getFields().iterator();
+    while (fieldIterator.hasNext()) {
+      Fieldable field = (Fieldable) fieldIterator.next();
       String fieldName = field.name();
       int fieldNumber = fieldInfos.fieldNumber(fieldName);
 

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/FieldsWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/FieldsWriter.java?view=diff&rev=479458&r1=479457&r2=479458
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/FieldsWriter.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/FieldsWriter.java Sun Nov 26 15:40:18
2006
@@ -18,11 +18,10 @@
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
-import java.util.Enumeration;
+import java.util.Iterator;
 import java.util.zip.Deflater;
 
 import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.IndexOutput;
@@ -54,17 +53,17 @@
         indexStream.writeLong(fieldsStream.getFilePointer());
 
         int storedCount = 0;
-        Enumeration fields = doc.fields();
-        while (fields.hasMoreElements()) {
-            Fieldable field = (Fieldable) fields.nextElement();
+        Iterator fieldIterator = doc.getFields().iterator();
+        while (fieldIterator.hasNext()) {
+            Fieldable field = (Fieldable) fieldIterator.next();
             if (field.isStored())
                 storedCount++;
         }
         fieldsStream.writeVInt(storedCount);
 
-        fields = doc.fields();
-        while (fields.hasMoreElements()) {
-            Fieldable field = (Fieldable) fields.nextElement();
+        fieldIterator = doc.getFields().iterator();
+        while (fieldIterator.hasNext()) {
+            Fieldable field = (Fieldable) fieldIterator.next();
             // if the field as an instanceof FieldsReader.FieldForMerge, we're in merge mode
             // and field.binaryValue() already returns the compressed value for a field
             // with isCompressed()==true, so we disable compression in that case

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/ParallelReader.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/ParallelReader.java?view=diff&rev=479458&r1=479457&r2=479458
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/ParallelReader.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/ParallelReader.java Sun Nov 26 15:40:18
2006
@@ -155,9 +155,9 @@
           }
       }
       if (include) {
-        Enumeration fields = reader.document(n, fieldSelector).fields();
-        while (fields.hasMoreElements()) {
-          result.add((Fieldable)fields.nextElement());
+        Iterator fieldIterator = reader.document(n, fieldSelector).getFields().iterator();
+        while (fieldIterator.hasNext()) {
+          result.add((Fieldable)fieldIterator.next());
         }
       }
     }



Mime
View raw message