lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r934144 - /lucene/dev/trunk/lucene/contrib/misc/src/java/org/apache/lucene/misc/HighFreqTerms.java
Date Wed, 14 Apr 2010 19:46:10 GMT
Author: mikemccand
Date: Wed Apr 14 19:46:10 2010
New Revision: 934144

URL: http://svn.apache.org/viewvc?rev=934144&view=rev
Log:
LUCENE-2111: fix HighFreqTerms to work on flex

Modified:
    lucene/dev/trunk/lucene/contrib/misc/src/java/org/apache/lucene/misc/HighFreqTerms.java

Modified: lucene/dev/trunk/lucene/contrib/misc/src/java/org/apache/lucene/misc/HighFreqTerms.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/contrib/misc/src/java/org/apache/lucene/misc/HighFreqTerms.java?rev=934144&r1=934143&r2=934144&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/contrib/misc/src/java/org/apache/lucene/misc/HighFreqTerms.java
(original)
+++ lucene/dev/trunk/lucene/contrib/misc/src/java/org/apache/lucene/misc/HighFreqTerms.java
Wed Apr 14 19:46:10 2010
@@ -17,6 +17,8 @@ package org.apache.lucene.misc;
   */
 
 import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.MultiFields;
+import org.apache.lucene.index.Fields;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.index.TermsEnum;
@@ -55,7 +57,11 @@ public class HighFreqTerms {
     TermInfoQueue tiq = new TermInfoQueue(numTerms);
 
     if (field != null) { 
-      Terms terms = reader.fields().terms(field);
+      Fields fields = MultiFields.getFields(reader);
+      if (fields == null) {
+        return;
+      }
+      Terms terms = fields.terms(field);
       if (terms != null) {
         TermsEnum termsEnum = terms.iterator();
         while(true) {
@@ -68,11 +74,15 @@ public class HighFreqTerms {
         }
       }
     } else {
-      FieldsEnum fields = reader.fields().iterator();
+      Fields fields = MultiFields.getFields(reader);
+      if (fields == null) {
+        return;
+      }
+      FieldsEnum fieldsEnum = fields.iterator();
       while(true) {
-        field = fields.next();
+        field = fieldsEnum.next();
         if (field != null) {
-          TermsEnum terms = fields.terms();
+          TermsEnum terms = fieldsEnum.terms();
           while(true) {
             BytesRef term = terms.next();
             if (term != null) {



Mime
View raw message