Package org.apache.lucene.facet.index

Examples of org.apache.lucene.facet.index.CategoryDocumentBuilder.build()


          }
          if (!create && docToUpdate != null) {
            Document doc = getDocument(docToUpdate, bean, attributes, config, reverseattributes);
            // add facets to document
            if (categoryDocBuilder != null) {
              categoryDocBuilder.build(doc);
            }
            indexWriter.updateDocument(idTerm, doc);
          } else {
            Document doc = getDocument(null, bean, attributes, config, reverseattributes);
            // add facets to document
View Full Code Here


            indexWriter.updateDocument(idTerm, doc);
          } else {
            Document doc = getDocument(null, bean, attributes, config, reverseattributes);
            // add facets to document
            if (categoryDocBuilder != null) {
              categoryDocBuilder.build(doc);
            }
            indexWriter.addDocument(doc);
          }
        } finally {
          bcase.stop();
View Full Code Here

          Store.NO, Index.ANALYZED));

      // invoke the category document builder for adding categories to the
      // document and,
      // as required, to the taxonomy index
      categoryDocBuilder.build(doc);

      // finally add the document to the index
      iw.addDocument(doc);

      nDocsAdded++;
View Full Code Here

      TaxonomyWriter tw, String content, List<CategoryPath> categories) throws IOException,
      CorruptIndexException {
    Document d = new Document();
    CategoryDocumentBuilder builder = new CategoryDocumentBuilder(tw, iParams);
    builder.setCategoryPaths(categories);
    builder.build(d);
    d.add(new Field("content", content, Store.YES, Index.ANALYZED, TermVector.NO));
    iw.addDocument(d);
  }
 
  /** Build the "truth" with ALL the facets enumerating indexes content. */
 
View Full Code Here

      doc.add(new Field(SimpleUtils.TITLE, SimpleUtils.docTitles[docNum], Store.YES, Index.ANALYZED));
      doc.add(new Field(SimpleUtils.TEXT, SimpleUtils.docTexts[docNum], Store.NO, Index.ANALYZED));

      // invoke the category document builder for adding categories to the document and,
      // as required, to the taxonomy index
      categoryDocBuilder.build(doc);

      // finally add the document to the index
      iw.addDocument(doc);

      nDocsAdded ++;
View Full Code Here

      Document doc = new Document();
      doc.add(new Field(SimpleUtils.TITLE, docTitles[docNum], Store.YES, Index.ANALYZED));
      doc.add(new Field(SimpleUtils.TEXT, docTexts[docNum], Store.NO, Index.ANALYZED));

      // finally add the document to the index
      categoryDocBuilder.build(doc);
      iw.addDocument(doc);
     
      nDocsAdded++;
      nFacetsAdded += facetList.size();
    }
View Full Code Here

          Store.NO, Index.ANALYZED));

      // invoke the category document builder for adding categories to the
      // document and,
      // as required, to the taxonomy index
      categoryDocBuilder.build(doc);

      // finally add the document to the index
      iw.addDocument(doc);

      nDocsAdded++;
View Full Code Here

    Iterable<CategoryPath> cats = Arrays.asList(new CategoryPath("a"));
    for(int i = atLeast(2000); i > 0; --i) {
      Document doc = new Document();
      doc.add(new Field("f", "v", Store.NO, Index.NOT_ANALYZED_NO_NORMS));
      cdb.setCategoryPaths(cats);
      iw.addDocument(cdb.build(doc));
    }
   
    taxonomyWriter.close();
    iw.close();
   
View Full Code Here

   
    for (int i = 0; i < 100; i++) {
      categoryPaths.clear();
      categoryPaths.add(new CategoryPath("root",Integer.toString(i / 10), Integer.toString(i)));
      cdb.setCategoryPaths(categoryPaths);
      w.addDocument(cdb.build(new Document()));
    }
    IOUtils.close(tw, w);
  }

  /** search reader <code>r</code>*/
 
View Full Code Here

      doc.add(new TextField(SimpleUtils.TITLE, SimpleUtils.docTitles[docNum], Field.Store.YES));
      doc.add(new TextField(SimpleUtils.TEXT, SimpleUtils.docTexts[docNum], Field.Store.NO));

      // invoke the category document builder for adding categories to the document and,
      // as required, to the taxonomy index
      categoryDocBuilder.build(doc);

      // finally add the document to the index
      iw.addDocument(doc);

      nDocsAdded ++;
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.