Package org.apache.lucene.facet.index

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


public class IndexAndTaxonomyRevisionTest extends ReplicatorTestCase {
 
  private Document newDocument(TaxonomyWriter taxoWriter) throws IOException {
    Document doc = new Document();
    FacetFields ff = new FacetFields(taxoWriter);
    ff.addFields(doc, Collections.singleton(new CategoryPath("A")));
    return doc;
  }
 
  @Test
  public void testNoCommit() throws Exception {
View Full Code Here


      ArrayList<CategoryPath> categories = new ArrayList<CategoryPath>();
      for (int j = 0; j < numCategories; j++) {
        String dimension = dimensions[random.nextInt(dimensions.length)];
        categories.add(new CategoryPath(dimension, Integer.toString(i)));
      }
      facetFields.addFields(doc, categories);
      indexWriter.addDocument(doc);
    }
    IOUtils.close(indexWriter, taxoWriter);
   
    // test the multi iterator
View Full Code Here

                  }
                }
                docPaths.add(new CategoryPath("field", path));
              }
              try {
                facetFields.addFields(doc, docPaths);
                w.addDocument(doc);
              } catch (IOException ioe) {
                throw new RuntimeException(ioe);
              }
View Full Code Here

                  String s = cp.subpath(level).toString('/');
                  values.put(s, s);
                  --level;
                }
              }
              facetFields.addFields(doc, cats);
              iw.addDocument(doc);
            } catch (IOException e) {
              throw new RuntimeException(e);
            }
          }
View Full Code Here

    TaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(taxoDir, IndexWriterConfig.OpenMode.CREATE);
    FacetFields facetFields = new FacetFields(taxoWriter);     

    Document doc = new Document();
    doc.add(newTextField("field", "text", Field.Store.NO));
    facetFields.addFields(doc, Collections.singletonList(new CategoryPath("a/path", '/')));
    writer.addDocument(doc);
    writer.close();
    taxoWriter.close();
    dir.close();
    taxoDir.close();
View Full Code Here

    FacetFields facetFields = new FacetFields(taxoWriter, fip);

    Document doc = new Document();
    doc.add(newTextField("field", "text", Field.Store.NO));
    facetFields.addFields(doc, Collections.singletonList(new CategoryPath("a/path", '/')));
    writer.addDocument(doc);

    // NRT open
    IndexSearcher searcher = newSearcher(writer.getReader());
    writer.close();
View Full Code Here

    FacetFields facetFields = new FacetFields(taxoWriter);

    Document doc = new Document();
    doc.add(newTextField("field", "text", Field.Store.NO));
    BytesRef br = new BytesRef(new byte[] {(byte) 0xee, (byte) 0x92, (byte) 0xaa, (byte) 0xef, (byte) 0x9d, (byte) 0x89});
    facetFields.addFields(doc, Collections.singletonList(new CategoryPath("dim/" + br.utf8ToString(), '/')));
    try {
      writer.addDocument(doc);
    } catch (IllegalArgumentException iae) {
      // expected
    }
View Full Code Here

    doc.add(newTextField("field", "text", Field.Store.NO));
    List<CategoryPath> paths = new ArrayList<CategoryPath>();
    for (int i = 0; i < numLabels; i++) {
      paths.add(new CategoryPath("dim", "" + i));
    }
    facetFields.addFields(doc, paths);
    writer.addDocument(doc);
   
    // NRT open
    IndexSearcher searcher = newSearcher(writer.getReader());
    writer.close();
View Full Code Here

      if (i % 5 == 0) { // 20
        paths.add(new CategoryPath("b"));
      }
      FacetFields facetFields = new FacetFields(taxoWriter);
      if (paths.size() > 0) {
        facetFields.addFields(doc, paths);
      }
      writer.addDocument(doc);
    }
   
    taxoWriter.close();
View Full Code Here

    IndexWriter writer = new IndexWriter(indexDir, conf);
    DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(taxoDir);
    FacetFields facetFields = new FacetFields(taxoWriter);
   
    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();
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.