Package org.apache.lucene.facet.index.params

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


  private static LuceneTaxonomyReader taxo;
  private static Directory dir;
  private static Directory taxoDir;
 
  public DrillDownTest() throws IOException {
    PerDimensionIndexingParams iParams = new PerDimensionIndexingParams();
    CategoryListParams aClParams = new CategoryListParams(new Term("testing_facets_a", "a"));
    CategoryListParams bClParams = new CategoryListParams(new Term("testing_facets_b", "b"));
   
    iParams.addCategoryListParams(new CategoryPath("a"), aClParams);
    iParams.addCategoryListParams(new CategoryPath("b"), bClParams);
   
    nonDefaultParams = new FacetSearchParams(iParams);
  }
View Full Code Here


    TaxonomyWriter tw = new LuceneTaxonomyWriter(dirs[0][1], OpenMode.CREATE);

    /**
     * Configure with no custom counting lists
     */
    PerDimensionIndexingParams iParams = new PerDimensionIndexingParams();

    seedIndex(iw, tw, iParams);

    IndexReader ir = iw.getReader();
    tw.commit();
View Full Code Here

        TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.WHITESPACE, false)));
    // create and open a taxonomy writer
    TaxonomyWriter tw = new LuceneTaxonomyWriter(dirs[0][1],
        OpenMode.CREATE);

    PerDimensionIndexingParams iParams = new PerDimensionIndexingParams();
    iParams.addCategoryListParams(new CategoryPath("Author"),
        new CategoryListParams(new Term("$author", "Authors")));
    seedIndex(iw, tw, iParams);

    IndexReader ir = iw.getReader();
    tw.commit();
View Full Code Here

        TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.WHITESPACE, false)));
    // create and open a taxonomy writer
    TaxonomyWriter tw = new LuceneTaxonomyWriter(dirs[0][1],
        OpenMode.CREATE);

    PerDimensionIndexingParams iParams = new PerDimensionIndexingParams();
    iParams.addCategoryListParams(new CategoryPath("Band"),
        new CategoryListParams(new Term("$music", "Bands")));
    iParams.addCategoryListParams(new CategoryPath("Composer"),
        new CategoryListParams(new Term("$music", "Composers")));
    seedIndex(iw, tw, iParams);

    IndexReader ir = iw.getReader();
    tw.commit();
View Full Code Here

    RandomIndexWriter iw = new RandomIndexWriter(random, dirs[0][0], newIndexWriterConfig(
        TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.WHITESPACE, false)));
    // create and open a taxonomy writer
    TaxonomyWriter tw = new LuceneTaxonomyWriter(dirs[0][1], OpenMode.CREATE);

    PerDimensionIndexingParams iParams = new PerDimensionIndexingParams();
    iParams.addCategoryListParams(new CategoryPath("Band"),
        new CategoryListParams(new Term("$bands", "Bands")));
    iParams.addCategoryListParams(new CategoryPath("Composer"),
        new CategoryListParams(new Term("$composers", "Composers")));
    seedIndex(iw, tw, iParams);

    IndexReader ir = iw.getReader();
    tw.commit();
View Full Code Here

        TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.WHITESPACE, false)));
    // create and open a taxonomy writer
    TaxonomyWriter tw = new LuceneTaxonomyWriter(dirs[0][1],
        OpenMode.CREATE);

    PerDimensionIndexingParams iParams = new PerDimensionIndexingParams();
    iParams.addCategoryListParams(new CategoryPath("Band"),
        new CategoryListParams(new Term("$music", "music")));
    iParams.addCategoryListParams(new CategoryPath("Composer"),
        new CategoryListParams(new Term("$music", "music")));
    iParams.addCategoryListParams(new CategoryPath("Author"),
        new CategoryListParams(new Term("$literature", "Authors")));

    seedIndex(iw, tw, iParams);

    IndexReader ir = iw.getReader();
View Full Code Here

public class PerDimensionIndexingParamsTest extends LuceneTestCase {

  @Test
  public void testTopLevelSettings() {
    FacetIndexingParams ifip = new PerDimensionIndexingParams();
    assertNotNull("Missing default category list", ifip
        .getAllCategoryListParams());
    assertEquals(
        "Expected default category list term is $facets:$fulltree$",
        new Term("$facets", "$fulltree$"), ifip.getCategoryListParams(
            null).getTerm());
    String expectedDDText = "a"
        + ifip.getFacetDelimChar() + "b";
    CategoryPath cp = new CategoryPath("a", "b");
    assertEquals("wrong drill-down term", new Term("$facets",
        expectedDDText), DrillDown.term(ifip,cp));
    char[] buf = new char[20];
    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(
        "for any other, it's the concatenation of name + partition",
        "$fulltree$1", PartitionsUtils.partitionName(clParams, 1));
    assertEquals("default partition number is always 0", 0,
        PartitionsUtils.partitionNumber(ifip,100));
   
    assertEquals("default partition size is unbounded", Integer.MAX_VALUE,
        ifip.getPartitionSize());
  }
View Full Code Here

        ifip.getPartitionSize());
  }

  @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

    TaxonomyWriter tw = new DirectoryTaxonomyWriter(dirs[0][1], OpenMode.CREATE);

    /**
     * Configure with no custom counting lists
     */
    PerDimensionIndexingParams iParams = new PerDimensionIndexingParams();

    seedIndex(iw, tw, iParams);

    IndexReader ir = iw.getReader();
    tw.commit();
View Full Code Here

        TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.WHITESPACE, false)));
    // create and open a taxonomy writer
    TaxonomyWriter tw = new DirectoryTaxonomyWriter(dirs[0][1],
        OpenMode.CREATE);

    PerDimensionIndexingParams iParams = new PerDimensionIndexingParams();
    iParams.addCategoryListParams(new CategoryPath("Author"),
        new CategoryListParams(new Term("$author", "Authors")));
    seedIndex(iw, tw, iParams);

    IndexReader ir = iw.getReader();
    tw.commit();
View Full Code Here

TOP

Related Classes of org.apache.lucene.facet.index.params.PerDimensionIndexingParams

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.