Examples of CategoryListParams


Examples of org.apache.lucene.facet.index.params.CategoryListParams

    int numchars = ifip.drillDownTermText(cp, buf);
    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", "$fulltree$",
        PartitionsUtils.partitionNameByOrdinal(ifip, clParams , 250));
    assertEquals("for partition 0, the same name should be returned",
        "$fulltree$", PartitionsUtils.partitionName(clParams, 0));
    assertEquals(
View Full Code Here

Examples of org.apache.lucene.facet.index.params.CategoryListParams

  }

  @Test
  public void testCategoryListParamsAddition() {
    PerDimensionIndexingParams tlfip = new PerDimensionIndexingParams();
    CategoryListParams clp = new CategoryListParams(
        new Term("clp", "value"));
    tlfip.addCategoryListParams(new CategoryPath("a"), clp);
    assertEquals("Expected category list term is " + clp.getTerm(), clp
        .getTerm(), tlfip.getCategoryListParams(new CategoryPath("a"))
        .getTerm());
    assertNotSame("Unexpected default category list " + clp.getTerm(), clp,
        tlfip.getCategoryListParams(null));
  }
View Full Code Here

Examples of org.apache.lucene.facet.index.params.CategoryListParams

public class CategoryListParamsTest extends LuceneTestCase {

  @Test
  public void testDefaultSettings() {
    CategoryListParams clp = new CategoryListParams();
    assertEquals("wrong default term", new Term("$facets", "$fulltree$"), clp.getTerm());
    assertEquals("unexpected default encoder", "Sorting (Unique (DGap (VInt8)))", clp.createEncoder().toString());
    assertEquals("unexpected default decoder", "DGap (VInt8)", clp.createEncoder().createMatchingDecoder().toString());
  }
View Full Code Here

Examples of org.apache.lucene.facet.index.params.CategoryListParams

   * Test that the {@link CategoryListParams#hashCode()} and
   * {@link CategoryListParams#equals(Object)} are consistent.
   */
  @Test
  public void testIdentity() {
    CategoryListParams clParams1 = new CategoryListParams();
    // Assert identity is correct - a CategoryListParams equals itself.
    assertEquals("A CategoryListParams object does not equal itself.",
        clParams1, clParams1);
    // For completeness, the object's hashcode equals itself
    assertEquals("A CategoryListParams object's hashCode does not equal itself.",
        clParams1.hashCode(), clParams1.hashCode());
  }
View Full Code Here

Examples of org.apache.lucene.facet.index.params.CategoryListParams

   * other.
   */
  @Test
  public void testIdentityConsistency() {
    // Test 2 CategoryListParams with the default parameter
    CategoryListParams clParams1 = new CategoryListParams();
    CategoryListParams clParams2 = new CategoryListParams();
    assertEquals(
        "2 CategoryListParams with the same default term should equal each other.",
        clParams1, clParams2);
    assertEquals("2 CategoryListParams with the same default term should have the same hashcode",
        clParams1.hashCode(), clParams2.hashCode());

    // Test 2 CategoryListParams with the same specified Term
    clParams1 = new CategoryListParams(new Term("test"));
    clParams2 = new CategoryListParams(new Term("test"));
    assertEquals(
        "2 CategoryListParams with the same term should equal each other.",
        clParams1, clParams2);
    assertEquals("2 CategoryListParams with the same term should have the same hashcode",
        clParams1.hashCode(), clParams2.hashCode());
   
    // Test 2 CategoryListParams with DIFFERENT terms
    clParams1 = new CategoryListParams(new Term("test1"));
    clParams2 = new CategoryListParams(new Term("test2"));
    assertFalse(
        "2 CategoryListParams with the different terms should NOT equal each other.",
        clParams1.equals(clParams2));
    assertFalse(
        "2 CategoryListParams with the different terms should NOT have the same hashcode.",
        clParams1.hashCode() == clParams2.hashCode());
  }
View Full Code Here

Examples of org.apache.lucene.facet.index.params.CategoryListParams

    char[] buf = new char[20];
    int numchars = dfip.drillDownTermText(cp, buf);
    assertEquals("3 characters should be written", 3, numchars);
    assertEquals("wrong drill-down term text", expectedDDText, new String(
        buf, 0, numchars));
    CategoryListParams clParams = dfip.getCategoryListParams(null);
    assertEquals("partition for all ordinals is the first", "$fulltree$",
        PartitionsUtils.partitionNameByOrdinal(dfip, clParams , 250));
    assertEquals("for partition 0, the same name should be returned",
        "$fulltree$", PartitionsUtils.partitionName(clParams, 0));
    assertEquals(
View Full Code Here

Examples of org.apache.lucene.facet.index.params.CategoryListParams

        dfip.getPartitionSize());
  }

  @Test
  public void testCategoryListParamsWithDefaultIndexingParams() {
    CategoryListParams clp = new CategoryListParams(
        new Term("clp", "value"));
    FacetIndexingParams dfip = new DefaultFacetIndexingParams(clp);
    assertEquals("Expected default category list term is " + clp.getTerm(),
        clp.getTerm(), dfip.getCategoryListParams(null).getTerm());
  }
View Full Code Here

Examples of org.apache.lucene.facet.params.CategoryListParams

      return Collections.singletonMap(searchParams.indexingParams.getCategoryListParams(null), searchParams.facetRequests);
    }
   
    HashMap<CategoryListParams,List<FacetRequest>> requestsPerCLP = new HashMap<CategoryListParams,List<FacetRequest>>();
    for (FacetRequest fr : searchParams.facetRequests) {
      CategoryListParams clp = searchParams.indexingParams.getCategoryListParams(fr.categoryPath);
      List<FacetRequest> requests = requestsPerCLP.get(clp);
      if (requests == null) {
        requests = new ArrayList<FacetRequest>();
        requestsPerCLP.put(clp, requests);
      }
View Full Code Here

Examples of org.apache.lucene.facet.params.CategoryListParams

    // If we're here it means the facet requests are spread across multiple
    // category lists, or there are multiple types of facet requests, or both.
    // Therefore create a per-CategoryList mapping of FacetsAggregators.
    Map<CategoryListParams,FacetsAggregator> perCLPAggregator = new HashMap<CategoryListParams,FacetsAggregator>();
    for (Entry<CategoryListParams,List<FacetRequest>> e : requestsPerCLP.entrySet()) {
      CategoryListParams clp = e.getKey();
      List<FacetRequest> requests = e.getValue();
      Map<Class<? extends FacetsAggregator>,FacetsAggregator> aggClasses = new HashMap<Class<? extends FacetsAggregator>,FacetsAggregator>();
      Map<CategoryPath,FacetsAggregator> perCategoryAggregator = new HashMap<CategoryPath,FacetsAggregator>();
      for (FacetRequest fr : requests) {
        FacetsAggregator fa = fr.createFacetsAggregator(searchParams.indexingParams);
View Full Code Here

Examples of org.apache.lucene.facet.params.CategoryListParams

      if (rootOrd == TaxonomyReader.INVALID_ORDINAL) { // category does not exist
        // Add empty FacetResult
        res.add(emptyResult(rootOrd, fr));
        continue;
      }
      CategoryListParams clp = searchParams.indexingParams.getCategoryListParams(fr.categoryPath);
      if (fr.categoryPath.length > 0) { // someone might ask to aggregate the ROOT category
        OrdinalPolicy ordinalPolicy = clp.getOrdinalPolicy(fr.categoryPath.components[0]);
        if (ordinalPolicy == OrdinalPolicy.NO_PARENTS) {
          // rollup values
          aggregator.rollupValues(fr, rootOrd, children, siblings, facetArrays);
        }
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.