lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1633441 - in /lucene/dev/branches/lucene5969/lucene: backward-codecs/src/java/org/apache/lucene/codecs/blocktree/ backward-codecs/src/test/org/apache/lucene/codecs/blocktree/ core/src/java/org/apache/lucene/codecs/blocktree/ core/src/java/...
Date Tue, 21 Oct 2014 19:49:24 GMT
Author: rmuir
Date: Tue Oct 21 19:49:24 2014
New Revision: 1633441

URL: http://svn.apache.org/r1633441
Log:
LUCENE-5969: move blocktree stats -> stats api

Modified:
    lucene/dev/branches/lucene5969/lucene/backward-codecs/src/java/org/apache/lucene/codecs/blocktree/Lucene40FieldReader.java
    lucene/dev/branches/lucene5969/lucene/backward-codecs/src/java/org/apache/lucene/codecs/blocktree/Lucene40Stats.java
    lucene/dev/branches/lucene5969/lucene/backward-codecs/src/test/org/apache/lucene/codecs/blocktree/TestLucene40BlockFormat.java
    lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/codecs/blocktree/FieldReader.java
    lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/codecs/blocktree/Stats.java
    lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/index/FilterLeafReader.java
    lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/index/Terms.java
    lucene/dev/branches/lucene5969/lucene/core/src/test/org/apache/lucene/codecs/lucene50/TestBlockPostingsFormat.java
    lucene/dev/branches/lucene5969/lucene/core/src/test/org/apache/lucene/index/TestFilterLeafReader.java

Modified: lucene/dev/branches/lucene5969/lucene/backward-codecs/src/java/org/apache/lucene/codecs/blocktree/Lucene40FieldReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/lucene/backward-codecs/src/java/org/apache/lucene/codecs/blocktree/Lucene40FieldReader.java?rev=1633441&r1=1633440&r2=1633441&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/lucene/backward-codecs/src/java/org/apache/lucene/codecs/blocktree/Lucene40FieldReader.java
(original)
+++ lucene/dev/branches/lucene5969/lucene/backward-codecs/src/java/org/apache/lucene/codecs/blocktree/Lucene40FieldReader.java
Tue Oct 21 19:49:24 2014
@@ -123,8 +123,7 @@ final class Lucene40FieldReader extends 
   }
 
   /** For debugging -- used by CheckIndex too*/
-  // TODO: maybe push this into Terms?
-  public Lucene40Stats computeStats() throws IOException {
+  public Lucene40Stats getStats() throws IOException {
     return new Lucene40SegmentTermsEnum(this).computeBlockStats();
   }
 

Modified: lucene/dev/branches/lucene5969/lucene/backward-codecs/src/java/org/apache/lucene/codecs/blocktree/Lucene40Stats.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/lucene/backward-codecs/src/java/org/apache/lucene/codecs/blocktree/Lucene40Stats.java?rev=1633441&r1=1633440&r2=1633441&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/lucene/backward-codecs/src/java/org/apache/lucene/codecs/blocktree/Lucene40Stats.java
(original)
+++ lucene/dev/branches/lucene5969/lucene/backward-codecs/src/java/org/apache/lucene/codecs/blocktree/Lucene40Stats.java
Tue Oct 21 19:49:24 2014
@@ -29,7 +29,7 @@ import org.apache.lucene.util.IOUtils;
 
 /**
  * BlockTree statistics for a single field 
- * returned by {@link Lucene40FieldReader#computeStats()}.
+ * returned by {@link Lucene40FieldReader#getStats()}.
  * @deprecated Only for 4.x backcompat
  */
 @Deprecated

Modified: lucene/dev/branches/lucene5969/lucene/backward-codecs/src/test/org/apache/lucene/codecs/blocktree/TestLucene40BlockFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/lucene/backward-codecs/src/test/org/apache/lucene/codecs/blocktree/TestLucene40BlockFormat.java?rev=1633441&r1=1633440&r2=1633441&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/lucene/backward-codecs/src/test/org/apache/lucene/codecs/blocktree/TestLucene40BlockFormat.java
(original)
+++ lucene/dev/branches/lucene5969/lucene/backward-codecs/src/test/org/apache/lucene/codecs/blocktree/TestLucene40BlockFormat.java
Tue Oct 21 19:49:24 2014
@@ -57,7 +57,7 @@ public class TestLucene40BlockFormat ext
     assertEquals(1, r.leaves().size());
     Lucene40FieldReader field = (Lucene40FieldReader) r.leaves().get(0).reader().fields().terms("field");
     // We should see exactly two blocks: one root block (prefix empty string) and one block
for z* terms (prefix z):
-    Lucene40Stats stats = field.computeStats();
+    Lucene40Stats stats = field.getStats();
     assertEquals(0, stats.floorBlockCount);
     assertEquals(2, stats.nonFloorBlockCount);
     r.close();

Modified: lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/codecs/blocktree/FieldReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/codecs/blocktree/FieldReader.java?rev=1633441&r1=1633440&r2=1633441&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/codecs/blocktree/FieldReader.java
(original)
+++ lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/codecs/blocktree/FieldReader.java
Tue Oct 21 19:49:24 2014
@@ -120,8 +120,7 @@ public final class FieldReader extends T
   }
 
   /** For debugging -- used by CheckIndex too*/
-  // TODO: maybe push this into Terms?
-  public Stats computeStats() throws IOException {
+  public Stats getStats() throws IOException {
     return new SegmentTermsEnum(this).computeBlockStats();
   }
 

Modified: lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/codecs/blocktree/Stats.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/codecs/blocktree/Stats.java?rev=1633441&r1=1633440&r2=1633441&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/codecs/blocktree/Stats.java
(original)
+++ lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/codecs/blocktree/Stats.java
Tue Oct 21 19:49:24 2014
@@ -29,7 +29,7 @@ import org.apache.lucene.util.IOUtils;
 
 /**
  * BlockTree statistics for a single field 
- * returned by {@link FieldReader#computeStats()}.
+ * returned by {@link FieldReader#getStats()}.
  */
 public class Stats {
   /** How many nodes in the index FST. */

Modified: lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/index/FilterLeafReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/index/FilterLeafReader.java?rev=1633441&r1=1633440&r2=1633441&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/index/FilterLeafReader.java
(original)
+++ lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/index/FilterLeafReader.java
Tue Oct 21 19:49:24 2014
@@ -151,6 +151,11 @@ public class FilterLeafReader extends Le
     public boolean hasPayloads() {
       return in.hasPayloads();
     }
+
+    @Override
+    public Object getStats() throws IOException {
+      return in.getStats();
+    }
   }
 
   /** Base class for filtering {@link TermsEnum} implementations. */

Modified: lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/index/Terms.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/index/Terms.java?rev=1633441&r1=1633440&r2=1633441&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/index/Terms.java
(original)
+++ lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/index/Terms.java
Tue Oct 21 19:49:24 2014
@@ -194,8 +194,17 @@ public abstract class Terms {
     }
   }
   
-  public String getStats() {
-    // nocommit: add a meaningful default
-    return "";
+  /** 
+   * Expert: returns additional information about this Terms instance
+   * for debugging purposes.
+   */
+  public Object getStats() throws IOException {
+    StringBuilder sb = new StringBuilder();
+    sb.append("impl=" + getClass().getSimpleName());
+    sb.append(",size=" + size());
+    sb.append(",docCount=" + getDocCount());
+    sb.append(",sumTotalTermFreq=" + getSumTotalTermFreq());
+    sb.append(",sumDocFreq=" + getSumDocFreq());
+    return sb.toString();
   }
 }

Modified: lucene/dev/branches/lucene5969/lucene/core/src/test/org/apache/lucene/codecs/lucene50/TestBlockPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/lucene/core/src/test/org/apache/lucene/codecs/lucene50/TestBlockPostingsFormat.java?rev=1633441&r1=1633440&r2=1633441&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/lucene/core/src/test/org/apache/lucene/codecs/lucene50/TestBlockPostingsFormat.java
(original)
+++ lucene/dev/branches/lucene5969/lucene/core/src/test/org/apache/lucene/codecs/lucene50/TestBlockPostingsFormat.java
Tue Oct 21 19:49:24 2014
@@ -57,7 +57,7 @@ public class TestBlockPostingsFormat ext
     assertEquals(1, r.leaves().size());
     FieldReader field = (FieldReader) r.leaves().get(0).reader().fields().terms("field");
     // We should see exactly two blocks: one root block (prefix empty string) and one block
for z* terms (prefix z):
-    Stats stats = field.computeStats();
+    Stats stats = field.getStats();
     assertEquals(0, stats.floorBlockCount);
     assertEquals(2, stats.nonFloorBlockCount);
     r.close();

Modified: lucene/dev/branches/lucene5969/lucene/core/src/test/org/apache/lucene/index/TestFilterLeafReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/lucene/core/src/test/org/apache/lucene/index/TestFilterLeafReader.java?rev=1633441&r1=1633440&r2=1633441&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/lucene/core/src/test/org/apache/lucene/index/TestFilterLeafReader.java
(original)
+++ lucene/dev/branches/lucene5969/lucene/core/src/test/org/apache/lucene/index/TestFilterLeafReader.java
Tue Oct 21 19:49:24 2014
@@ -166,7 +166,7 @@ public class TestFilterLeafReader extend
     for (Method m : superClazz.getMethods()) {
       final int mods = m.getModifiers();
       if (Modifier.isStatic(mods) || Modifier.isAbstract(mods) || Modifier.isFinal(mods)
|| m.isSynthetic()
-          || m.getName().equals("attributes")) {
+          || m.getName().equals("attributes") || m.getName().equals("getStats")) {
         continue;
       }
       // The point of these checks is to ensure that methods that have a default



Mime
View raw message