Package org.apache.lucene.facet.index

Examples of org.apache.lucene.facet.index.CategoryDocumentBuilder


  /** Utility method to add a document and facets to an index/taxonomy. */
  static void addFacets(FacetIndexingParams iParams, IndexWriter iw,
                        TaxonomyWriter tw, String... strings) throws IOException {
    ArrayList<CategoryPath> cps = new ArrayList<CategoryPath>();
    cps.add(new CategoryPath(strings));
    CategoryDocumentBuilder builder = new CategoryDocumentBuilder(tw, iParams);
    iw.addDocument(builder.setCategoryPaths(cps).build(new Document()));
  }
View Full Code Here


      CorruptIndexException {
    ArrayList<CategoryPath> cps = new ArrayList<CategoryPath>();
    CategoryPath cp = new CategoryPath(strings);
    cps.add(cp);
    Document d = new Document();
    new CategoryDocumentBuilder(tw, iParams).setCategoryPaths(cps).build(d);
    d.add(new Field("content", "alpha", Store.YES, Index.ANALYZED, TermVector.NO));
    iw.addDocument(d);
  }
View Full Code Here

        paths.add(new CategoryPath("a"));
      }
      if (i % 5 == 0) { // 20
        paths.add(new CategoryPath("b"));
      }
      CategoryDocumentBuilder builder = new CategoryDocumentBuilder(taxoWriter);
      builder.setCategoryPaths(paths).build(doc);
      writer.addDocument(doc);
    }
   
    taxoWriter.close();
    reader = writer.getReader();
View Full Code Here

    super.setup();
    // create the facets even if they should not be added - allows to measure the effect of just adding facets
    facets = getRunData().getFacetSource().getNextFacets(facets)
    withFacets = getRunData().getConfig().get("with.facets", true);
    if (withFacets) {
      categoryDocBuilder = new CategoryDocumentBuilder(getRunData().getTaxonomyWriter());
      categoryDocBuilder.setCategories(facets);
    }
  }
View Full Code Here

    RandomIndexWriter writer = new RandomIndexWriter(random, indexDir,
        newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.KEYWORD, false)));
    TaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(taxoDir);

    for (CategoryPath[] categories : perDocCategories) {
      writer.addDocument(new CategoryDocumentBuilder(taxoWriter, iParams)
          .setCategoryPaths(Arrays.asList(categories)).build(
              new Document()));

    }
    taxoWriter.commit();
View Full Code Here

TOP

Related Classes of org.apache.lucene.facet.index.CategoryDocumentBuilder

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.