You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2013/11/02 19:36:52 UTC

svn commit: r1538245 - in /lucene/dev/trunk/lucene: ./ facet/src/java/org/apache/lucene/facet/codecs/ facet/src/resources/ facet/src/test/org/apache/lucene/facet/ facet/src/test/org/apache/lucene/facet/search/

Author: shaie
Date: Sat Nov  2 18:36:52 2013
New Revision: 1538245

URL: http://svn.apache.org/r1538245
Log:
LUCENE-5321: remove Facet42DocValuesFormat and FacetCodec

Removed:
    lucene/dev/trunk/lucene/facet/src/java/org/apache/lucene/facet/codecs/
    lucene/dev/trunk/lucene/facet/src/resources/
Modified:
    lucene/dev/trunk/lucene/CHANGES.txt
    lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/FacetTestCase.java
    lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/search/TestDemoFacets.java
    lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/search/TestDrillSideways.java

Modified: lucene/dev/trunk/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/CHANGES.txt?rev=1538245&r1=1538244&r2=1538245&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/CHANGES.txt (original)
+++ lucene/dev/trunk/lucene/CHANGES.txt Sat Nov  2 18:36:52 2013
@@ -205,6 +205,9 @@ API Changes:
 * LUCENE-5313: Move preservePositionIncrements from setter to ctor in
   Analyzing/FuzzySuggester.  (Areek Zillur via Mike McCandless)
 
+* LUCENE-5321: Remove Facet42DocValuesFormat. Use DirectDocValuesFormat if you
+  want to load the category list into memory. (Shai Erera, Mike McCandless)
+
 Optimizations
 
 * LUCENE-5225: The ToParentBlockJoinQuery only keeps tracks of the the child

Modified: lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/FacetTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/FacetTestCase.java?rev=1538245&r1=1538244&r2=1538245&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/FacetTestCase.java (original)
+++ lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/FacetTestCase.java Sat Nov  2 18:36:52 2013
@@ -2,8 +2,6 @@ package org.apache.lucene.facet;
 
 import java.util.Random;
 
-import org.apache.lucene.codecs.Codec;
-import org.apache.lucene.facet.codecs.facet46.Facet46Codec;
 import org.apache.lucene.facet.encoding.DGapIntEncoder;
 import org.apache.lucene.facet.encoding.DGapVInt8IntEncoder;
 import org.apache.lucene.facet.encoding.EightFlagsIntEncoder;
@@ -15,8 +13,6 @@ import org.apache.lucene.facet.encoding.
 import org.apache.lucene.facet.encoding.VInt8IntEncoder;
 import org.apache.lucene.facet.params.CategoryListParams;
 import org.apache.lucene.util.LuceneTestCase;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -47,24 +43,6 @@ public abstract class FacetTestCase exte
     new SortingIntEncoder(new UniqueValuesIntEncoder(new DGapIntEncoder(new NOnesIntEncoder(4)))), 
   };
   
-  private static Codec savedDefault = null; 
-  
-  @BeforeClass
-  public static void beforeClassFacetTestCase() throws Exception {
-    if (random().nextDouble() < 0.3) {
-      savedDefault = Codec.getDefault(); // save to restore later
-      Codec.setDefault(new Facet46Codec());
-    }
-  }
-  
-  @AfterClass
-  public static void afterClassFacetTestCase() throws Exception {
-    if (savedDefault != null) {
-      Codec.setDefault(savedDefault);
-      savedDefault = null;
-    }
-  }
-  
   /** Returns a {@link CategoryListParams} with random {@link IntEncoder} and field. */
   public static CategoryListParams randomCategoryListParams() {
     final String field = CategoryListParams.DEFAULT_FIELD + "$" + random().nextInt();

Modified: lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/search/TestDemoFacets.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/search/TestDemoFacets.java?rev=1538245&r1=1538244&r2=1538245&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/search/TestDemoFacets.java (original)
+++ lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/search/TestDemoFacets.java Sat Nov  2 18:36:52 2013
@@ -31,7 +31,6 @@ import org.apache.lucene.document.Docume
 import org.apache.lucene.document.Field;
 import org.apache.lucene.facet.FacetTestCase;
 import org.apache.lucene.facet.FacetTestUtils;
-import org.apache.lucene.facet.codecs.facet46.Facet46Codec;
 import org.apache.lucene.facet.index.FacetFields;
 import org.apache.lucene.facet.params.CategoryListParams;
 import org.apache.lucene.facet.params.FacetIndexingParams;
@@ -257,39 +256,39 @@ public class TestDemoFacets extends Face
   // LUCENE-4583: make sure if we require > 32 KB for one
   // document, we don't hit exc when using Facet42DocValuesFormat
   public void testManyFacetsInOneDocument() throws Exception {
+    assumeTrue("default Codec doesn't support huge BinaryDocValues", _TestUtil.fieldSupportsHugeBinaryDocValues(CategoryListParams.DEFAULT_FIELD));
     Directory dir = newDirectory();
     Directory taxoDir = newDirectory();
     IndexWriterConfig iwc = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()));
-    iwc.setCodec(new Facet46Codec());
     RandomIndexWriter writer = new RandomIndexWriter(random(), dir, iwc);
     DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(taxoDir, IndexWriterConfig.OpenMode.CREATE);
-
+    
     FacetFields facetFields = new FacetFields(taxoWriter);
-
+    
     int numLabels = _TestUtil.nextInt(random(), 40000, 100000);
-
+    
     Document doc = new Document();
     doc.add(newTextField("field", "text", Field.Store.NO));
     List<CategoryPath> paths = new ArrayList<CategoryPath>();
-    for(int i=0;i<numLabels;i++) {
+    for (int i = 0; i < numLabels; i++) {
       paths.add(new CategoryPath("dim", "" + i));
     }
     facetFields.addFields(doc, paths);
     writer.addDocument(doc);
-
+    
     // NRT open
     IndexSearcher searcher = newSearcher(writer.getReader());
     writer.close();
-
+    
     // NRT open
     TaxonomyReader taxoReader = new DirectoryTaxonomyReader(taxoWriter);
     taxoWriter.close();
     
     FacetSearchParams fsp = new FacetSearchParams(new CountFacetRequest(new CategoryPath("dim"), Integer.MAX_VALUE));
-
+    
     // Aggregate the facet counts:
     FacetsCollector c = FacetsCollector.create(fsp, searcher.getIndexReader(), taxoReader);
-
+    
     // MatchAllDocsQuery is for "browsing" (counts facets
     // for all non-deleted docs in the index); normally
     // you'd use a "normal" query, and use MultiCollector to
@@ -300,13 +299,13 @@ public class TestDemoFacets extends Face
     FacetResultNode root = results.get(0).getFacetResultNode();
     assertEquals(numLabels, root.subResults.size());
     Set<String> allLabels = new HashSet<String>();
-    for(FacetResultNode childNode : root.subResults) {
+    for (FacetResultNode childNode : root.subResults) {
       assertEquals(2, childNode.label.length);
       allLabels.add(childNode.label.components[1]);
       assertEquals(1, (int) childNode.value);
     }
     assertEquals(numLabels, allLabels.size());
-
+    
     IOUtils.close(searcher.getIndexReader(), taxoReader, dir, taxoDir);
   }
 }

Modified: lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/search/TestDrillSideways.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/search/TestDrillSideways.java?rev=1538245&r1=1538244&r2=1538245&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/search/TestDrillSideways.java (original)
+++ lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/search/TestDrillSideways.java Sat Nov  2 18:36:52 2013
@@ -28,15 +28,11 @@ import java.util.Map;
 import java.util.Set;
 
 import org.apache.lucene.analysis.MockAnalyzer;
-import org.apache.lucene.codecs.Codec;
-import org.apache.lucene.codecs.DocValuesFormat;
-import org.apache.lucene.codecs.perfield.PerFieldDocValuesFormat;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.StringField;
 import org.apache.lucene.facet.FacetTestCase;
 import org.apache.lucene.facet.FacetTestUtils;
-import org.apache.lucene.facet.codecs.facet42.Facet42DocValuesFormat;
 import org.apache.lucene.facet.index.FacetFields;
 import org.apache.lucene.facet.params.FacetIndexingParams;
 import org.apache.lucene.facet.params.FacetSearchParams;
@@ -434,16 +430,6 @@ public class TestDrillSideways extends F
 
     boolean canUseDV = defaultCodecSupportsSortedSet();
 
-    // TestRuleSetupAndRestoreClassEnv can sometimes
-    // randomly pick the non-general Facet42DocValuesFormat:
-    DocValuesFormat dvf = Codec.getDefault().docValuesFormat();
-    if (dvf instanceof PerFieldDocValuesFormat) {
-      dvf = ((PerFieldDocValuesFormat) dvf).getDocValuesFormatForField("$facets");
-    }
-    if (dvf instanceof Facet42DocValuesFormat) {
-      canUseDV = false;
-    }
-
     while (aChance == 0.0) {
       aChance = random().nextDouble();
     }