Examples of shouldAdd()


Examples of org.apache.lucene.facet.index.categorypolicy.DefaultOrdinalPolicy.shouldAdd()

  @Test
  public void testDefaultOrdinalPolicy() {
    // check ordinal policy
    OrdinalPolicy ordinalPolicy = new DefaultOrdinalPolicy();
    assertFalse("default ordinal policy should not match root", ordinalPolicy
        .shouldAdd(TaxonomyReader.ROOT_ORDINAL));
    for (int i = 0; i < 300; i++) {
      int ordinal = 1 + random.nextInt(Integer.MAX_VALUE - 1);
      assertTrue("default ordinal policy should match " + ordinal,
          ordinalPolicy.shouldAdd(ordinal));
View Full Code Here

Examples of org.apache.lucene.facet.index.categorypolicy.DefaultOrdinalPolicy.shouldAdd()

    assertFalse("default ordinal policy should not match root", ordinalPolicy
        .shouldAdd(TaxonomyReader.ROOT_ORDINAL));
    for (int i = 0; i < 300; i++) {
      int ordinal = 1 + random.nextInt(Integer.MAX_VALUE - 1);
      assertTrue("default ordinal policy should match " + ordinal,
          ordinalPolicy.shouldAdd(ordinal));
    }
  }

  @Test
  public void testNonTopLevelOrdinalPolicy() throws Exception {
View Full Code Here

Examples of org.apache.lucene.facet.index.categorypolicy.DefaultOrdinalPolicy.shouldAdd()

    }

    // check ordinal policy
    OrdinalPolicy ordinalPolicy = new DefaultOrdinalPolicy();
    assertEquals("ordinal policy does not match default for root"
        + "(seed " + seed + ")", ordinalPolicy
        .shouldAdd(TaxonomyReader.ROOT_ORDINAL), dfip
        .getOrdinalPolicy().shouldAdd(TaxonomyReader.ROOT_ORDINAL));
    for (int i = 0; i < 30; i++) {
      int ordinal = random.nextInt();
      assertEquals("ordinal policy does not match default for " + ordinal
View Full Code Here

Examples of org.apache.lucene.facet.index.categorypolicy.DefaultOrdinalPolicy.shouldAdd()

        .shouldAdd(TaxonomyReader.ROOT_ORDINAL), dfip
        .getOrdinalPolicy().shouldAdd(TaxonomyReader.ROOT_ORDINAL));
    for (int i = 0; i < 30; i++) {
      int ordinal = random.nextInt();
      assertEquals("ordinal policy does not match default for " + ordinal
          + "(seed " + seed + ")", ordinalPolicy.shouldAdd(ordinal),
          dfip.getOrdinalPolicy().shouldAdd(ordinal));
    }
  }

}
View Full Code Here

Examples of org.apache.lucene.facet.index.categorypolicy.DefaultOrdinalPolicy.shouldAdd()

  @Test
  public void testDefaultOrdinalPolicy() {
    // check ordinal policy
    OrdinalPolicy ordinalPolicy = new DefaultOrdinalPolicy();
    assertFalse("default ordinal policy should not match root", ordinalPolicy
        .shouldAdd(TaxonomyReader.ROOT_ORDINAL));
    for (int i = 0; i < 300; i++) {
      int ordinal = 1 + random.nextInt(Integer.MAX_VALUE - 1);
      assertTrue("default ordinal policy should match " + ordinal,
          ordinalPolicy.shouldAdd(ordinal));
View Full Code Here

Examples of org.apache.lucene.facet.index.categorypolicy.DefaultOrdinalPolicy.shouldAdd()

    assertFalse("default ordinal policy should not match root", ordinalPolicy
        .shouldAdd(TaxonomyReader.ROOT_ORDINAL));
    for (int i = 0; i < 300; i++) {
      int ordinal = 1 + random.nextInt(Integer.MAX_VALUE - 1);
      assertTrue("default ordinal policy should match " + ordinal,
          ordinalPolicy.shouldAdd(ordinal));
    }
  }

  @Test
  public void testNonTopLevelOrdinalPolicy() throws Exception {
View Full Code Here

Examples of org.apache.lucene.facet.index.categorypolicy.DefaultPathPolicy.shouldAdd()

  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();
View Full Code Here

Examples of org.apache.lucene.facet.index.categorypolicy.DefaultPathPolicy.shouldAdd()

        components[j] = (Integer.valueOf(random.nextInt(30))).toString();
      }
      cp = new CategoryPath(components);
      assertTrue("default path policy should accept "
          + cp.toString('/'),
          pathPolicy.shouldAdd(cp));
    }
  }

  @Test
  public void testNonTopLevelPathPolicy() throws Exception {
View Full Code Here

Examples of org.apache.lucene.facet.index.categorypolicy.DefaultPathPolicy.shouldAdd()

    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++) {
View Full Code Here

Examples of org.apache.lucene.facet.index.categorypolicy.DefaultPathPolicy.shouldAdd()

      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
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.