Package org.apache.lucene

Examples of org.apache.lucene.DocumentBuilder


      // obtain the sample facets for current document
      List<CategoryPath> facetList = SimpleUtils.categoryPathArrayToList(SimpleUtils.categories[docNum]);

      // we do not alter indexing parameters! 
      // a category document builder will add the categories to a document once build() is called
      DocumentBuilder categoryDocBuilder = new CategoryDocumentBuilder(taxo).setCategoryPaths(facetList);

      // create a plain Lucene document and add some regular Lucene fields to it
      Document doc = new Document();
      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


      List<CategoryPath> facetList = SimpleUtils.categoryPathArrayToList(cPaths[docNum]);

      // we do not alter indexing parameters!
      // a category document builder will add the categories to a document
      // once build() is called
      DocumentBuilder categoryDocBuilder = new CategoryDocumentBuilder(
          taxo, iParams).setCategoryPaths(facetList);

      // create a plain Lucene document and add some regular Lucene fields
      // to it
      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

TOP

Related Classes of org.apache.lucene.DocumentBuilder

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.