Package org.apache.lucene.facet.taxonomy.lucene

Examples of org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter.commit()


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

    IndexReader ir = iw.getReader();
    tw.commit();

    // prepare index reader and taxonomy.
    TaxonomyReader tr = new LuceneTaxonomyReader(dirs[0][1]);

    // prepare searcher to search against
View Full Code Here


    iParams.addCategoryListParams(new CategoryPath("Composer"),
        new CategoryListParams(new Term("$composers", "Composers")));
    seedIndex(iw, tw, iParams);

    IndexReader ir = iw.getReader();
    tw.commit();

    // prepare index reader and taxonomy.
    TaxonomyReader tr = new LuceneTaxonomyReader(dirs[0][1]);

    // prepare searcher to search against
View Full Code Here

        new CategoryListParams(new Term("$literature", "Authors")));

    seedIndex(iw, tw, iParams);

    IndexReader ir = iw.getReader();
    tw.commit();

    // prepare index reader and taxonomy.
    TaxonomyReader tr = new LuceneTaxonomyReader(dirs[0][1]);

    // prepare searcher to search against
View Full Code Here

    // Verifies that nothing is committed to the underlying Directory, if
    // commit() wasn't called.
    Directory dir = newDirectory();
    LuceneTaxonomyWriter ltw = new LuceneTaxonomyWriter(dir, OpenMode.CREATE_OR_APPEND, new NoOpCache());
    assertFalse(IndexReader.indexExists(dir));
    ltw.commit(); // first commit, so that an index will be created
    ltw.addCategory(new CategoryPath("a"));
   
    IndexReader r = IndexReader.open(dir);
    assertEquals("No categories should have been committed to the underlying directory", 1, r.numDocs());
    r.close();
View Full Code Here

  public void testCommitUserData() throws Exception {
    // Verifies that committed data is retrievable
    Directory dir = newDirectory();
    LuceneTaxonomyWriter ltw = new LuceneTaxonomyWriter(dir, OpenMode.CREATE_OR_APPEND, new NoOpCache());
    assertFalse(IndexReader.indexExists(dir));
    ltw.commit(); // first commit, so that an index will be created
    ltw.addCategory(new CategoryPath("a"));
    ltw.addCategory(new CategoryPath("b"));
    Map <String, String> userCommitData = new HashMap<String, String>();
    userCommitData.put("testing", "1 2 3");
    ltw.commit(userCommitData);
View Full Code Here

    ltw.commit(); // first commit, so that an index will be created
    ltw.addCategory(new CategoryPath("a"));
    ltw.addCategory(new CategoryPath("b"));
    Map <String, String> userCommitData = new HashMap<String, String>();
    userCommitData.put("testing", "1 2 3");
    ltw.commit(userCommitData);
    ltw.close();
    IndexReader r = IndexReader.open(dir);
    assertEquals("2 categories plus root should have been committed to the underlying directory", 3, r.numDocs());
    Map <String, String> readUserCommitData = r.getCommitUserData();
    assertTrue("wrong value extracted from commit data",
View Full Code Here

  public void testPartitionSizeWithCategories() throws Exception {
    FacetSearchParams fsp = new FacetSearchParams();
    Directory dir = newDirectory();
    TaxonomyWriter tw = new LuceneTaxonomyWriter(dir);
    tw.addCategory(new CategoryPath("a"));
    tw.commit();
    tw.close();
    TaxonomyReader tr = new LuceneTaxonomyReader(dir);
    assertEquals("unexpected partition offset for 1 categories", 2, PartitionsUtils.partitionOffset(fsp, 1, tr));
    assertEquals("unexpected partition size for 1 categories", 2, PartitionsUtils.partitionSize(fsp,tr));
    tr.close();
View Full Code Here

      prvt_add(iParams, iw, tw, "a", "d");
      prvt_add(iParams, iw, tw, "a", "e");

      IndexReader ir = iw.getReader();
      iw.close();
      tw.commit();
      tw.close();

      IndexSearcher is = newSearcher(ir);
      LuceneTaxonomyReader tr = new LuceneTaxonomyReader(tDir);
View Full Code Here

    tr = checker.openReader(dir);
    tw = checker.openWriter(dir);
    tw.addCategory(new CategoryPath("animal", "cat"));
    tr.refresh();
    tw.commit();
    tw.close();
    tr.refresh();
    tr.close();
    assertEquals(0, checker.nopen());
View Full Code Here

    TaxonomyWriter taxo = new LuceneTaxonomyWriter(taxoDir, OpenMode.CREATE);
   
    populateIndex(iw, taxo, getFacetIndexingParams(partitionSize));
   
    // commit changes (taxonomy prior to search index for consistency)
    taxo.commit();
    iw.commit();
    taxo.close();
    iw.close();
   
    // prepare for searching
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.