You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2013/01/27 21:01:54 UTC

svn commit: r1439164 [1/3] - in /lucene/dev/branches/lucene4547: ./ lucene/ lucene/core/ lucene/core/src/java/org/apache/lucene/codecs/compressing/ lucene/core/src/java/org/apache/lucene/search/ lucene/core/src/java/org/apache/lucene/util/ lucene/core/...

Author: rmuir
Date: Sun Jan 27 20:01:52 2013
New Revision: 1439164

URL: http://svn.apache.org/viewvc?rev=1439164&view=rev
Log:
Merged /lucene/dev/trunk:r1438171-1439161

Added:
    lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/search/LiveFieldValues.java
      - copied unchanged from r1439161, lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/LiveFieldValues.java
    lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/search/TestLiveFieldValues.java
      - copied unchanged from r1439161, lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/TestLiveFieldValues.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/FacetTestCase.java
      - copied unchanged from r1439161, lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/FacetTestCase.java
    lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/OverseerSolrResponse.java
      - copied unchanged from r1439161, lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/OverseerSolrResponse.java
    lucene/dev/branches/lucene4547/solr/example/contexts/solr-jetty-context.xml
      - copied unchanged from r1439161, lucene/dev/trunk/solr/example/contexts/solr-jetty-context.xml
Removed:
    lucene/dev/branches/lucene4547/solr/example/contexts/solr.xml
    lucene/dev/branches/lucene4547/solr/webapp/web/js/lib/jquery.sparkline.js
Modified:
    lucene/dev/branches/lucene4547/   (props changed)
    lucene/dev/branches/lucene4547/lucene/   (props changed)
    lucene/dev/branches/lucene4547/lucene/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/lucene4547/lucene/core/   (props changed)
    lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressionMode.java
    lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/codecs/compressing/LZ4.java
    lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/search/ReferenceManager.java
    lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/NumericUtils.java
    lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/search/TestNRTManager.java
    lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java
    lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java
    lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/search/TestSearcherManager.java
    lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/util/TestNumericUtils.java
    lucene/dev/branches/lucene4547/lucene/facet/   (props changed)
    lucene/dev/branches/lucene4547/lucene/facet/src/examples/org/apache/lucene/facet/example/merge/TaxonomyMergeUtils.java
    lucene/dev/branches/lucene4547/lucene/facet/src/examples/org/apache/lucene/facet/example/simple/SimpleSearcher.java
    lucene/dev/branches/lucene4547/lucene/facet/src/java/org/apache/lucene/facet/index/params/CategoryListParams.java
    lucene/dev/branches/lucene4547/lucene/facet/src/java/org/apache/lucene/facet/search/DrillDown.java
    lucene/dev/branches/lucene4547/lucene/facet/src/java/org/apache/lucene/facet/util/PrintTaxonomyStats.java
    lucene/dev/branches/lucene4547/lucene/facet/src/java/org/apache/lucene/util/encoding/FourFlagsIntDecoder.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/FacetTestBase.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/FacetTestUtils.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/index/OrdinalMappingReaderTest.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/index/TestFacetsPayloadMigrationReader.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/index/params/CategoryListParamsTest.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/index/params/FacetIndexingParamsTest.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/index/params/PerDimensionIndexingParamsTest.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/CategoryListIteratorTest.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/CountingFacetsCollectorTest.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/DrillDownTest.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/TestDemoFacets.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/TestFacetArrays.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/TestFacetsAccumulatorWithComplement.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/TestFacetsCollector.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/TestMultipleCategoryLists.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/TestScoredDocIdCollector.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/TestStandardFacetsAccumulator.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/TestTopKInEachNodeResultHandler.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/TestTotalFacetCounts.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/TestTotalFacetCountsCache.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/associations/AssociationsFacetRequestTest.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/params/FacetRequestTest.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/params/FacetSearchParamsTest.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/params/MultiCategoryListIteratorTest.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/sampling/OversampleWithDepthTest.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/TestCategoryPath.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/TestTaxonomyCombined.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestAddTaxonomy.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestConcurrentFacetedIndexing.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestDirectoryTaxonomyReader.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestDirectoryTaxonomyWriter.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/writercache/cl2o/TestCharBlockArray.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/writercache/cl2o/TestCompactLabelToOrdinal.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/util/TestScoredDocIDsUtils.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/util/UnsafeByteArrayInputStreamTest.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/util/UnsafeByteArrayOutputStreamTest.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/util/collections/ArrayHashMapTest.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/util/collections/FloatToObjectMapTest.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/util/collections/IntArrayTest.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/util/collections/IntHashSetTest.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/util/collections/IntToDoubleMapTest.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/util/collections/IntToFloatMapTest.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/util/collections/IntToIntMapTest.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/util/collections/IntToObjectMapTest.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/util/collections/ObjectToFloatMapTest.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/util/collections/ObjectToIntMapTest.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/util/collections/TestLRUHashMap.java
    lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/util/encoding/EncodingTest.java
    lucene/dev/branches/lucene4547/solr/   (props changed)
    lucene/dev/branches/lucene4547/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/lucene4547/solr/contrib/   (props changed)
    lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestBuiltInEvaluators.java
    lucene/dev/branches/lucene4547/solr/core/   (props changed)
    lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/DistributedQueue.java
    lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java
    lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java
    lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/schema/TrieField.java
    lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/update/UpdateLog.java
    lucene/dev/branches/lucene4547/solr/core/src/test/org/apache/solr/cloud/OverseerCollectionProcessorTest.java
    lucene/dev/branches/lucene4547/solr/example/   (props changed)
    lucene/dev/branches/lucene4547/solr/solrj/   (props changed)
    lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/SolrQuery.java
    lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/client/solrj/SolrResponse.java
    lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/SolrDocument.java
    lucene/dev/branches/lucene4547/solr/solrj/src/java/org/apache/solr/common/SolrInputDocument.java
    lucene/dev/branches/lucene4547/solr/solrj/src/test/org/apache/solr/client/solrj/SolrQueryTest.java
    lucene/dev/branches/lucene4547/solr/webapp/   (props changed)
    lucene/dev/branches/lucene4547/solr/webapp/web/css/styles/schema-browser.css
    lucene/dev/branches/lucene4547/solr/webapp/web/js/main.js
    lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/app.js
    lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/dataimport.js
    lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/schema-browser.js
    lucene/dev/branches/lucene4547/solr/webapp/web/tpl/schema-browser.html

Modified: lucene/dev/branches/lucene4547/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/CHANGES.txt?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/lucene4547/lucene/CHANGES.txt Sun Jan 27 20:01:52 2013
@@ -58,6 +58,9 @@ Optimizations
 * LUCENE-3298: FST can now be larger than 2.1 GB / 2.1 B nodes.
   (James Dyer, Mike McCandless)
 
+* LUCENE-4690: Performance improvements and non-hashing versions
+  of NumericUtils.*ToPrefixCoded() (yonik)
+
 New Features
 
 * LUCENE-4686: New specialized DGapVInt8IntEncoder for facets (now the 
@@ -70,9 +73,23 @@ New Features
   compresses term vectors into chunks of documents similarly to
   CompressingStoredFieldsFormat. (Adrien Grand)
 
+* LUCENE-4695: Added LiveFieldValues utility class, for getting the
+  current (live, real-time) value for any indexed doc/field.  The
+  class buffers recently indexed doc/field values until a new
+  near-real-time reader is opened that contains those changes.
+  (Robert Muir, Mike McCandless)
+
 API Changes
 
 * LUCENE-4709: FacetResultNode no longer has a residue field. (Shai Erera)
+
+* LUCENE-4716: DrillDown.query now takes Occur, allowing to specify if
+  categories should be OR'ed or AND'ed. (Shai Erera)
+
+* LUCENE-4695: ReferenceManager.RefreshListener.afterRefresh now takes
+  a boolean indicating whether a new reference was in fact opened, and
+  a new beforeRefresh method notifies you when a refresh attempt is
+  starting.  (Robert Muir, Mike McCandless)
   
 Bug Fixes
 
@@ -414,6 +431,13 @@ Changes in Runtime Behavior
   This only affects requests with depth>1. If you execute such requests and
   rely on the facet results being returned flat (i.e. no hierarchy), you should
   set the ResultMode to GLOBAL_FLAT. (Shai Erera, Gilad Barkai) 
+
+* LUCENE-1822: Improves the text window selection by recalculating the starting margin
+  once all phrases in the fragment have been identified in FastVectorHighlighter. This
+  way if a single word is matched in a fragment, it will appear in the middle of the highlight,
+  instead of 6 characters from the beginning. This way one can also guarantee that
+  the entirety of short texts are represented in a fragment by specifying a large
+  enough fragCharSize.
   
 Optimizations
 

Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressionMode.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressionMode.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressionMode.java (original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressionMode.java Sun Jan 27 20:01:52 2013
@@ -45,7 +45,7 @@ public abstract class CompressionMode {
 
     @Override
     public Compressor newCompressor() {
-      return LZ4_FAST_COMPRESSOR;
+      return new LZ4FastCompressor();
     }
 
     @Override
@@ -95,7 +95,7 @@ public abstract class CompressionMode {
 
     @Override
     public Compressor newCompressor() {
-      return LZ4_HIGH_COMPRESSOR;
+      return new LZ4HighCompressor();
     }
 
     @Override
@@ -147,25 +147,37 @@ public abstract class CompressionMode {
 
   };
 
-  private static final Compressor LZ4_FAST_COMPRESSOR = new Compressor() {
+  private static final class LZ4FastCompressor extends Compressor {
+
+    private final LZ4.HashTable ht;
+
+    LZ4FastCompressor() {
+      ht = new LZ4.HashTable();
+    }
 
     @Override
     public void compress(byte[] bytes, int off, int len, DataOutput out)
         throws IOException {
-      LZ4.compress(bytes, off, len, out);
+      LZ4.compress(bytes, off, len, out, ht);
     }
 
-  };
+  }
 
-  private static final Compressor LZ4_HIGH_COMPRESSOR = new Compressor() {
+  private static final class LZ4HighCompressor extends Compressor {
+
+    private final LZ4.HCHashTable ht;
+
+    LZ4HighCompressor() {
+      ht = new LZ4.HCHashTable();
+    }
 
     @Override
     public void compress(byte[] bytes, int off, int len, DataOutput out)
         throws IOException {
-      LZ4.compressHC(bytes, off, len, out);
+      LZ4.compressHC(bytes, off, len, out, ht);
     }
 
-  };
+  }
 
   private static final class DeflateDecompressor extends Decompressor {
 

Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/codecs/compressing/LZ4.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/codecs/compressing/LZ4.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/codecs/compressing/LZ4.java (original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/codecs/compressing/LZ4.java Sun Jan 27 20:01:52 2013
@@ -30,7 +30,7 @@ import org.apache.lucene.util.packed.Pac
  * http://code.google.com/p/lz4/
  * http://fastcompression.blogspot.fr/p/lz4.html
  */
-class LZ4 {
+final class LZ4 {
 
   private LZ4() {}
 
@@ -181,11 +181,29 @@ class LZ4 {
     }
   }
 
+  static final class HashTable {
+    private int hashLog;
+    private PackedInts.Mutable hashTable;
+
+    void reset(int len) {
+      final int bitsPerOffset = PackedInts.bitsRequired(len - LAST_LITERALS);
+      final int bitsPerOffsetLog = 32 - Integer.numberOfLeadingZeros(bitsPerOffset - 1);
+      hashLog = MEMORY_USAGE + 3 - bitsPerOffsetLog;
+      if (hashTable == null || hashTable.size() < 1 << hashLog || hashTable.getBitsPerValue() < bitsPerOffset) {
+        hashTable = PackedInts.getMutable(1 << hashLog, bitsPerOffset, PackedInts.DEFAULT);
+      } else {
+        hashTable.clear();
+      }
+    }
+
+  }
+
   /**
    * Compress <code>bytes[off:off+len]</code> into <code>out</code> using
-   * at most 16KB of memory.
+   * at most 16KB of memory. <code>ht</code> shouldn't be shared across threads
+   * but can safely be reused.
    */
-  public static void compress(byte[] bytes, int off, int len, DataOutput out) throws IOException {
+  public static void compress(byte[] bytes, int off, int len, DataOutput out, HashTable ht) throws IOException {
 
     final int base = off;
     final int end = off + len;
@@ -196,11 +214,9 @@ class LZ4 {
 
       final int limit = end - LAST_LITERALS;
       final int matchLimit = limit - MIN_MATCH;
-
-      final int bitsPerOffset = PackedInts.bitsRequired(len - LAST_LITERALS);
-      final int bitsPerOffsetLog = 32 - Integer.numberOfLeadingZeros(bitsPerOffset - 1);
-      final int hashLog = MEMORY_USAGE + 3 - bitsPerOffsetLog;
-      final PackedInts.Mutable hashTable = PackedInts.getMutable(1 << hashLog, bitsPerOffset, PackedInts.DEFAULT);
+      ht.reset(len);
+      final int hashLog = ht.hashLog;
+      final PackedInts.Mutable hashTable = ht.hashTable;
 
       main:
       while (off < limit) {
@@ -256,20 +272,24 @@ class LZ4 {
     m2.ref = m1.ref;
   }
 
-  private static class HashTable {
+  static final class HCHashTable {
     static final int MAX_ATTEMPTS = 256;
     static final int MASK = MAX_DISTANCE - 1;
     int nextToUpdate;
-    private final int base;
+    private int base;
     private final int[] hashTable;
     private final short[] chainTable;
 
-    HashTable(int base) {
+    HCHashTable() {
+      hashTable = new int[HASH_TABLE_SIZE_HC];
+      chainTable = new short[MAX_DISTANCE];
+    }
+
+    private void reset(int base) {
       this.base = base;
       nextToUpdate = base;
-      hashTable = new int[HASH_TABLE_SIZE_HC];
       Arrays.fill(hashTable, -1);
-      chainTable = new short[MAX_DISTANCE];
+      Arrays.fill(chainTable, (short) 0);
     }
 
     private int hashPointer(byte[] bytes, int off) {
@@ -355,12 +375,14 @@ class LZ4 {
 
   /**
    * Compress <code>bytes[off:off+len]</code> into <code>out</code>. Compared to
-   * {@link LZ4#compress(byte[], int, int, DataOutput)}, this method is slower,
-   * uses more memory (~ 256KB), but should provide better compression ratios
-   * (especially on large inputs) because it chooses the best match among up to
-   * 256 candidates and then performs trade-offs to fix overlapping matches.
+   * {@link LZ4#compress(byte[], int, int, DataOutput, HashTable)}, this method
+   * is slower and uses more memory (~ 256KB per thread) but should provide
+   * better compression ratios (especially on large inputs) because it chooses
+   * the best match among up to 256 candidates and then performs trade-offs to
+   * fix overlapping matches. <code>ht</code> shouldn't be shared across threads
+   * but can safely be reused.
    */
-  public static void compressHC(byte[] src, int srcOff, int srcLen, DataOutput out) throws IOException {
+  public static void compressHC(byte[] src, int srcOff, int srcLen, DataOutput out, HCHashTable ht) throws IOException {
 
     final int srcEnd = srcOff + srcLen;
     final int matchLimit = srcEnd - LAST_LITERALS;
@@ -368,7 +390,7 @@ class LZ4 {
     int sOff = srcOff;
     int anchor = sOff++;
 
-    final HashTable ht = new HashTable(srcOff);
+    ht.reset(srcOff);
     final Match match0 = new Match();
     final Match match1 = new Match();
     final Match match2 = new Match();

Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/search/ReferenceManager.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/search/ReferenceManager.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/search/ReferenceManager.java (original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/search/ReferenceManager.java Sun Jan 27 20:01:52 2013
@@ -151,6 +151,7 @@ public abstract class ReferenceManager<G
     try {
       final G reference = acquire();
       try {
+        notifyRefreshListenersBefore();
         G newReference = refreshIfNeeded(reference);
         if (newReference != null) {
           assert newReference != reference : "refreshIfNeeded should return null if refresh wasn't needed";
@@ -165,11 +166,9 @@ public abstract class ReferenceManager<G
         }
       } finally {
         release(reference);
+        notifyRefreshListenersRefreshed(refreshed);
       }
       afterMaybeRefresh();
-      if (refreshed) {
-        notifyRefreshListeners();
-      }
     } finally {
       refreshLock.unlock();
     }
@@ -254,9 +253,15 @@ public abstract class ReferenceManager<G
     decRef(reference);
   }
 
-  private void notifyRefreshListeners() {
+  private void notifyRefreshListenersBefore() throws IOException {
+    for (RefreshListener refreshListener : refreshListeners) {
+      refreshListener.beforeRefresh();
+    }
+  }
+
+  private void notifyRefreshListenersRefreshed(boolean didRefresh) throws IOException {
     for (RefreshListener refreshListener : refreshListeners) {
-      refreshListener.afterRefresh();
+      refreshListener.afterRefresh(didRefresh);
     }
   }
 
@@ -284,9 +289,13 @@ public abstract class ReferenceManager<G
    *  finished.  See {@link #addListener}. */
   public interface RefreshListener {
 
-    /**
-     * Called after a successful refresh and a new reference has been installed. When this is called {@link #acquire()} is guaranteed to return a new instance.
-     */
-    void afterRefresh();
+    /** Called right before a refresh attempt starts. */
+    void beforeRefresh() throws IOException;
+
+    /** Called after the attempted refresh; if the refresh
+     * did open a new reference then didRefresh will be true
+     * and {@link #acquire()} is guaranteed to return the new
+     * reference. */
+    void afterRefresh(boolean didRefresh) throws IOException;
   }
 }

Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/NumericUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/NumericUtils.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/NumericUtils.java (original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/NumericUtils.java Sun Jan 27 20:01:52 2013
@@ -82,7 +82,7 @@ public final class NumericUtils {
   /**
    * The maximum term length (used for <code>byte[]</code> buffer size)
    * for encoding <code>long</code> values.
-   * @see #longToPrefixCoded(long,int,BytesRef)
+   * @see #longToPrefixCodedBytes
    */
   public static final int BUF_SIZE_LONG = 63/7 + 2;
 
@@ -95,7 +95,7 @@ public final class NumericUtils {
   /**
    * The maximum term length (used for <code>byte[]</code> buffer size)
    * for encoding <code>int</code> values.
-   * @see #intToPrefixCoded(int,int,BytesRef)
+   * @see #intToPrefixCodedBytes
    */
   public static final int BUF_SIZE_INT = 31/7 + 2;
 
@@ -109,15 +109,42 @@ public final class NumericUtils {
    * @return the hash code for indexing (TermsHash)
    */
   public static int longToPrefixCoded(final long val, final int shift, final BytesRef bytes) {
-    if (shift>63 || shift<0)
+    longToPrefixCodedBytes(val, shift, bytes);
+    return bytes.hashCode();
+  }
+
+  /**
+   * Returns prefix coded bits after reducing the precision by <code>shift</code> bits.
+   * This is method is used by {@link NumericTokenStream}.
+   * After encoding, {@code bytes.offset} will always be 0.
+   * @param val the numeric value
+   * @param shift how many bits to strip from the right
+   * @param bytes will contain the encoded value
+   * @return the hash code for indexing (TermsHash)
+   */
+  public static int intToPrefixCoded(final int val, final int shift, final BytesRef bytes) {
+    intToPrefixCodedBytes(val, shift, bytes);
+    return bytes.hashCode();
+  }
+
+  /**
+   * Returns prefix coded bits after reducing the precision by <code>shift</code> bits.
+   * This is method is used by {@link NumericTokenStream}.
+   * After encoding, {@code bytes.offset} will always be 0.
+   * @param val the numeric value
+   * @param shift how many bits to strip from the right
+   * @param bytes will contain the encoded value
+   */
+  public static void longToPrefixCodedBytes(final long val, final int shift, final BytesRef bytes) {
+    if ((shift & ~0x3f) != 0)  // ensure shift is 0..63
       throw new IllegalArgumentException("Illegal shift value, must be 0..63");
-    int hash, nChars = (63-shift)/7 + 1;
+    int nChars = (((63-shift)*37)>>8) + 1;    // i/7 is the same as (i*37)>>8 for i in 0..63
     bytes.offset = 0;
-    bytes.length = nChars+1;
+    bytes.length = nChars+1;   // one extra for the byte that contains the shift info
     if (bytes.bytes.length < bytes.length) {
-      bytes.grow(NumericUtils.BUF_SIZE_LONG);
+      bytes.bytes = new byte[NumericUtils.BUF_SIZE_LONG];  // use the max
     }
-    bytes.bytes[0] = (byte) (hash = (SHIFT_START_LONG + shift));
+    bytes.bytes[0] = (byte)(SHIFT_START_LONG + shift);
     long sortableBits = val ^ 0x8000000000000000L;
     sortableBits >>>= shift;
     while (nChars > 0) {
@@ -126,13 +153,9 @@ public final class NumericUtils {
       bytes.bytes[nChars--] = (byte)(sortableBits & 0x7f);
       sortableBits >>>= 7;
     }
-    // calculate hash
-    for (int i = 1; i < bytes.length; i++) {
-      hash = 31*hash + bytes.bytes[i];
-    }
-    return hash;
   }
 
+
   /**
    * Returns prefix coded bits after reducing the precision by <code>shift</code> bits.
    * This is method is used by {@link NumericTokenStream}.
@@ -140,18 +163,17 @@ public final class NumericUtils {
    * @param val the numeric value
    * @param shift how many bits to strip from the right
    * @param bytes will contain the encoded value
-   * @return the hash code for indexing (TermsHash)
    */
-  public static int intToPrefixCoded(final int val, final int shift, final BytesRef bytes) {
-    if (shift>31 || shift<0)
+  public static void intToPrefixCodedBytes(final int val, final int shift, final BytesRef bytes) {
+    if ((shift & ~0x1f) != 0)  // ensure shift is 0..31
       throw new IllegalArgumentException("Illegal shift value, must be 0..31");
-    int hash, nChars = (31-shift)/7 + 1;
+    int nChars = (((31-shift)*37)>>8) + 1;    // i/7 is the same as (i*37)>>8 for i in 0..63
     bytes.offset = 0;
-    bytes.length = nChars+1;
+    bytes.length = nChars+1;   // one extra for the byte that contains the shift info
     if (bytes.bytes.length < bytes.length) {
-      bytes.grow(NumericUtils.BUF_SIZE_INT);
+      bytes.bytes = new byte[NumericUtils.BUF_SIZE_LONG];  // use the max
     }
-    bytes.bytes[0] = (byte) (hash = (SHIFT_START_INT + shift));
+    bytes.bytes[0] = (byte)(SHIFT_START_INT + shift);
     int sortableBits = val ^ 0x80000000;
     sortableBits >>>= shift;
     while (nChars > 0) {
@@ -160,13 +182,9 @@ public final class NumericUtils {
       bytes.bytes[nChars--] = (byte)(sortableBits & 0x7f);
       sortableBits >>>= 7;
     }
-    // calculate hash
-    for (int i = 1; i < bytes.length; i++) {
-      hash = 31*hash + bytes.bytes[i];
-    }
-    return hash;
   }
 
+
   /**
    * Returns the shift value from a prefix encoded {@code long}.
    * @throws NumberFormatException if the supplied {@link BytesRef} is
@@ -197,7 +215,7 @@ public final class NumericUtils {
    * This method can be used to decode a term's value.
    * @throws NumberFormatException if the supplied {@link BytesRef} is
    * not correctly prefix encoded.
-   * @see #longToPrefixCoded(long,int,BytesRef)
+   * @see #longToPrefixCodedBytes
    */
   public static long prefixCodedToLong(final BytesRef val) {
     long sortableBits = 0L;
@@ -221,7 +239,7 @@ public final class NumericUtils {
    * This method can be used to decode a term's value.
    * @throws NumberFormatException if the supplied {@link BytesRef} is
    * not correctly prefix encoded.
-   * @see #intToPrefixCoded(int,int,BytesRef)
+   * @see #intToPrefixCodedBytes
    */
   public static int prefixCodedToInt(final BytesRef val) {
     int sortableBits = 0;
@@ -402,8 +420,8 @@ public final class NumericUtils {
      */
     public void addRange(final long min, final long max, final int shift) {
       final BytesRef minBytes = new BytesRef(BUF_SIZE_LONG), maxBytes = new BytesRef(BUF_SIZE_LONG);
-      longToPrefixCoded(min, shift, minBytes);
-      longToPrefixCoded(max, shift, maxBytes);
+      longToPrefixCodedBytes(min, shift, minBytes);
+      longToPrefixCodedBytes(max, shift, maxBytes);
       addRange(minBytes, maxBytes);
     }
   
@@ -431,8 +449,8 @@ public final class NumericUtils {
      */
     public void addRange(final int min, final int max, final int shift) {
       final BytesRef minBytes = new BytesRef(BUF_SIZE_INT), maxBytes = new BytesRef(BUF_SIZE_INT);
-      intToPrefixCoded(min, shift, minBytes);
-      intToPrefixCoded(max, shift, maxBytes);
+      intToPrefixCodedBytes(min, shift, minBytes);
+      intToPrefixCodedBytes(max, shift, maxBytes);
       addRange(minBytes, maxBytes);
     }
   

Modified: lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/search/TestNRTManager.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/search/TestNRTManager.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/search/TestNRTManager.java (original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/search/TestNRTManager.java Sun Jan 27 20:01:52 2013
@@ -423,8 +423,13 @@ public class TestNRTManager extends Thre
     NRTManager sm = new NRTManager(new NRTManager.TrackingIndexWriter(iw),new SearcherFactory());
     sm.addListener(new ReferenceManager.RefreshListener() {
       @Override
-      public void afterRefresh() {
-        afterRefreshCalled.set(true);
+      public void beforeRefresh() {
+      }
+      @Override
+      public void afterRefresh(boolean didRefresh) {
+        if (didRefresh) {
+          afterRefreshCalled.set(true);
+        }
       }
     });
     iw.addDocument(new Document());

Modified: lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java (original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java Sun Jan 27 20:01:52 2013
@@ -380,8 +380,8 @@ public class TestNumericRangeQuery32 ext
         int a=lower; lower=upper; upper=a;
       }
       final BytesRef lowerBytes = new BytesRef(NumericUtils.BUF_SIZE_INT), upperBytes = new BytesRef(NumericUtils.BUF_SIZE_INT);
-      NumericUtils.intToPrefixCoded(lower, 0, lowerBytes);
-      NumericUtils.intToPrefixCoded(upper, 0, upperBytes);
+      NumericUtils.intToPrefixCodedBytes(lower, 0, lowerBytes);
+      NumericUtils.intToPrefixCodedBytes(upper, 0, upperBytes);
 
       // test inclusive range
       NumericRangeQuery<Integer> tq=NumericRangeQuery.newIntRange(field, precisionStep, lower, upper, true, true);

Modified: lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java (original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java Sun Jan 27 20:01:52 2013
@@ -405,8 +405,8 @@ public class TestNumericRangeQuery64 ext
         long a=lower; lower=upper; upper=a;
       }
       final BytesRef lowerBytes = new BytesRef(NumericUtils.BUF_SIZE_LONG), upperBytes = new BytesRef(NumericUtils.BUF_SIZE_LONG);
-      NumericUtils.longToPrefixCoded(lower, 0, lowerBytes);
-      NumericUtils.longToPrefixCoded(upper, 0, upperBytes);
+      NumericUtils.longToPrefixCodedBytes(lower, 0, lowerBytes);
+      NumericUtils.longToPrefixCodedBytes(upper, 0, upperBytes);
       
       // test inclusive range
       NumericRangeQuery<Long> tq=NumericRangeQuery.newLongRange(field, precisionStep, lower, upper, true, true);

Modified: lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/search/TestSearcherManager.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/search/TestSearcherManager.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/search/TestSearcherManager.java (original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/search/TestSearcherManager.java Sun Jan 27 20:01:52 2013
@@ -331,8 +331,13 @@ public class TestSearcherManager extends
     SearcherManager sm = new SearcherManager(iw, false, new SearcherFactory());
     sm.addListener(new ReferenceManager.RefreshListener() {
       @Override
-      public void afterRefresh() {
-        afterRefreshCalled.set(true);
+      public void beforeRefresh() {
+      }
+      @Override
+      public void afterRefresh(boolean didRefresh) {
+        if (didRefresh) {
+          afterRefreshCalled.set(true);
+        }
       }
     });
     iw.addDocument(new Document());

Modified: lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/util/TestNumericUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/util/TestNumericUtils.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/util/TestNumericUtils.java (original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/util/TestNumericUtils.java Sun Jan 27 20:01:52 2013
@@ -28,7 +28,7 @@ public class TestNumericUtils extends Lu
     // generate a series of encoded longs, each numerical one bigger than the one before
     BytesRef last=null, act=new BytesRef(NumericUtils.BUF_SIZE_LONG);
     for (long l=-100000L; l<100000L; l++) {
-      NumericUtils.longToPrefixCoded(l, 0, act);
+      NumericUtils.longToPrefixCodedBytes(l, 0, act);
       if (last!=null) {
         // test if smaller
         assertTrue("actual bigger than last (BytesRef)", last.compareTo(act) < 0 );
@@ -46,7 +46,7 @@ public class TestNumericUtils extends Lu
     // generate a series of encoded ints, each numerical one bigger than the one before
     BytesRef last=null, act=new BytesRef(NumericUtils.BUF_SIZE_INT);
     for (int i=-100000; i<100000; i++) {
-      NumericUtils.intToPrefixCoded(i, 0, act);
+      NumericUtils.intToPrefixCodedBytes(i, 0, act);
       if (last!=null) {
         // test if smaller
         assertTrue("actual bigger than last (BytesRef)", last.compareTo(act) < 0 );
@@ -69,7 +69,7 @@ public class TestNumericUtils extends Lu
     
     for (int i=0; i<vals.length; i++) {
       prefixVals[i] = new BytesRef(NumericUtils.BUF_SIZE_LONG);
-      NumericUtils.longToPrefixCoded(vals[i], 0, prefixVals[i]);
+      NumericUtils.longToPrefixCodedBytes(vals[i], 0, prefixVals[i]);
       
       // check forward and back conversion
       assertEquals( "forward and back conversion should generate same long", vals[i], NumericUtils.prefixCodedToLong(prefixVals[i]) );
@@ -92,7 +92,7 @@ public class TestNumericUtils extends Lu
     final BytesRef ref = new BytesRef(NumericUtils.BUF_SIZE_LONG);
     for (int i=0; i<vals.length; i++) {
       for (int j=0; j<64; j++) {
-        NumericUtils.longToPrefixCoded(vals[i], j, ref);
+        NumericUtils.longToPrefixCodedBytes(vals[i], j, ref);
         long prefixVal=NumericUtils.prefixCodedToLong(ref);
         long mask=(1L << j) - 1L;
         assertEquals( "difference between prefix val and original value for "+vals[i]+" with shift="+j, vals[i] & mask, vals[i]-prefixVal );
@@ -109,7 +109,7 @@ public class TestNumericUtils extends Lu
     
     for (int i=0; i<vals.length; i++) {
       prefixVals[i] = new BytesRef(NumericUtils.BUF_SIZE_INT);
-      NumericUtils.intToPrefixCoded(vals[i], 0, prefixVals[i]);
+      NumericUtils.intToPrefixCodedBytes(vals[i], 0, prefixVals[i]);
       
       // check forward and back conversion
       assertEquals( "forward and back conversion should generate same int", vals[i], NumericUtils.prefixCodedToInt(prefixVals[i]) );
@@ -132,7 +132,7 @@ public class TestNumericUtils extends Lu
     final BytesRef ref = new BytesRef(NumericUtils.BUF_SIZE_LONG);
     for (int i=0; i<vals.length; i++) {
       for (int j=0; j<32; j++) {
-        NumericUtils.intToPrefixCoded(vals[i], j, ref);
+        NumericUtils.intToPrefixCodedBytes(vals[i], j, ref);
         int prefixVal=NumericUtils.prefixCodedToInt(ref);
         int mask=(1 << j) - 1;
         assertEquals( "difference between prefix val and original value for "+vals[i]+" with shift="+j, vals[i] & mask, vals[i]-prefixVal );

Modified: lucene/dev/branches/lucene4547/lucene/facet/src/examples/org/apache/lucene/facet/example/merge/TaxonomyMergeUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/facet/src/examples/org/apache/lucene/facet/example/merge/TaxonomyMergeUtils.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/facet/src/examples/org/apache/lucene/facet/example/merge/TaxonomyMergeUtils.java (original)
+++ lucene/dev/branches/lucene4547/lucene/facet/src/examples/org/apache/lucene/facet/example/merge/TaxonomyMergeUtils.java Sun Jan 27 20:01:52 2013
@@ -45,17 +45,17 @@ public class TaxonomyMergeUtils {
    * opens {@link DirectoryTaxonomyWriter} and {@link IndexWriter} on the
    * respective destination indexes. Therefore if you have a writer open on any
    * of them, it should be closed, or you should use
-   * {@link #merge(Directory, Directory, IndexWriter, DirectoryTaxonomyWriter)}
+   * {@link #merge(Directory, Directory, IndexWriter, DirectoryTaxonomyWriter, FacetIndexingParams)}
    * instead.
    * 
-   * @see #merge(Directory, Directory, IndexWriter, DirectoryTaxonomyWriter)
+   * @see #merge(Directory, Directory, IndexWriter, DirectoryTaxonomyWriter, FacetIndexingParams)
    */
-  public static void merge(Directory srcIndexDir, Directory srcTaxDir,
-                            Directory destIndexDir, Directory destTaxDir) throws IOException {
+  public static void merge(Directory srcIndexDir, Directory srcTaxDir, Directory destIndexDir, Directory destTaxDir, 
+      FacetIndexingParams params) throws IOException {
     IndexWriter destIndexWriter = new IndexWriter(destIndexDir,
         new IndexWriterConfig(ExampleUtils.EXAMPLE_VER, null));
     DirectoryTaxonomyWriter destTaxWriter = new DirectoryTaxonomyWriter(destTaxDir);
-    merge(srcIndexDir, srcTaxDir, new MemoryOrdinalMap(), destIndexWriter, destTaxWriter);
+    merge(srcIndexDir, srcTaxDir, new MemoryOrdinalMap(), destIndexWriter, destTaxWriter, params);
     destTaxWriter.close();
     destIndexWriter.close();
   }
@@ -64,30 +64,26 @@ public class TaxonomyMergeUtils {
    * Merges the given taxonomy and index directories and commits the changes to
    * the given writers. This method uses {@link MemoryOrdinalMap} to store the
    * mapped ordinals. If you cannot afford the memory, you can use
-   * {@link #merge(Directory, Directory, DirectoryTaxonomyWriter.OrdinalMap, IndexWriter, DirectoryTaxonomyWriter)}
+   * {@link #merge(Directory, Directory, DirectoryTaxonomyWriter.OrdinalMap, IndexWriter, DirectoryTaxonomyWriter, FacetIndexingParams)}
    * by passing {@link DiskOrdinalMap}.
    * 
-   * @see #merge(Directory, Directory, DirectoryTaxonomyWriter.OrdinalMap, IndexWriter, DirectoryTaxonomyWriter)
+   * @see #merge(Directory, Directory, DirectoryTaxonomyWriter.OrdinalMap,
+   *      IndexWriter, DirectoryTaxonomyWriter, FacetIndexingParams)
    */
-  public static void merge(Directory srcIndexDir, Directory srcTaxDir,
-                            IndexWriter destIndexWriter, 
-                            DirectoryTaxonomyWriter destTaxWriter) throws IOException {
-    merge(srcIndexDir, srcTaxDir, new MemoryOrdinalMap(), destIndexWriter, destTaxWriter);
+  public static void merge(Directory srcIndexDir, Directory srcTaxDir, IndexWriter destIndexWriter, 
+      DirectoryTaxonomyWriter destTaxWriter, FacetIndexingParams params) throws IOException {
+    merge(srcIndexDir, srcTaxDir, new MemoryOrdinalMap(), destIndexWriter, destTaxWriter, params);
   }
   
   /**
    * Merges the given taxonomy and index directories and commits the changes to
    * the given writers.
    */
-  public static void merge(Directory srcIndexDir, Directory srcTaxDir,
-                            OrdinalMap map, IndexWriter destIndexWriter,
-                            DirectoryTaxonomyWriter destTaxWriter) throws IOException {
+  public static void merge(Directory srcIndexDir, Directory srcTaxDir, OrdinalMap map, IndexWriter destIndexWriter, 
+      DirectoryTaxonomyWriter destTaxWriter, FacetIndexingParams params) throws IOException {
     // merge the taxonomies
     destTaxWriter.addTaxonomy(srcTaxDir, map);
-
     int ordinalMap[] = map.getMap();
-    FacetIndexingParams params = FacetIndexingParams.ALL_PARENTS;
-
     DirectoryReader reader = DirectoryReader.open(srcIndexDir, -1);
     List<AtomicReaderContext> leaves = reader.leaves();
     int numReaders = leaves.size();

Modified: lucene/dev/branches/lucene4547/lucene/facet/src/examples/org/apache/lucene/facet/example/simple/SimpleSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/facet/src/examples/org/apache/lucene/facet/example/simple/SimpleSearcher.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/facet/src/examples/org/apache/lucene/facet/example/simple/SimpleSearcher.java (original)
+++ lucene/dev/branches/lucene4547/lucene/facet/src/examples/org/apache/lucene/facet/example/simple/SimpleSearcher.java Sun Jan 27 20:01:52 2013
@@ -1,6 +1,5 @@
 package org.apache.lucene.facet.example.simple;
 
-import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 
@@ -17,6 +16,7 @@ import org.apache.lucene.facet.taxonomy.
 import org.apache.lucene.facet.taxonomy.TaxonomyReader;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.Term;
+import org.apache.lucene.search.BooleanClause.Occur;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.MultiCollector;
 import org.apache.lucene.search.Query;
@@ -153,7 +153,7 @@ public class SimpleSearcher {
     CategoryPath categoryOfInterest = resIterator.next().label;
     
     // drill-down preparation: turn the base query into a drill-down query for the category of interest
-    Query q2 = DrillDown.query(indexingParams, baseQuery, categoryOfInterest);
+    Query q2 = DrillDown.query(indexingParams, baseQuery, Occur.MUST, categoryOfInterest);
     
     // that's it - search with the new query and we're done!
     // only documents both matching the base query AND containing the 

Modified: lucene/dev/branches/lucene4547/lucene/facet/src/java/org/apache/lucene/facet/index/params/CategoryListParams.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/facet/src/java/org/apache/lucene/facet/index/params/CategoryListParams.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/facet/src/java/org/apache/lucene/facet/index/params/CategoryListParams.java (original)
+++ lucene/dev/branches/lucene4547/lucene/facet/src/java/org/apache/lucene/facet/index/params/CategoryListParams.java Sun Jan 27 20:01:52 2013
@@ -1,7 +1,6 @@
 package org.apache.lucene.facet.index.params;
 
 import java.io.IOException;
-import java.io.Serializable;
 
 import org.apache.lucene.facet.search.CategoryListIterator;
 import org.apache.lucene.facet.search.DocValuesCategoryListIterator;
@@ -34,7 +33,7 @@ import org.apache.lucene.util.encoding.U
  * 
  * @lucene.experimental
  */
-public class CategoryListParams implements Serializable {
+public class CategoryListParams {
 
   /** OrdinalPolicy defines which ordinals are encoded for every document. */
   public static enum OrdinalPolicy {
@@ -143,4 +142,9 @@ public class CategoryListParams implemen
     return DEFAULT_ORDINAL_POLICY;
   }
   
+  @Override
+  public String toString() {
+    return "field=" + field + " encoder=" + createEncoder() + " ordinalPolicy=" + getOrdinalPolicy();
+  }
+  
 }
\ No newline at end of file

Modified: lucene/dev/branches/lucene4547/lucene/facet/src/java/org/apache/lucene/facet/search/DrillDown.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/facet/src/java/org/apache/lucene/facet/search/DrillDown.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/facet/src/java/org/apache/lucene/facet/search/DrillDown.java (original)
+++ lucene/dev/branches/lucene4547/lucene/facet/src/java/org/apache/lucene/facet/search/DrillDown.java Sun Jan 27 20:01:52 2013
@@ -59,18 +59,23 @@ public final class DrillDown {
   }
   
   /**
-   * Wraps a given {@link Query} as a drill-down query over the given
-   * categories, assuming all are required (e.g. {@code AND}). You can construct
-   * a query with different modes (such as {@code OR} or {@code AND} of
-   * {@code ORs}) by creating a {@link BooleanQuery} and call this method
-   * several times. Make sure to wrap the query in that case by
-   * {@link ConstantScoreQuery} and set the boost to 0.0f, so that it doesn't
-   * affect scoring.
+   * Wraps a given {@link Query} by a drill-down query over the given
+   * categories. {@link Occur} defines the relationship between the cateories
+   * (e.g. {@code OR} or {@code AND}. If you need to construct a more
+   * complicated relationship, e.g. {@code AND} of {@code ORs}), call this
+   * method with every group of categories with the same relationship and then
+   * construct a {@link BooleanQuery} which will wrap all returned queries. It
+   * is advised to construct that boolean query with coord disabled, and also
+   * wrap the final query with {@link ConstantScoreQuery} and set its boost to
+   * {@code 0.0f}.
+   * <p>
+   * <b>NOTE:</b> {@link Occur} only makes sense when there is more than one
+   * {@link CategoryPath} given.
    * <p>
    * <b>NOTE:</b> {@code baseQuery} can be {@code null}, in which case only the
    * {@link Query} over the categories will is returned.
    */
-  public static final Query query(FacetIndexingParams iParams, Query baseQuery, CategoryPath... paths) {
+  public static final Query query(FacetIndexingParams iParams, Query baseQuery, Occur occur, CategoryPath... paths) {
     if (paths == null || paths.length == 0) {
       throw new IllegalArgumentException("Empty category path not allowed for drill down query!");
     }
@@ -81,7 +86,7 @@ public final class DrillDown {
     } else {
       BooleanQuery bq = new BooleanQuery(true); // disable coord
       for (CategoryPath cp : paths) {
-        bq.add(new TermQuery(term(iParams, cp)), Occur.MUST);
+        bq.add(new TermQuery(term(iParams, cp)), occur);
       }
       q = bq;
     }
@@ -100,10 +105,10 @@ public final class DrillDown {
   }
 
   /**
-   * @see #query(FacetIndexingParams, Query, CategoryPath...)
+   * @see #query
    */
-  public static final Query query(FacetSearchParams sParams, Query baseQuery, CategoryPath... paths) {
-    return query(sParams.indexingParams, baseQuery, paths);
+  public static final Query query(FacetSearchParams sParams, Query baseQuery, Occur occur, CategoryPath... paths) {
+    return query(sParams.indexingParams, baseQuery, occur, paths);
   }
 
 }

Modified: lucene/dev/branches/lucene4547/lucene/facet/src/java/org/apache/lucene/facet/util/PrintTaxonomyStats.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/facet/src/java/org/apache/lucene/facet/util/PrintTaxonomyStats.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/facet/src/java/org/apache/lucene/facet/util/PrintTaxonomyStats.java (original)
+++ lucene/dev/branches/lucene4547/lucene/facet/src/java/org/apache/lucene/facet/util/PrintTaxonomyStats.java Sun Jan 27 20:01:52 2013
@@ -30,6 +30,7 @@ import org.apache.lucene.store.FSDirecto
 
 /** Prints how many ords are under each dimension. */
 
+// java -cp ../build/core/classes/java:../build/facet/classes/java org.apache.lucene.facet.util.PrintTaxonomyStats -printTree /s2/scratch/indices/wikibig.trunk.noparents.facets.Lucene41.nd1M/facets
 public class PrintTaxonomyStats {
 
   public static void main(String[] args) throws IOException {

Modified: lucene/dev/branches/lucene4547/lucene/facet/src/java/org/apache/lucene/util/encoding/FourFlagsIntDecoder.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/facet/src/java/org/apache/lucene/util/encoding/FourFlagsIntDecoder.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/facet/src/java/org/apache/lucene/util/encoding/FourFlagsIntDecoder.java (original)
+++ lucene/dev/branches/lucene4547/lucene/facet/src/java/org/apache/lucene/util/encoding/FourFlagsIntDecoder.java Sun Jan 27 20:01:52 2013
@@ -86,7 +86,7 @@ public class FourFlagsIntDecoder extends
 
   @Override
   public String toString() {
-    return "FourFlags(VInt8)";
+    return "FourFlags(VInt)";
   }
 
 }

Modified: lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/FacetTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/FacetTestBase.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/FacetTestBase.java (original)
+++ lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/FacetTestBase.java Sun Jan 27 20:01:52 2013
@@ -42,7 +42,6 @@ import org.apache.lucene.search.IndexSea
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.IOUtils;
-import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
 import org.apache.lucene.util._TestUtil;
 import org.junit.AfterClass;
@@ -66,7 +65,7 @@ import org.junit.BeforeClass;
  */
 
 @SuppressCodecs({"SimpleText"})
-public abstract class FacetTestBase extends LuceneTestCase {
+public abstract class FacetTestBase extends FacetTestCase {
   
   /** Holds a search and taxonomy Directories pair. */
   private static final class SearchTaxoDirPair {
@@ -92,7 +91,7 @@ public abstract class FacetTestBase exte
   @BeforeClass
   public static void beforeClassFacetTestBase() {
     TEST_DIR = _TestUtil.getTempDir("facets");
-    dirsPerPartitionSize = new HashMap<Integer, FacetTestBase.SearchTaxoDirPair>(); 
+    dirsPerPartitionSize = new HashMap<Integer, FacetTestBase.SearchTaxoDirPair>();
   }
   
   @AfterClass
@@ -181,8 +180,10 @@ public abstract class FacetTestBase exte
     return newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer);
   }
 
-  /** Returns a default facet indexing params */
+  /** Returns a {@link FacetIndexingParams} per the given partition size. */
   protected FacetIndexingParams getFacetIndexingParams(final int partSize) {
+    // several of our encoders don't support the value 0, 
+    // which is one of the values encoded when dealing w/ partitions.
     return new FacetIndexingParams() {
       @Override
       public int getPartitionSize() {

Modified: lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/FacetTestUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/FacetTestUtils.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/FacetTestUtils.java (original)
+++ lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/FacetTestUtils.java Sun Jan 27 20:01:52 2013
@@ -1,30 +1,17 @@
 package org.apache.lucene.facet;
 
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
 
 import org.apache.lucene.analysis.MockAnalyzer;
-import org.apache.lucene.facet.index.params.FacetIndexingParams;
-import org.apache.lucene.facet.search.FacetsCollector;
-import org.apache.lucene.facet.search.params.CountFacetRequest;
-import org.apache.lucene.facet.search.params.FacetRequest;
-import org.apache.lucene.facet.search.params.FacetSearchParams;
 import org.apache.lucene.facet.search.results.FacetResult;
 import org.apache.lucene.facet.search.results.FacetResultNode;
-import org.apache.lucene.facet.taxonomy.CategoryPath;
-import org.apache.lucene.facet.taxonomy.TaxonomyReader;
 import org.apache.lucene.facet.taxonomy.TaxonomyWriter;
 import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader;
 import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter;
 import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.IndexWriterConfig;
-import org.apache.lucene.search.Collector;
 import org.apache.lucene.search.IndexSearcher;
-import org.apache.lucene.search.MatchAllDocsQuery;
-import org.apache.lucene.search.MultiCollector;
-import org.apache.lucene.search.TopScoreDocCollector;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.LuceneTestCase;
 
@@ -109,30 +96,6 @@ public class FacetTestUtils {
     return pairs;
   }
 
-  public static Collector[] search(IndexSearcher searcher, TaxonomyReader taxonomyReader, FacetIndexingParams iParams, 
-      int k, String... facetNames) throws IOException {
-    
-    Collector[] collectors = new Collector[2];
-    
-    List<FacetRequest> fRequests = new ArrayList<FacetRequest>();
-    for (String facetName : facetNames) {
-      CategoryPath cp = new CategoryPath(facetName);
-      FacetRequest fq = new CountFacetRequest(cp, k);
-      fRequests.add(fq);
-    }
-    FacetSearchParams facetSearchParams = new FacetSearchParams(fRequests, iParams);
-
-    TopScoreDocCollector topDocsCollector = TopScoreDocCollector.create(searcher.getIndexReader().maxDoc(), true);
-    FacetsCollector facetsCollector = FacetsCollector.create(facetSearchParams, searcher.getIndexReader(), taxonomyReader);
-    Collector mColl = MultiCollector.wrap(topDocsCollector, facetsCollector);
-    
-    collectors[0] = topDocsCollector;
-    collectors[1] = facetsCollector;
-
-    searcher.search(new MatchAllDocsQuery(), mColl);
-    return collectors;
-  }
-
   public static String toSimpleString(FacetResult fr) {
     StringBuilder sb = new StringBuilder();
     toSimpleString(0, sb, fr.getFacetResultNode(), "");

Modified: lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/index/OrdinalMappingReaderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/index/OrdinalMappingReaderTest.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/index/OrdinalMappingReaderTest.java (original)
+++ lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/index/OrdinalMappingReaderTest.java Sun Jan 27 20:01:52 2013
@@ -7,16 +7,9 @@ import java.util.List;
 import org.apache.lucene.analysis.MockAnalyzer;
 import org.apache.lucene.analysis.MockTokenizer;
 import org.apache.lucene.document.Document;
-import org.apache.lucene.index.DirectoryReader;
-import org.apache.lucene.index.IndexWriterConfig;
-import org.apache.lucene.index.RandomIndexWriter;
-import org.apache.lucene.search.IndexSearcher;
-import org.apache.lucene.search.MatchAllDocsQuery;
-import org.apache.lucene.store.Directory;
-import org.junit.Test;
-
-import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.facet.FacetTestCase;
 import org.apache.lucene.facet.example.merge.TaxonomyMergeUtils;
+import org.apache.lucene.facet.index.params.FacetIndexingParams;
 import org.apache.lucene.facet.search.FacetsCollector;
 import org.apache.lucene.facet.search.params.CountFacetRequest;
 import org.apache.lucene.facet.search.params.FacetSearchParams;
@@ -25,6 +18,13 @@ import org.apache.lucene.facet.search.re
 import org.apache.lucene.facet.taxonomy.CategoryPath;
 import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader;
 import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter;
+import org.apache.lucene.index.DirectoryReader;
+import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.index.RandomIndexWriter;
+import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.MatchAllDocsQuery;
+import org.apache.lucene.store.Directory;
+import org.junit.Test;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -43,34 +43,35 @@ import org.apache.lucene.facet.taxonomy.
  * limitations under the License.
  */
 
-public class OrdinalMappingReaderTest extends LuceneTestCase {
+public class OrdinalMappingReaderTest extends FacetTestCase {
   
   private static final int NUM_DOCS = 100;
   
   @Test
   public void testTaxonomyMergeUtils() throws Exception {
     Directory dir = newDirectory();
-    Directory taxDir = newDirectory();    
-    buildIndexWithFacets(dir, taxDir, true);
+    Directory taxDir = newDirectory();
+    FacetIndexingParams fip = new FacetIndexingParams(randomCategoryListParams());
+    buildIndexWithFacets(dir, taxDir, true, fip);
     
     Directory dir1 = newDirectory();
     Directory taxDir1 = newDirectory();
-    buildIndexWithFacets(dir1, taxDir1, false);
+    buildIndexWithFacets(dir1, taxDir1, false, fip);
     
-    TaxonomyMergeUtils.merge(dir, taxDir, dir1, taxDir1);
+    TaxonomyMergeUtils.merge(dir, taxDir, dir1, taxDir1, fip);
     
-    verifyResults(dir1, taxDir1);
+    verifyResults(dir1, taxDir1, fip);
     dir1.close();
     taxDir1.close();
     dir.close();
     taxDir.close();
   }
 
-  private void verifyResults(Directory dir, Directory taxDir) throws IOException {
+  private void verifyResults(Directory dir, Directory taxDir, FacetIndexingParams fip) throws IOException {
     DirectoryReader reader1 = DirectoryReader.open(dir);
     DirectoryTaxonomyReader taxReader = new DirectoryTaxonomyReader(taxDir);
     IndexSearcher searcher = newSearcher(reader1);
-    FacetSearchParams fsp = new FacetSearchParams(new CountFacetRequest(new CategoryPath("tag"), NUM_DOCS));
+    FacetSearchParams fsp = new FacetSearchParams(fip, new CountFacetRequest(new CategoryPath("tag"), NUM_DOCS));
     FacetsCollector collector = FacetsCollector.create(fsp, reader1, taxReader);
     searcher.search(new MatchAllDocsQuery(), collector);
     FacetResult result = collector.getFacetResults().get(0);
@@ -88,7 +89,7 @@ public class OrdinalMappingReaderTest ex
     taxReader.close();
   }
 
-  private void buildIndexWithFacets(Directory dir, Directory taxDir, boolean asc) throws IOException {
+  private void buildIndexWithFacets(Directory dir, Directory taxDir, boolean asc, FacetIndexingParams fip) throws IOException {
     IndexWriterConfig config = newIndexWriterConfig(TEST_VERSION_CURRENT, 
         new MockAnalyzer(random(), MockTokenizer.WHITESPACE, false));
     RandomIndexWriter writer = new RandomIndexWriter(random(), dir, config);
@@ -101,7 +102,7 @@ public class OrdinalMappingReaderTest ex
         int facetValue = asc? j: NUM_DOCS - j;
         categoryPaths.add(new CategoryPath("tag", Integer.toString(facetValue)));
       }
-      FacetFields facetFields = new FacetFields(taxonomyWriter);
+      FacetFields facetFields = new FacetFields(taxonomyWriter, fip);
       facetFields.addFields(doc, categoryPaths);
       writer.addDocument(doc);
     }    

Modified: lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/index/TestFacetsPayloadMigrationReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/index/TestFacetsPayloadMigrationReader.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/index/TestFacetsPayloadMigrationReader.java (original)
+++ lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/index/TestFacetsPayloadMigrationReader.java Sun Jan 27 20:01:52 2013
@@ -21,6 +21,7 @@ import org.apache.lucene.document.Field.
 import org.apache.lucene.document.FieldType;
 import org.apache.lucene.document.StringField;
 import org.apache.lucene.document.TextField;
+import org.apache.lucene.facet.FacetTestCase;
 import org.apache.lucene.facet.index.params.CategoryListParams;
 import org.apache.lucene.facet.index.params.FacetIndexingParams;
 import org.apache.lucene.facet.index.params.PerDimensionIndexingParams;
@@ -57,11 +58,11 @@ import org.apache.lucene.search.MultiCol
 import org.apache.lucene.search.PrefixQuery;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.TotalHitCountCollector;
+import org.apache.lucene.search.BooleanClause.Occur;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.IOUtils;
 import org.apache.lucene.util.IntsRef;
-import org.apache.lucene.util.LuceneTestCase;
 import org.junit.Test;
 
 /*
@@ -82,7 +83,7 @@ import org.junit.Test;
  */
 
 /** Tests facets index migration from payload to DocValues.*/
-public class TestFacetsPayloadMigrationReader extends LuceneTestCase {
+public class TestFacetsPayloadMigrationReader extends FacetTestCase {
   
   private static class PayloadFacetFields extends FacetFields {
 
@@ -284,7 +285,7 @@ public class TestFacetsPayloadMigrationR
     for (String dim : expectedCounts.keySet()) {
       CategoryPath drillDownCP = new CategoryPath(dim);
       FacetSearchParams fsp = new FacetSearchParams(fip, new CountFacetRequest(drillDownCP, 10));
-      Query drillDown = DrillDown.query(fsp, new MatchAllDocsQuery(), drillDownCP);
+      Query drillDown = DrillDown.query(fsp, new MatchAllDocsQuery(), Occur.MUST, drillDownCP);
       TotalHitCountCollector total = new TotalHitCountCollector();
       FacetsCollector fc = FacetsCollector.create(fsp, indexReader, taxoReader);
       searcher.search(drillDown, MultiCollector.wrap(fc, total));

Modified: lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/index/params/CategoryListParamsTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/index/params/CategoryListParamsTest.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/index/params/CategoryListParamsTest.java (original)
+++ lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/index/params/CategoryListParamsTest.java Sun Jan 27 20:01:52 2013
@@ -1,6 +1,6 @@
 package org.apache.lucene.facet.index.params;
 
-import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.facet.FacetTestCase;
 import org.apache.lucene.util.encoding.DGapVInt8IntEncoder;
 import org.apache.lucene.util.encoding.IntDecoder;
 import org.apache.lucene.util.encoding.IntEncoder;
@@ -25,7 +25,7 @@ import org.junit.Test;
  * limitations under the License.
  */
 
-public class CategoryListParamsTest extends LuceneTestCase {
+public class CategoryListParamsTest extends FacetTestCase {
 
   @Test
   public void testDefaultSettings() {

Modified: lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/index/params/FacetIndexingParamsTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/index/params/FacetIndexingParamsTest.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/index/params/FacetIndexingParamsTest.java (original)
+++ lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/index/params/FacetIndexingParamsTest.java Sun Jan 27 20:01:52 2013
@@ -1,10 +1,10 @@
 package org.apache.lucene.facet.index.params;
 
+import org.apache.lucene.facet.FacetTestCase;
 import org.apache.lucene.facet.search.DrillDown;
 import org.apache.lucene.facet.taxonomy.CategoryPath;
 import org.apache.lucene.facet.util.PartitionsUtils;
 import org.apache.lucene.index.Term;
-import org.apache.lucene.util.LuceneTestCase;
 import org.junit.Test;
 
 /*
@@ -24,7 +24,7 @@ import org.junit.Test;
  * limitations under the License.
  */
 
-public class FacetIndexingParamsTest extends LuceneTestCase {
+public class FacetIndexingParamsTest extends FacetTestCase {
 
   @Test
   public void testDefaultSettings() {

Modified: lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/index/params/PerDimensionIndexingParamsTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/index/params/PerDimensionIndexingParamsTest.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/index/params/PerDimensionIndexingParamsTest.java (original)
+++ lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/index/params/PerDimensionIndexingParamsTest.java Sun Jan 27 20:01:52 2013
@@ -2,11 +2,11 @@ package org.apache.lucene.facet.index.pa
 
 import java.util.Collections;
 
+import org.apache.lucene.facet.FacetTestCase;
 import org.apache.lucene.facet.search.DrillDown;
 import org.apache.lucene.facet.taxonomy.CategoryPath;
 import org.apache.lucene.facet.util.PartitionsUtils;
 import org.apache.lucene.index.Term;
-import org.apache.lucene.util.LuceneTestCase;
 import org.junit.Test;
 
 /*
@@ -26,7 +26,7 @@ import org.junit.Test;
  * limitations under the License.
  */
 
-public class PerDimensionIndexingParamsTest extends LuceneTestCase {
+public class PerDimensionIndexingParamsTest extends FacetTestCase {
 
   @Test
   public void testTopLevelSettings() {
@@ -41,7 +41,6 @@ public class PerDimensionIndexingParamsT
     assertEquals("3 characters should be written", 3, numchars);
     assertEquals("wrong drill-down term text", expectedDDText, new String(buf, 0, numchars));
     
-    CategoryListParams clParams = ifip.getCategoryListParams(null);
     assertEquals("partition for all ordinals is the first", "", PartitionsUtils.partitionNameByOrdinal(ifip, 250));
     assertEquals("for partition 0, the same name should be returned", "", PartitionsUtils.partitionName(0));
     assertEquals("for any other, it's the concatenation of name + partition", PartitionsUtils.PART_NAME_PREFIX + "1", PartitionsUtils.partitionName(1));

Modified: lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/CategoryListIteratorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/CategoryListIteratorTest.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/CategoryListIteratorTest.java (original)
+++ lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/CategoryListIteratorTest.java Sun Jan 27 20:01:52 2013
@@ -7,13 +7,13 @@ import org.apache.lucene.analysis.MockAn
 import org.apache.lucene.analysis.MockTokenizer;
 import org.apache.lucene.document.BinaryDocValuesField;
 import org.apache.lucene.document.Document;
+import org.apache.lucene.facet.FacetTestCase;
 import org.apache.lucene.index.AtomicReaderContext;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.RandomIndexWriter;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.IntsRef;
-import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.encoding.DGapIntEncoder;
 import org.apache.lucene.util.encoding.IntEncoder;
 import org.apache.lucene.util.encoding.SortingIntEncoder;
@@ -38,7 +38,7 @@ import org.junit.Test;
  * limitations under the License.
  */
 
-public class CategoryListIteratorTest extends LuceneTestCase {
+public class CategoryListIteratorTest extends FacetTestCase {
 
   static final IntsRef[] data = new IntsRef[] {
     new IntsRef(new int[] { 1, 2 }, 0, 2), 
@@ -48,9 +48,9 @@ public class CategoryListIteratorTest ex
   };
 
   @Test
-  public void testPayloadCategoryListIteraor() throws Exception {
+  public void test() throws Exception {
     Directory dir = newDirectory();
-    final IntEncoder encoder = new SortingIntEncoder(new UniqueValuesIntEncoder(new DGapIntEncoder(new VInt8IntEncoder())));
+    final IntEncoder encoder = randomCategoryListParams().createEncoder();
     RandomIndexWriter writer = new RandomIndexWriter(random(), dir, newIndexWriterConfig(TEST_VERSION_CURRENT, 
         new MockAnalyzer(random(), MockTokenizer.KEYWORD, false)).setMergePolicy(newLogMergePolicy()));
     BytesRef buf = new BytesRef();
@@ -89,7 +89,7 @@ public class CategoryListIteratorTest ex
   }
 
   @Test
-  public void testPayloadIteratorWithInvalidDoc() throws Exception {
+  public void testEmptyDocuments() throws Exception {
     Directory dir = newDirectory();
     final IntEncoder encoder = new SortingIntEncoder(new UniqueValuesIntEncoder(new DGapIntEncoder(new VInt8IntEncoder())));
     // NOTE: test is wired to LogMP... because test relies on certain docids having payloads

Modified: lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/CountingFacetsCollectorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/CountingFacetsCollectorTest.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/CountingFacetsCollectorTest.java (original)
+++ lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/CountingFacetsCollectorTest.java Sun Jan 27 20:01:52 2013
@@ -13,6 +13,7 @@ import org.apache.lucene.analysis.MockAn
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field.Store;
 import org.apache.lucene.document.StringField;
+import org.apache.lucene.facet.FacetTestCase;
 import org.apache.lucene.facet.index.FacetFields;
 import org.apache.lucene.facet.index.params.CategoryListParams;
 import org.apache.lucene.facet.index.params.FacetIndexingParams;
@@ -40,7 +41,6 @@ import org.apache.lucene.search.MatchAll
 import org.apache.lucene.search.TermQuery;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.IOUtils;
-import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.collections.ObjectToIntMap;
 import org.apache.lucene.util.encoding.IntEncoder;
 import org.apache.lucene.util.encoding.VInt8IntEncoder;
@@ -65,7 +65,7 @@ import org.junit.Test;
  * limitations under the License.
  */
 
-public class CountingFacetsCollectorTest extends LuceneTestCase {
+public class CountingFacetsCollectorTest extends FacetTestCase {
   
   private static final Term A = new Term("f", "a");
   private static final CategoryPath CP_A = new CategoryPath("A"), CP_B = new CategoryPath("B");

Modified: lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/DrillDownTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/DrillDownTest.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/DrillDownTest.java (original)
+++ lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/DrillDownTest.java Sun Jan 27 20:01:52 2013
@@ -10,6 +10,7 @@ import org.apache.lucene.analysis.MockTo
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.TextField;
+import org.apache.lucene.facet.FacetTestCase;
 import org.apache.lucene.facet.index.FacetFields;
 import org.apache.lucene.facet.index.params.CategoryListParams;
 import org.apache.lucene.facet.index.params.FacetIndexingParams;
@@ -26,8 +27,8 @@ import org.apache.lucene.search.Query;
 import org.apache.lucene.search.ScoreDoc;
 import org.apache.lucene.search.TermQuery;
 import org.apache.lucene.search.TopDocs;
+import org.apache.lucene.search.BooleanClause.Occur;
 import org.apache.lucene.store.Directory;
-import org.apache.lucene.util.LuceneTestCase;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -49,9 +50,9 @@ import org.junit.Test;
  * limitations under the License.
  */
 
-public class DrillDownTest extends LuceneTestCase {
+public class DrillDownTest extends FacetTestCase {
   
-  private FacetIndexingParams defaultParams = FacetIndexingParams.ALL_PARENTS;
+  private FacetIndexingParams defaultParams;
   private PerDimensionIndexingParams nonDefaultParams;
   private static IndexReader reader;
   private static DirectoryTaxonomyReader taxo;
@@ -60,9 +61,10 @@ public class DrillDownTest extends Lucen
   
   public DrillDownTest() {
     Map<CategoryPath,CategoryListParams> paramsMap = new HashMap<CategoryPath,CategoryListParams>();
-    paramsMap.put(new CategoryPath("a"), new CategoryListParams("testing_facets_a"));
-    paramsMap.put(new CategoryPath("b"), new CategoryListParams("testing_facets_b"));
+    paramsMap.put(new CategoryPath("a"), randomCategoryListParams("testing_facets_a"));
+    paramsMap.put(new CategoryPath("b"), randomCategoryListParams("testing_facets_b"));
     nonDefaultParams = new PerDimensionIndexingParams(paramsMap);
+    defaultParams = new FacetIndexingParams(randomCategoryListParams(CategoryListParams.DEFAULT_FIELD));
   }
 
   @BeforeClass
@@ -128,25 +130,25 @@ public class DrillDownTest extends Lucen
     IndexSearcher searcher = newSearcher(reader);
 
     // Making sure the query yields 25 documents with the facet "a"
-    Query q = DrillDown.query(defaultParams, null, new CategoryPath("a"));
+    Query q = DrillDown.query(defaultParams, null, Occur.MUST, new CategoryPath("a"));
     TopDocs docs = searcher.search(q, 100);
     assertEquals(25, docs.totalHits);
     
     // Making sure the query yields 5 documents with the facet "b" and the
     // previous (facet "a") query as a base query
-    Query q2 = DrillDown.query(defaultParams, q, new CategoryPath("b"));
+    Query q2 = DrillDown.query(defaultParams, q, Occur.MUST, new CategoryPath("b"));
     docs = searcher.search(q2, 100);
     assertEquals(5, docs.totalHits);
 
     // Making sure that a query of both facet "a" and facet "b" yields 5 results
-    Query q3 = DrillDown.query(defaultParams, null, new CategoryPath("a"), new CategoryPath("b"));
+    Query q3 = DrillDown.query(defaultParams, null, Occur.MUST, new CategoryPath("a"), new CategoryPath("b"));
     docs = searcher.search(q3, 100);
     assertEquals(5, docs.totalHits);
     
     // Check that content:foo (which yields 50% results) and facet/b (which yields 20%)
     // would gather together 10 results (10%..) 
     Query fooQuery = new TermQuery(new Term("content", "foo"));
-    Query q4 = DrillDown.query(defaultParams, fooQuery, new CategoryPath("b"));
+    Query q4 = DrillDown.query(defaultParams, fooQuery, Occur.MUST, new CategoryPath("b"));
     docs = searcher.search(q4, 100);
     assertEquals(10, docs.totalHits);
   }
@@ -156,18 +158,18 @@ public class DrillDownTest extends Lucen
     IndexSearcher searcher = newSearcher(reader);
 
     // Create the base query to start with
-    Query q = DrillDown.query(defaultParams, null, new CategoryPath("a"));
+    Query q = DrillDown.query(defaultParams, null, Occur.MUST, new CategoryPath("a"));
     
     // Making sure the query yields 5 documents with the facet "b" and the
     // previous (facet "a") query as a base query
-    Query q2 = DrillDown.query(defaultParams, q, new CategoryPath("b"));
+    Query q2 = DrillDown.query(defaultParams, q, Occur.MUST, new CategoryPath("b"));
     TopDocs docs = searcher.search(q2, 100);
     assertEquals(5, docs.totalHits);
 
     // Check that content:foo (which yields 50% results) and facet/b (which yields 20%)
     // would gather together 10 results (10%..) 
     Query fooQuery = new TermQuery(new Term("content", "foo"));
-    Query q4 = DrillDown.query(defaultParams, fooQuery, new CategoryPath("b"));
+    Query q4 = DrillDown.query(defaultParams, fooQuery, Occur.MUST, new CategoryPath("b"));
     docs = searcher.search(q4, 100);
     assertEquals(10, docs.totalHits);
   }
@@ -202,7 +204,7 @@ public class DrillDownTest extends Lucen
     }
     
     // create a drill-down query with category "a", scores should not change
-    q = DrillDown.query(defaultParams, q, new CategoryPath("a"));
+    q = DrillDown.query(defaultParams, q, Occur.MUST, new CategoryPath("a"));
     docs = searcher.search(q, reader.maxDoc()); // fetch all available docs to this query
     for (ScoreDoc sd : docs.scoreDocs) {
       assertEquals("score of doc=" + sd.doc + " modified", scores[sd.doc], sd.score, 0f);
@@ -214,11 +216,21 @@ public class DrillDownTest extends Lucen
     // verify that drill-down queries (with no base query) returns 0.0 score
     IndexSearcher searcher = newSearcher(reader);
     
-    Query q = DrillDown.query(defaultParams, null, new CategoryPath("a"));
+    Query q = DrillDown.query(defaultParams, null, Occur.MUST, new CategoryPath("a"));
     TopDocs docs = searcher.search(q, reader.maxDoc()); // fetch all available docs to this query
     for (ScoreDoc sd : docs.scoreDocs) {
       assertEquals(0f, sd.score, 0f);
     }
   }
+  
+  @Test
+  public void testOrQuery() throws Exception {
+    IndexSearcher searcher = newSearcher(reader);
+
+    // Making sure that a query of facet "a" or facet "b" yields 0 results
+    Query q = DrillDown.query(defaultParams, null, Occur.SHOULD, new CategoryPath("a"), new CategoryPath("b"));
+    TopDocs docs = searcher.search(q, 100);
+    assertEquals(40, docs.totalHits);
+  }
     
 }

Modified: lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/TestDemoFacets.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/TestDemoFacets.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/TestDemoFacets.java (original)
+++ lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/TestDemoFacets.java Sun Jan 27 20:01:52 2013
@@ -24,6 +24,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.lucene.document.Document;
+import org.apache.lucene.facet.FacetTestCase;
 import org.apache.lucene.facet.FacetTestUtils;
 import org.apache.lucene.facet.index.FacetFields;
 import org.apache.lucene.facet.search.params.CountFacetRequest;
@@ -39,14 +40,14 @@ import org.apache.lucene.index.RandomInd
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.MatchAllDocsQuery;
 import org.apache.lucene.search.Query;
+import org.apache.lucene.search.BooleanClause.Occur;
 import org.apache.lucene.store.Directory;
-import org.apache.lucene.util.LuceneTestCase;
 
-public class TestDemoFacets extends LuceneTestCase {
+public class TestDemoFacets extends FacetTestCase {
 
   private DirectoryTaxonomyWriter taxoWriter;
   private RandomIndexWriter writer;
-  private FacetFields docBuilder;
+  private FacetFields facetFields;
 
   private void add(String ... categoryPaths) throws IOException {
     Document doc = new Document();
@@ -55,7 +56,7 @@ public class TestDemoFacets extends Luce
     for(String categoryPath : categoryPaths) {
       paths.add(new CategoryPath(categoryPath, '/'));
     }
-    docBuilder.addFields(doc, paths);
+    facetFields.addFields(doc, paths);
     writer.addDocument(doc);
   }
 
@@ -70,7 +71,7 @@ public class TestDemoFacets extends Luce
 
     // Reused across documents, to add the necessary facet
     // fields:
-    docBuilder = new FacetFields(taxoWriter);
+    facetFields = new FacetFields(taxoWriter);
 
     add("Author/Bob", "Publish Date/2010/10/15");
     add("Author/Lisa", "Publish Date/2010/10/20");
@@ -111,7 +112,7 @@ public class TestDemoFacets extends Luce
     
     // Now user drills down on Publish Date/2010:
     fsp = new FacetSearchParams(new CountFacetRequest(new CategoryPath("Author"), 10));
-    Query q2 = DrillDown.query(fsp, new MatchAllDocsQuery(), new CategoryPath("Publish Date/2010", '/'));
+    Query q2 = DrillDown.query(fsp, new MatchAllDocsQuery(), Occur.MUST, new CategoryPath("Publish Date/2010", '/'));
     c = FacetsCollector.create(fsp, searcher.getIndexReader(), taxoReader);
     searcher.search(q2, c);
     results = c.getFacetResults();

Modified: lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/TestFacetArrays.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/TestFacetArrays.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/TestFacetArrays.java (original)
+++ lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/TestFacetArrays.java Sun Jan 27 20:01:52 2013
@@ -1,6 +1,6 @@
 package org.apache.lucene.facet.search;
 
-import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.facet.FacetTestCase;
 import org.junit.Test;
 
 /*
@@ -20,7 +20,7 @@ import org.junit.Test;
  * limitations under the License.
  */
 
-public class TestFacetArrays extends LuceneTestCase {
+public class TestFacetArrays extends FacetTestCase {
 
   @Test
   public void testFacetArrays() {

Modified: lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/TestFacetsAccumulatorWithComplement.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/TestFacetsAccumulatorWithComplement.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/TestFacetsAccumulatorWithComplement.java (original)
+++ lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/TestFacetsAccumulatorWithComplement.java Sun Jan 27 20:01:52 2013
@@ -123,15 +123,10 @@ public class TestFacetsAccumulatorWithCo
     
   }
   
-  private FacetSearchParams getFacetSearchParams() {
-    return new FacetSearchParams(new CountFacetRequest(new CategoryPath("root","a"), 10));
-  }
-  
   /** compute facets with certain facet requests and docs */
   private List<FacetResult> findFacets(ScoredDocIDs sDocids, boolean withComplement) throws IOException {
-    
-    FacetsAccumulator fAccumulator = 
-      new StandardFacetsAccumulator(getFacetSearchParams(), indexReader, taxoReader);
+    FacetSearchParams fsp = new FacetSearchParams(getFacetIndexingParams(Integer.MAX_VALUE), new CountFacetRequest(new CategoryPath("root","a"), 10));
+    FacetsAccumulator fAccumulator = new StandardFacetsAccumulator(fsp, indexReader, taxoReader);
     
     fAccumulator.setComplementThreshold(
         withComplement ? 

Modified: lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/TestFacetsCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/TestFacetsCollector.java?rev=1439164&r1=1439163&r2=1439164&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/TestFacetsCollector.java (original)
+++ lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/search/TestFacetsCollector.java Sun Jan 27 20:01:52 2013
@@ -7,6 +7,7 @@ import org.apache.lucene.analysis.MockAn
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field.Store;
 import org.apache.lucene.document.StringField;
+import org.apache.lucene.facet.FacetTestCase;
 import org.apache.lucene.facet.index.FacetFields;
 import org.apache.lucene.facet.search.params.FacetSearchParams;
 import org.apache.lucene.facet.search.params.ScoreFacetRequest;
@@ -24,7 +25,6 @@ import org.apache.lucene.search.MultiCol
 import org.apache.lucene.search.TopScoreDocCollector;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.IOUtils;
-import org.apache.lucene.util.LuceneTestCase;
 import org.junit.Test;
 
 /*
@@ -44,7 +44,7 @@ import org.junit.Test;
  * limitations under the License.
  */
 
-public class TestFacetsCollector extends LuceneTestCase {
+public class TestFacetsCollector extends FacetTestCase {
 
   @Test
   public void testFacetsWithDocScore() throws Exception {