Package org.apache.lucene.facet.index.categorypolicy

Examples of org.apache.lucene.facet.index.categorypolicy.DefaultPathPolicy


  /**
   * "fixed" path policy.
   * @see #getPathPolicy()
   */
  protected PathPolicy fixedPathPolicy() {
    return new DefaultPathPolicy();
  }
View Full Code Here


  @Test
  public void testDefaultPathPolicy() {
    // check path policy
    CategoryPath cp = new CategoryPath();
    PathPolicy pathPolicy = new DefaultPathPolicy();
    assertFalse("default path policy should not accept root",
        pathPolicy.shouldAdd(cp));
    for (int i = 0; i < 300; i++) {
      int nComponents = 1 + random.nextInt(10);
      String[] components = new String[nComponents];
      for (int j = 0; j < components.length; j++) {
        components[j] = (Integer.valueOf(random.nextInt(30))).toString();
      }
      cp = new CategoryPath(components);
      assertTrue("default path policy should accept "
          + cp.toString('/'),
          pathPolicy.shouldAdd(cp));
    }
  }
View Full Code Here

  public void testCategoryPolicies() {
    FacetIndexingParams dfip = new DefaultFacetIndexingParams();
    long seed = System.currentTimeMillis();
    // check path policy
    CategoryPath cp = new CategoryPath();
    PathPolicy pathPolicy = new DefaultPathPolicy();
    assertEquals("path policy does not match default for root" + "(seed "
        + seed + ")", pathPolicy.shouldAdd(cp), dfip.getPathPolicy()
        .shouldAdd(cp));
    for (int i = 0; i < 30; i++) {
      int nComponents = random.nextInt(10);
      String[] components = new String[nComponents];
      for (int j = 0; j < components.length; j++) {
        components[j] = (Integer.valueOf(random.nextInt(30))).toString();
      }
      cp = new CategoryPath(components);
      assertEquals("path policy does not match default for "
          + cp.toString('/') + "(seed " + seed + ")", pathPolicy
          .shouldAdd(cp), dfip.getPathPolicy().shouldAdd(cp));
    }

    // check ordinal policy
    OrdinalPolicy ordinalPolicy = new DefaultOrdinalPolicy();
View Full Code Here

  @Test
  public void testDefaultPathPolicy() {
    // check path policy
    CategoryPath cp = new CategoryPath();
    PathPolicy pathPolicy = new DefaultPathPolicy();
    assertFalse("default path policy should not accept root",
        pathPolicy.shouldAdd(cp));
    for (int i = 0; i < 300; i++) {
      int nComponents = 1 + random.nextInt(10);
      String[] components = new String[nComponents];
      for (int j = 0; j < components.length; j++) {
        components[j] = (Integer.valueOf(random.nextInt(30))).toString();
      }
      cp = new CategoryPath(components);
      assertTrue("default path policy should accept "
          + cp.toString('/'),
          pathPolicy.shouldAdd(cp));
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.lucene.facet.index.categorypolicy.DefaultPathPolicy

Copyright © 2018 www.massapicom. 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.