You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2013/01/21 17:52:22 UTC
svn commit: r1436477 - in /lucene/dev/branches/branch_4x: ./ lucene/
lucene/facet/ lucene/facet/src/java/org/apache/lucene/facet/util/
lucene/facet/src/test/org/apache/lucene/facet/search/
Author: mikemccand
Date: Mon Jan 21 16:52:21 2013
New Revision: 1436477
URL: http://svn.apache.org/viewvc?rev=1436477&view=rev
Log:
LUCENE-4703: add simple tool to print summary stats of the facet taxonomy index
Added:
lucene/dev/branches/branch_4x/lucene/facet/src/java/org/apache/lucene/facet/util/PrintTaxonomyStats.java
- copied unchanged from r1436476, lucene/dev/trunk/lucene/facet/src/java/org/apache/lucene/facet/util/PrintTaxonomyStats.java
Modified:
lucene/dev/branches/branch_4x/ (props changed)
lucene/dev/branches/branch_4x/lucene/ (props changed)
lucene/dev/branches/branch_4x/lucene/CHANGES.txt (contents, props changed)
lucene/dev/branches/branch_4x/lucene/build.xml (contents, props changed)
lucene/dev/branches/branch_4x/lucene/facet/ (props changed)
lucene/dev/branches/branch_4x/lucene/facet/src/test/org/apache/lucene/facet/search/TestDemoFacets.java
Modified: lucene/dev/branches/branch_4x/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/CHANGES.txt?rev=1436477&r1=1436476&r2=1436477&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/branch_4x/lucene/CHANGES.txt Mon Jan 21 16:52:21 2013
@@ -43,6 +43,9 @@ New Features
* LUCENE-4686: New specialized DGapVInt8IntEncoder for facets (now the
default). (Shai Erera)
+* LUCENE-4703: Add simple PrintTaxonomyStats tool to see summary
+ information about the facets taxonomy index. (Mike McCandless)
+
======================= Lucene 4.1.0 =======================
Changes in backwards compatibility policy
Modified: lucene/dev/branches/branch_4x/lucene/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/build.xml?rev=1436477&r1=1436476&r2=1436477&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/build.xml (original)
+++ lucene/dev/branches/branch_4x/lucene/build.xml Mon Jan 21 16:52:21 2013
@@ -205,6 +205,7 @@
<exclude name="queryparser/classes/java/org/apache/lucene/queryparser/classic/QueryParserTokenManager.class"/>
<exclude name="queryparser/classes/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParserTokenManager.class"/>
<exclude name="queryparser/classes/java/org/apache/lucene/queryparser/surround/parser/QueryParserTokenManager.class"/>
+ <exclude name="facet/classes/java/org/apache/lucene/facet/util/PrintTaxonomyStats.class"/>
</fileset>
</forbidden-apis>
</target>
Modified: lucene/dev/branches/branch_4x/lucene/facet/src/test/org/apache/lucene/facet/search/TestDemoFacets.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/facet/src/test/org/apache/lucene/facet/search/TestDemoFacets.java?rev=1436477&r1=1436476&r2=1436477&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/facet/src/test/org/apache/lucene/facet/search/TestDemoFacets.java (original)
+++ lucene/dev/branches/branch_4x/lucene/facet/src/test/org/apache/lucene/facet/search/TestDemoFacets.java Mon Jan 21 16:52:21 2013
@@ -17,7 +17,9 @@ package org.apache.lucene.facet.search;
* limitations under the License.
*/
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
@@ -31,6 +33,7 @@ import org.apache.lucene.facet.taxonomy.
import org.apache.lucene.facet.taxonomy.TaxonomyReader;
import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader;
import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter;
+import org.apache.lucene.facet.util.PrintTaxonomyStats;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.search.IndexSearcher;
@@ -118,6 +121,17 @@ public class TestDemoFacets extends Luce
assertEquals("Author (2)\n Lisa (1)\n Bob (1)\n",
FacetTestUtils.toSimpleString(results.get(0)));
+ // Smoke test PrintTaxonomyStats:
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ PrintTaxonomyStats.printStats(taxoReader, new PrintStream(bos, false, "UTF-8"), true);
+ String result = bos.toString("UTF-8");
+ assertTrue(result.indexOf("/Author: 4 immediate children; 5 total categories") != -1);
+ assertTrue(result.indexOf("/Publish Date: 3 immediate children; 12 total categories") != -1);
+ // Make sure at least a few nodes of the tree came out:
+ assertTrue(result.indexOf(" /1999") != -1);
+ assertTrue(result.indexOf(" /2012") != -1);
+ assertTrue(result.indexOf(" /20") != -1);
+
taxoReader.close();
searcher.getIndexReader().close();
dir.close();