Examples of shouldAdd()


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.NonTopLevelOrdinalPolicy.shouldAdd()

          components));
    }
    // check ordinal policy
    OrdinalPolicy ordinalPolicy = new NonTopLevelOrdinalPolicy();
    ordinalPolicy.init(taxonomy);
    assertFalse("top level ordinal policy should not match root", ordinalPolicy
        .shouldAdd(TaxonomyReader.ROOT_ORDINAL));
    for (int i = 0; i < 10; i++) {
      assertFalse("top level ordinal policy should not match "
          + topLevelOrdinals[i],
          ordinalPolicy.shouldAdd(topLevelOrdinals[i]));
View Full Code Here

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

    assertFalse("top level ordinal policy should not match root", ordinalPolicy
        .shouldAdd(TaxonomyReader.ROOT_ORDINAL));
    for (int i = 0; i < 10; i++) {
      assertFalse("top level ordinal policy should not match "
          + topLevelOrdinals[i],
          ordinalPolicy.shouldAdd(topLevelOrdinals[i]));
    }
    for (int i = 0; i < 300; i++) {
      assertTrue("top level ordinal policy should match "
          + nonTopLevelOrdinals[i],
          ordinalPolicy.shouldAdd(nonTopLevelOrdinals[i]));
View Full Code Here

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

          ordinalPolicy.shouldAdd(topLevelOrdinals[i]));
    }
    for (int i = 0; i < 300; i++) {
      assertTrue("top level ordinal policy should match "
          + nonTopLevelOrdinals[i],
          ordinalPolicy.shouldAdd(nonTopLevelOrdinals[i]));
    }

    // check illegal ordinal
    assertFalse("Should not add illegal ordinal", ordinalPolicy.shouldAdd(100000));
    taxonomy.close();
View Full Code Here

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

          + nonTopLevelOrdinals[i],
          ordinalPolicy.shouldAdd(nonTopLevelOrdinals[i]));
    }

    // check illegal ordinal
    assertFalse("Should not add illegal ordinal", ordinalPolicy.shouldAdd(100000));
    taxonomy.close();
    dir.close();
  }

}
View Full Code Here

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

          components));
    }
    // check ordinal policy
    OrdinalPolicy ordinalPolicy = new NonTopLevelOrdinalPolicy();
    ordinalPolicy.init(taxonomy);
    assertFalse("top level ordinal policy should not match root", ordinalPolicy
        .shouldAdd(TaxonomyReader.ROOT_ORDINAL));
    for (int i = 0; i < 10; i++) {
      assertFalse("top level ordinal policy should not match "
          + topLevelOrdinals[i],
          ordinalPolicy.shouldAdd(topLevelOrdinals[i]));
View Full Code Here

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

    assertFalse("top level ordinal policy should not match root", ordinalPolicy
        .shouldAdd(TaxonomyReader.ROOT_ORDINAL));
    for (int i = 0; i < 10; i++) {
      assertFalse("top level ordinal policy should not match "
          + topLevelOrdinals[i],
          ordinalPolicy.shouldAdd(topLevelOrdinals[i]));
    }
    for (int i = 0; i < 300; i++) {
      assertTrue("top level ordinal policy should match "
          + nonTopLevelOrdinals[i],
          ordinalPolicy.shouldAdd(nonTopLevelOrdinals[i]));
View Full Code Here

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

          ordinalPolicy.shouldAdd(topLevelOrdinals[i]));
    }
    for (int i = 0; i < 300; i++) {
      assertTrue("top level ordinal policy should match "
          + nonTopLevelOrdinals[i],
          ordinalPolicy.shouldAdd(nonTopLevelOrdinals[i]));
    }

    // check illegal ordinal
    assertFalse("Should not add illegal ordinal", ordinalPolicy.shouldAdd(100000));
    taxonomy.close();
View Full Code Here

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

          + nonTopLevelOrdinals[i],
          ordinalPolicy.shouldAdd(nonTopLevelOrdinals[i]));
    }

    // check illegal ordinal
    assertFalse("Should not add illegal ordinal", ordinalPolicy.shouldAdd(100000));
    taxonomy.close();
    dir.close();
  }

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