Package org.apache.lucene.facet.index

Examples of org.apache.lucene.facet.index.FacetFields.addFields()


   
    Document doc = new Document();
    facetFields.addFields(doc, Arrays.asList(new CategoryPath("A", "1")));
    writer.addDocument(doc);
    doc = new Document();
    facetFields.addFields(doc, Arrays.asList(new CategoryPath("A", "2")));
    writer.addDocument(doc);
    writer.close();
    taxoWriter.close();
   
    final DirectoryReader reader = DirectoryReader.open(indexDir);
View Full Code Here


  private void seedIndex(RandomIndexWriter iw, TaxonomyWriter tw, FacetIndexingParams iParams) throws IOException {
    FacetFields facetFields = new FacetFields(tw, iParams);
    for (CategoryPath cp : CATEGORIES) {
      Document doc = new Document();
      facetFields.addFields(doc, Collections.singletonList(cp));
      doc.add(new TextField("content", "alpha", Field.Store.YES));
      iw.addDocument(doc);
    }
  }
View Full Code Here

    FacetFields facetFields = new FacetFields(taxonomyWriter);
    for (int i = 0; i < 4; i++) {
      Document doc = new Document();
      doc.add(new NumericDocValuesField("price", (i+1)));
      facetFields.addFields(doc, Collections.singletonList(new CategoryPath("a", Integer.toString(i % 2))));
      iw.addDocument(doc);
    }
   
    taxonomyWriter.close();
    iw.close();
View Full Code Here

    FacetFields facetFields = new FacetFields(taxonomyWriter);
    for (int i = 0; i < 4; i++) {
      Document doc = new Document();
      doc.add(new NumericDocValuesField("price", (i+1)));
      facetFields.addFields(doc, Collections.singletonList(new CategoryPath("a", Integer.toString(i % 2))));
      iw.addDocument(doc);
    }
   
    taxonomyWriter.close();
    iw.close();
View Full Code Here

    });
    FacetFields facetFields = new FacetFields(taxonomyWriter, fip);
    for (int i = 0; i < 4; i++) {
      Document doc = new Document();
      doc.add(new NumericDocValuesField("price", (i+1)));
      facetFields.addFields(doc, Collections.singletonList(new CategoryPath("a", Integer.toString(i % 2), "1")));
      iw.addDocument(doc);
    }
   
    taxonomyWriter.close();
    iw.close();
View Full Code Here

  private void prvt_add(FacetIndexingParams iParams, RandomIndexWriter iw,
      TaxonomyWriter tw, String... strings) throws IOException {
    Document d = new Document();
    FacetFields facetFields = new FacetFields(tw, iParams);
    facetFields.addFields(d, Collections.singletonList(new CategoryPath(strings)));
    d.add(new TextField("content", "alpha", Field.Store.YES));
    iw.addDocument(d);
  }

}
View Full Code Here

    for(int i = atLeast(30); i > 0; --i) {
      Document doc = new Document();
      if (random().nextBoolean()) { // don't match all documents
        doc.add(new StringField("f", "v", Store.NO));
      }
      facetFields.addFields(doc, Collections.singletonList(new CategoryPath("a")));
      iw.addDocument(doc);
    }
   
    taxonomyWriter.close();
    iw.close();
View Full Code Here

      Document doc = new Document();
      doc.add(new StringField("f", "v", Store.NO));
      List<CategoryPath> cats = new ArrayList<CategoryPath>();
      cats.add(new CategoryPath("a"));
      cats.add(new CategoryPath("b"));
      facetFields.addFields(doc, cats);
      iw.addDocument(doc);
    }
   
    taxonomyWriter.close();
    iw.close();
View Full Code Here

      Document doc = new Document();
      doc.add(new StringField("f", "v", Store.NO));
      List<CategoryPath> cats = new ArrayList<CategoryPath>();
      cats.add(new CategoryPath("a"));
      cats.add(new CategoryPath("b"));
      facetFields.addFields(doc, cats);
      iw.addDocument(doc);
    }
   
    taxonomyWriter.close();
    iw.close();
View Full Code Here

    IndexWriter iw = new IndexWriter(indexDir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())));
   
    FacetFields facetFields = new FacetFields(taxonomyWriter);
    for(int i = atLeast(30); i > 0; --i) {
      Document doc = new Document();
      facetFields.addFields(doc, Arrays.asList(new CategoryPath("a"), new CategoryPath("b")));
      iw.addDocument(doc);
    }
   
    taxonomyWriter.close();
    iw.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.