lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r1552197 - in /lucene/dev/branches/lucene5339: ./ lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ lucene/demo/src/test/org/apache/lucene/demo/facet/ luc...
Date Thu, 19 Dec 2013 01:07:45 GMT
Author: mikemccand
Date: Thu Dec 19 01:07:44 2013
New Revision: 1552197

URL: http://svn.apache.org/r1552197
Log:
LUCENE-5339: address remaining nocommits

Removed:
    lucene/dev/branches/lucene5339/TODO
Modified:
    lucene/dev/branches/lucene5339/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/RandomFacetSource.java
    lucene/dev/branches/lucene5339/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/AddDocTask.java
    lucene/dev/branches/lucene5339/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/AddFacetedDocTask.java
    lucene/dev/branches/lucene5339/lucene/demo/src/test/org/apache/lucene/demo/facet/TestRangeFacetsExample.java
    lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/FacetsConfig.java
    lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/FloatTaxonomyFacets.java
    lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/IntTaxonomyFacets.java
    lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/MultiFacets.java
    lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/SortedSetDocValuesFacetCounts.java
    lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/TaxonomyFacetSumFloatAssociations.java
    lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/TaxonomyFacetSumIntAssociations.java
    lucene/dev/branches/lucene5339/lucene/facet/src/test/org/apache/lucene/facet/TestRangeFacetCounts.java
    lucene/dev/branches/lucene5339/lucene/facet/src/test/org/apache/lucene/facet/TestTaxonomyFacetCounts.java

Modified: lucene/dev/branches/lucene5339/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/RandomFacetSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5339/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/RandomFacetSource.java?rev=1552197&r1=1552196&r2=1552197&view=diff
==============================================================================
--- lucene/dev/branches/lucene5339/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/RandomFacetSource.java
(original)
+++ lucene/dev/branches/lucene5339/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/RandomFacetSource.java
Thu Dec 19 01:07:44 2013
@@ -56,7 +56,12 @@ public class RandomFacetSource extends F
     facets.clear();
     int numFacets = 1 + random.nextInt(maxDocFacets); // at least one facet to each doc
     for (int i = 0; i < numFacets; i++) {
-      int depth = 1 + random.nextInt(maxFacetDepth); // depth 0 is not useful
+      int depth;
+      if (maxFacetDepth == 2) {
+        depth = 2;
+      } else {
+        depth = 2 + random.nextInt(maxFacetDepth-2); // depth < 2 is not useful
+      }
 
       String dim = Integer.toString(random.nextInt(maxDims));
       String[] components = new String[depth-1];
@@ -90,6 +95,9 @@ public class RandomFacetSource extends F
     maxDocFacets = config.get("max.doc.facets", 10);
     maxDims = config.get("max.doc.facets.dims", 5);
     maxFacetDepth = config.get("max.facet.depth", 3);
+    if (maxFacetDepth < 2) {
+      throw new IllegalArgumentException("max.facet.depth must be at least 2; got: " + maxFacetDepth);
+    }
     maxValue = maxDocFacets * maxFacetDepth;
   }
 }

Modified: lucene/dev/branches/lucene5339/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/AddDocTask.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5339/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/AddDocTask.java?rev=1552197&r1=1552196&r2=1552197&view=diff
==============================================================================
--- lucene/dev/branches/lucene5339/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/AddDocTask.java
(original)
+++ lucene/dev/branches/lucene5339/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/AddDocTask.java
Thu Dec 19 01:07:44 2013
@@ -23,6 +23,7 @@ import java.util.Locale;
 import org.apache.lucene.benchmark.byTask.PerfRunData;
 import org.apache.lucene.benchmark.byTask.feeds.DocMaker;
 import org.apache.lucene.document.Document;
+import org.apache.lucene.index.IndexDocument;
 
 /**
  * Add a document, optionally of a certain size.
@@ -41,7 +42,7 @@ public class AddDocTask extends PerfTask
    * volatile data passed between setup(), doLogic(), tearDown().
    * the doc is created at setup() and added at doLogic(). 
    */
-  protected Document doc = null;
+  protected IndexDocument doc = null;
 
   @Override
   public void setup() throws Exception {

Modified: lucene/dev/branches/lucene5339/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/AddFacetedDocTask.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5339/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/AddFacetedDocTask.java?rev=1552197&r1=1552196&r2=1552197&view=diff
==============================================================================
--- lucene/dev/branches/lucene5339/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/AddFacetedDocTask.java
(original)
+++ lucene/dev/branches/lucene5339/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/AddFacetedDocTask.java
Thu Dec 19 01:07:44 2013
@@ -50,7 +50,6 @@ import org.apache.lucene.index.StorableF
  */
 public class AddFacetedDocTask extends AddDocTask {
 
-  private final List<FacetField> facets = new ArrayList<FacetField>();
   private FacetsConfig config;
   
   public AddFacetedDocTask(PerfRunData runData) {
@@ -63,11 +62,8 @@ public class AddFacetedDocTask extends A
     if (config == null) {
       boolean withFacets = getRunData().getConfig().get("with.facets", true);
       if (withFacets) {
-        // nocommit is this called once?  are we adding same
-        // facets over and over!?
         FacetSource facetsSource = getRunData().getFacetSource();
         config = new FacetsConfig();
-        facetsSource.getNextFacets(facets);
         facetsSource.configure(config);
       }
     }
@@ -84,19 +80,12 @@ public class AddFacetedDocTask extends A
   @Override
   public int doLogic() throws Exception {
     if (config != null) {
-      // nocommit hokey:
-      Document doc2 = new Document();
+      List<FacetField> facets = new ArrayList<FacetField>();
+      getRunData().getFacetSource().getNextFacets(facets);
       for(FacetField ff : facets) {
-        doc2.add(ff);
+        ((Document) doc).add(ff);
       }
-      IndexDocument doc3 = config.build(getRunData().getTaxonomyWriter(), doc2);
-      for(StorableField field : doc3.storableFields()) {
-        doc.add((Field) field);
-      }
-      for(IndexableField field : doc3.indexableFields()) {
-        doc.add((Field) field);
-      }
-      
+      doc = config.build(getRunData().getTaxonomyWriter(), doc);
     }
     return super.doLogic();
   }

Modified: lucene/dev/branches/lucene5339/lucene/demo/src/test/org/apache/lucene/demo/facet/TestRangeFacetsExample.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5339/lucene/demo/src/test/org/apache/lucene/demo/facet/TestRangeFacetsExample.java?rev=1552197&r1=1552196&r2=1552197&view=diff
==============================================================================
--- lucene/dev/branches/lucene5339/lucene/demo/src/test/org/apache/lucene/demo/facet/TestRangeFacetsExample.java
(original)
+++ lucene/dev/branches/lucene5339/lucene/demo/src/test/org/apache/lucene/demo/facet/TestRangeFacetsExample.java
Thu Dec 19 01:07:44 2013
@@ -33,7 +33,7 @@ public class TestRangeFacetsExample exte
     RangeFacetsExample example = new RangeFacetsExample();
     example.index();
     FacetResult result = example.search();
-    assertEquals("dim=timestamp path=[] value=100 childCount=3\n  Past hour (4)\n  Past six
hours (22)\n  Past day (87)\n", result.toString());
+    assertEquals("dim=timestamp path=[] value=87 childCount=3\n  Past hour (4)\n  Past six
hours (22)\n  Past day (87)\n", result.toString());
     example.close();
   }
 

Modified: lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/FacetsConfig.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/FacetsConfig.java?rev=1552197&r1=1552196&r2=1552197&view=diff
==============================================================================
--- lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/FacetsConfig.java
(original)
+++ lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/FacetsConfig.java
Thu Dec 19 01:07:44 2013
@@ -294,7 +294,7 @@ public class FacetsConfig {
     for(Map.Entry<String,List<FacetField>> ent : byField.entrySet()) {
 
       String indexFieldName = ent.getKey();
-      //System.out.println("  fields=" + ent.getValue());
+      //System.out.println("  indexFieldName=" + indexFieldName + " fields=" + ent.getValue());
 
       IntsRef ordinals = new IntsRef(32);
       for(FacetField facetField : ent.getValue()) {
@@ -312,9 +312,11 @@ public class FacetsConfig {
           ordinals.grow(ordinals.length+1);
         }
         ordinals.ints[ordinals.length++] = ordinal;
+        //System.out.println("ords[" + (ordinals.length-1) + "]=" + ordinal);
         //System.out.println("  add cp=" + cp);
 
         if (ft.multiValued && (ft.hierarchical || ft.requireDimCount)) {
+          //System.out.println("  add parents");
           // Add all parents too:
           int parent = taxoWriter.getParent(ordinal);
           while (parent > 0) {
@@ -373,9 +375,6 @@ public class FacetsConfig {
       String indexFieldName = ent.getKey();
       for(AssociationFacetField field : ent.getValue()) {
         // NOTE: we don't add parents for associations
-        // nocommit is that right?  maybe we are supposed to
-        // add to taxo writer, and just not index the parent
-        // ords?
         checkTaxoWriter(taxoWriter);
         int ordinal = taxoWriter.addCategory(new FacetLabel(field.dim, field.path));
         if (upto + 4 > bytes.length) {

Modified: lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/FloatTaxonomyFacets.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/FloatTaxonomyFacets.java?rev=1552197&r1=1552196&r2=1552197&view=diff
==============================================================================
--- lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/FloatTaxonomyFacets.java
(original)
+++ lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/FloatTaxonomyFacets.java
Thu Dec 19 01:07:44 2013
@@ -20,6 +20,7 @@ package org.apache.lucene.facet;
 import java.io.IOException;
 import java.util.Map;
 
+import org.apache.lucene.facet.FacetsConfig.DimConfig;
 import org.apache.lucene.facet.taxonomy.FacetLabel;
 import org.apache.lucene.facet.taxonomy.TaxonomyReader;
 
@@ -37,9 +38,9 @@ public abstract class FloatTaxonomyFacet
   
   protected void rollup() throws IOException {
     // Rollup any necessary dims:
-    for(Map.Entry<String,FacetsConfig.DimConfig> ent : config.getDimConfigs().entrySet())
{
+    for(Map.Entry<String,DimConfig> ent : config.getDimConfigs().entrySet()) {
       String dim = ent.getKey();
-      FacetsConfig.DimConfig ft = ent.getValue();
+      DimConfig ft = ent.getValue();
       if (ft.hierarchical && ft.multiValued == false) {
         int dimRootOrd = taxoReader.getOrdinal(new FacetLabel(dim));
         assert dimRootOrd > 0;
@@ -61,7 +62,16 @@ public abstract class FloatTaxonomyFacet
 
   @Override
   public Number getSpecificValue(String dim, String... path) throws IOException {
-    verifyDim(dim);
+    DimConfig dimConfig = verifyDim(dim);
+    if (path.length == 0) {
+      if (dimConfig.hierarchical && dimConfig.multiValued == false) {
+        // ok: rolled up at search time
+      } else if (dimConfig.requireDimCount && dimConfig.multiValued) {
+        // ok: we indexed all ords at index time
+      } else {
+        throw new IllegalArgumentException("cannot return dimension-level value alone; use
getTopChildren instead");
+      }
+    }
     int ord = taxoReader.getOrdinal(new FacetLabel(dim, path));
     if (ord < 0) {
       return -1;
@@ -74,7 +84,7 @@ public abstract class FloatTaxonomyFacet
     if (topN <= 0) {
       throw new IllegalArgumentException("topN must be > 0 (got: " + topN + ")");
     }
-    FacetsConfig.DimConfig dimConfig = verifyDim(dim);
+    DimConfig dimConfig = verifyDim(dim);
     FacetLabel cp = new FacetLabel(dim, path);
     int dimOrd = taxoReader.getOrdinal(cp);
     if (dimOrd == -1) {

Modified: lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/IntTaxonomyFacets.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/IntTaxonomyFacets.java?rev=1552197&r1=1552196&r2=1552197&view=diff
==============================================================================
--- lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/IntTaxonomyFacets.java
(original)
+++ lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/IntTaxonomyFacets.java
Thu Dec 19 01:07:44 2013
@@ -20,6 +20,7 @@ package org.apache.lucene.facet;
 import java.io.IOException;
 import java.util.Map;
 
+import org.apache.lucene.facet.FacetsConfig.DimConfig;
 import org.apache.lucene.facet.taxonomy.FacetLabel;
 import org.apache.lucene.facet.taxonomy.TaxonomyReader;
 
@@ -37,9 +38,9 @@ public abstract class IntTaxonomyFacets 
   
   protected void rollup() throws IOException {
     // Rollup any necessary dims:
-    for(Map.Entry<String,FacetsConfig.DimConfig> ent : config.getDimConfigs().entrySet())
{
+    for(Map.Entry<String,DimConfig> ent : config.getDimConfigs().entrySet()) {
       String dim = ent.getKey();
-      FacetsConfig.DimConfig ft = ent.getValue();
+      DimConfig ft = ent.getValue();
       if (ft.hierarchical && ft.multiValued == false) {
         int dimRootOrd = taxoReader.getOrdinal(new FacetLabel(dim));
         // It can be -1 if this field was declared in the
@@ -64,7 +65,16 @@ public abstract class IntTaxonomyFacets 
 
   @Override
   public Number getSpecificValue(String dim, String... path) throws IOException {
-    verifyDim(dim);
+    DimConfig dimConfig = verifyDim(dim);
+    if (path.length == 0) {
+      if (dimConfig.hierarchical && dimConfig.multiValued == false) {
+        // ok: rolled up at search time
+      } else if (dimConfig.requireDimCount && dimConfig.multiValued) {
+        // ok: we indexed all ords at index time
+      } else {
+        throw new IllegalArgumentException("cannot return dimension-level value alone; use
getTopChildren instead");
+      }
+    }
     int ord = taxoReader.getOrdinal(new FacetLabel(dim, path));
     if (ord < 0) {
       return -1;
@@ -77,7 +87,7 @@ public abstract class IntTaxonomyFacets 
     if (topN <= 0) {
       throw new IllegalArgumentException("topN must be > 0 (got: " + topN + ")");
     }
-    FacetsConfig.DimConfig dimConfig = verifyDim(dim);
+    DimConfig dimConfig = verifyDim(dim);
     FacetLabel cp = new FacetLabel(dim, path);
     int dimOrd = taxoReader.getOrdinal(cp);
     if (dimOrd == -1) {

Modified: lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/MultiFacets.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/MultiFacets.java?rev=1552197&r1=1552196&r2=1552197&view=diff
==============================================================================
--- lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/MultiFacets.java
(original)
+++ lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/MultiFacets.java
Thu Dec 19 01:07:44 2013
@@ -59,8 +59,7 @@ public class MultiFacets extends Facets 
   }
 
   public List<FacetResult> getAllDims(int topN) throws IOException {
-    // nocommit can/should we impl this?  ie, sparse
-    // faceting after drill sideways
+    // TODO
     throw new UnsupportedOperationException();
   }
 }

Modified: lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/SortedSetDocValuesFacetCounts.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/SortedSetDocValuesFacetCounts.java?rev=1552197&r1=1552196&r2=1552197&view=diff
==============================================================================
--- lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/SortedSetDocValuesFacetCounts.java
(original)
+++ lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/SortedSetDocValuesFacetCounts.java
Thu Dec 19 01:07:44 2013
@@ -143,7 +143,7 @@ public class SortedSetDocValuesFacetCoun
 
     MultiDocValues.OrdinalMap ordinalMap;
 
-    // nocommit not quite right?  really, we need a way to
+    // TODO: is this right?  really, we need a way to
     // verify that this ordinalMap "matches" the leaves in
     // matchingDocs...
     if (dv instanceof MultiSortedSetDocValues && matchingDocs.size() > 1) {

Modified: lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/TaxonomyFacetSumFloatAssociations.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/TaxonomyFacetSumFloatAssociations.java?rev=1552197&r1=1552196&r2=1552197&view=diff
==============================================================================
--- lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/TaxonomyFacetSumFloatAssociations.java
(original)
+++ lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/TaxonomyFacetSumFloatAssociations.java
Thu Dec 19 01:07:44 2013
@@ -61,7 +61,7 @@ public class TaxonomyFacetSumFloatAssoci
       //System.out.println("count seg=" + hits.context.reader());
       while (doc < length && (doc = bits.nextSetBit(doc)) != -1) {
         //System.out.println("  doc=" + doc);
-        // nocommit use OrdinalsReader?  but, add a
+        // TODO: use OrdinalsReader?  we'd need to add a
         // BytesRef getAssociation()?
         dv.get(doc, scratch);
         byte[] bytes = scratch.bytes;

Modified: lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/TaxonomyFacetSumIntAssociations.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/TaxonomyFacetSumIntAssociations.java?rev=1552197&r1=1552196&r2=1552197&view=diff
==============================================================================
--- lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/TaxonomyFacetSumIntAssociations.java
(original)
+++ lucene/dev/branches/lucene5339/lucene/facet/src/java/org/apache/lucene/facet/TaxonomyFacetSumIntAssociations.java
Thu Dec 19 01:07:44 2013
@@ -61,7 +61,7 @@ public class TaxonomyFacetSumIntAssociat
       //System.out.println("count seg=" + hits.context.reader());
       while (doc < length && (doc = bits.nextSetBit(doc)) != -1) {
         //System.out.println("  doc=" + doc);
-        // nocommit use OrdinalsReader?  but, add a
+        // TODO: use OrdinalsReader?  we'd need to add a
         // BytesRef getAssociation()?
         dv.get(doc, scratch);
         byte[] bytes = scratch.bytes;

Modified: lucene/dev/branches/lucene5339/lucene/facet/src/test/org/apache/lucene/facet/TestRangeFacetCounts.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5339/lucene/facet/src/test/org/apache/lucene/facet/TestRangeFacetCounts.java?rev=1552197&r1=1552196&r2=1552197&view=diff
==============================================================================
--- lucene/dev/branches/lucene5339/lucene/facet/src/test/org/apache/lucene/facet/TestRangeFacetCounts.java
(original)
+++ lucene/dev/branches/lucene5339/lucene/facet/src/test/org/apache/lucene/facet/TestRangeFacetCounts.java
Thu Dec 19 01:07:44 2013
@@ -222,9 +222,6 @@ public class TestRangeFacetCounts extend
 
         @Override
         protected Facets buildFacetsResult(FacetsCollector drillDowns, FacetsCollector[]
drillSideways, String[] drillSidewaysDims) throws IOException {        
-          // nocommit this is awkward... can we improve?
-          // nocommit is drillDowns allowed to be null?
-          // should it?
           FacetsCollector dimFC = drillDowns;
           FacetsCollector fieldFC = drillDowns;
           if (drillSideways != null) {

Modified: lucene/dev/branches/lucene5339/lucene/facet/src/test/org/apache/lucene/facet/TestTaxonomyFacetCounts.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5339/lucene/facet/src/test/org/apache/lucene/facet/TestTaxonomyFacetCounts.java?rev=1552197&r1=1552196&r2=1552197&view=diff
==============================================================================
--- lucene/dev/branches/lucene5339/lucene/facet/src/test/org/apache/lucene/facet/TestTaxonomyFacetCounts.java
(original)
+++ lucene/dev/branches/lucene5339/lucene/facet/src/test/org/apache/lucene/facet/TestTaxonomyFacetCounts.java
Thu Dec 19 01:07:44 2013
@@ -309,6 +309,14 @@ public class TestTaxonomyFacetCounts ext
     // wrap collecting the "normal" hits and also facets:
     searcher.search(new MatchAllDocsQuery(), c);
     Facets facets = getTaxonomyFacetCounts(taxoReader, config, c);
+
+    try {
+      facets.getSpecificValue("a");
+      fail("didn't hit expected exception");
+    } catch (IllegalArgumentException iae) {
+      // expected
+    }
+
     FacetResult result = facets.getTopChildren(10, "a");
     assertEquals(1, result.labelValues.length);
     assertEquals(1, result.labelValues[0].value.intValue());
@@ -356,11 +364,13 @@ public class TestTaxonomyFacetCounts ext
     DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(taxoDir, IndexWriterConfig.OpenMode.CREATE);
 
     FacetsConfig config = new FacetsConfig();
+    config.setRequireDimCount("dim", true);
+
     config.setMultiValued("dim2", true);
+    config.setRequireDimCount("dim2", true);
+
     config.setMultiValued("dim3", true);
     config.setHierarchical("dim3", true);
-    config.setRequireDimCount("dim", true);
-    config.setRequireDimCount("dim2", true);
     config.setRequireDimCount("dim3", true);
 
     Document doc = new Document();
@@ -385,6 +395,14 @@ public class TestTaxonomyFacetCounts ext
     assertEquals(1, facets.getTopChildren(10, "dim").value);
     assertEquals(1, facets.getTopChildren(10, "dim2").value);
     assertEquals(1, facets.getTopChildren(10, "dim3").value);
+    try {
+      assertEquals(1, facets.getSpecificValue("dim"));
+      fail("didn't hit expected exception");
+    } catch (IllegalArgumentException iae) {
+      // expected
+    }
+    assertEquals(1, facets.getSpecificValue("dim2"));
+    assertEquals(1, facets.getSpecificValue("dim3"));
     IOUtils.close(writer, taxoWriter, searcher.getIndexReader(), taxoReader, dir, taxoDir);
   }
 



Mime
View raw message