Examples of DocumentBuilder


Examples of oracle.xml.parser.v2.DocumentBuilder

    protected XMLDocument createXSQLDocument(MessageExchange exchange, NormalizedMessage in) throws MessagingException {
        if (xsql != null) {
            return xsql;
        }
        try {
            DocumentBuilder builder = new DocumentBuilder();
            SAXResult result = new SAXResult(builder);
            sourceTransformer.toResult(in.getContent(), result);
            return builder.getDocument();
        }
        catch (TransformerException e) {
            throw new MessagingException("Failed to convert inbound message content to an XMLDocument. Reason: " + e, e);
        }
    }

Examples of org.apache.lenya.cms.publication.DocumentBuilder

  
   * @see org.apache.lenya.cms.publication.SiteTreeNodeVisitor#visitSiteTreeNode(org.apache.lenya.cms.publication.SiteTreeNode)
   */
  public void visitSiteTreeNode(SiteTreeNode node) {
    Publication publication = getPublication();
    DocumentBuilder builder = publication.getDocumentBuilder();

    String srcDocumentid = node.getAbsoluteId();
    String destDocumentid =
      srcDocumentid.replaceFirst(
        getFirstdocumentid(),
        getSecdocumentid());

    Label[] labels = node.getLabels();

    // FIXME: if the resources differ for different languages, so iterate
    // on all languages

    String language = labels[0].getLanguage();
    String srcUrl =
      builder.buildCanonicalUrl(
        publication,
        getFirstarea(),
        srcDocumentid,
        language);
    Document srcDoc;
    try {
      srcDoc = builder.buildDocument(publication, srcUrl);
    } catch (DocumentBuildException e) {
      throw new BuildException(e);
    }
    ResourcesManager resourcesMgr = new ResourcesManager(srcDoc);
    List resources = new ArrayList(Arrays.asList(resourcesMgr.getResources()));
    resources.addAll(Arrays.asList(resourcesMgr.getMetaFiles()));
    File[] srcFiles =
      (File[]) resources.toArray(new File[resources.size()]);

    if (srcFiles == null) {
      log(
        "There are no resources for the document "
          + getFirstdocumentid());
      return;
    }

    String destUrl =
      builder.buildCanonicalUrl(
        publication,
        getSecarea(),
        destDocumentid,
        language);
    Document destDoc;
    try {
      destDoc = builder.buildDocument(publication, destUrl);
    } catch (DocumentBuildException e) {
      throw new BuildException(e);
    }
    resourcesMgr = new ResourcesManager(destDoc);

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

Examples of org.apache.solr.update.DocumentBuilder

      DocList docs,
      SolrIndexSearcher searcher,
      Set<String> fields,
      Map<SolrDocument, Integer> ids ) throws IOException
  {
    DocumentBuilder db = new DocumentBuilder(searcher.getSchema());
    SolrDocumentList list = new SolrDocumentList();
    list.setNumFound(docs.matches());
    list.setMaxScore(docs.maxScore());
    list.setStart(docs.offset());

    DocIterator dit = docs.iterator();
    while (dit.hasNext()) {
      int docid = dit.nextDoc();

      Document luceneDoc = searcher.doc(docid, fields);
      SolrDocument doc = new SolrDocument();
      db.loadStoredFields(doc, luceneDoc);

      // this may be removed if XMLWriter gets patched to
      // include score from doc iterator in solrdoclist
      if (docs.hasScores()) {
        doc.addField("score", dit.score());

Examples of org.apache.uima.lucas.indexer.DocumentBuilder

  private DocumentBuilder documentBuilder;
  private Collection<Field> fields;

  @Before
  public void setUp(){
    documentBuilder = new DocumentBuilder();
   
    field1 = new Field("field1", createMock(TokenStream.class));
    field2 = new Field("field2", createMock(TokenStream.class));
    fields = new ArrayList<Field>();    
    fields.add(field1);

Examples of org.eclipse.mylyn.wikitext.core.parser.DocumentBuilder

  private static String renderMarkup(String content, MarkupLanguage markup,
      String pattern) {   
    markup.setInternalLinkPattern(pattern);
    StringWriter writer = new StringWriter();
    DocumentBuilder builder = new HtmlDocumentBuilder(writer);
    MarkupParser parser = new MarkupParser(markup, builder);
    parser.parse(content, false);
    return writer.toString();
  }

Examples of org.elasticsearch.common.lucene.DocumentBuilder

   public void TestMultiValueMaxTermsPerDoc() throws Exception {
      Directory dir = new RAMDirectory();
      IndexWriter indexWriter = new IndexWriter(dir, new IndexWriterConfig(
              Lucene.VERSION, new PatternAnalyzer(Version.LUCENE_36, PatternAnalyzer.WHITESPACE_PATTERN, false, null)));

      DocumentBuilder d = DocumentBuilder.doc();

      for (int i=0;i<200;i++) d.add(DocumentBuilder.field("mvalue", "t" + i));

      indexWriter.addDocument(d.build());

      indexWriter.addDocument(DocumentBuilder.doc()
              .add(DocumentBuilder.field("mvalue", "t1"))
              .add(DocumentBuilder.field("mvalue", "t2")).build());

Examples of org.hibernate.search.engine.DocumentBuilder

    workspace = new Workspace( searchFactoryImplementor );
    worker = new LuceneWorker( workspace );
    try {
      List<LuceneWorker.WorkWithPayload> queueWithFlatDPs = new ArrayList<LuceneWorker.WorkWithPayload>( queue.size()*2 );
      for ( LuceneWork work : queue ) {
        DocumentBuilder documentBuilder = searchFactoryImplementor.getDocumentBuilders().get( work.getEntityClass() );
        IndexShardingStrategy shardingStrategy = documentBuilder.getDirectoryProviderSelectionStrategy();

        if ( PurgeAllLuceneWork.class.isAssignableFrom( work.getClass() ) ) {
          /***********hibernate search code**********
          DirectoryProvider[] providers = shardingStrategy.getDirectoryProvidersForDeletion(
              work.getEntityClass(),

Examples of org.hibernate.search.engine.DocumentBuilder

    }
    else {
      Set<Class> involvedClasses = new HashSet<Class>( classes.length );
      Collections.addAll( involvedClasses, classes );
      for (Class clazz : classes) {
        DocumentBuilder builder = builders.get( clazz );
        if ( builder != null ) involvedClasses.addAll( builder.getMappedSubclasses() );
      }
      for (Class clazz : involvedClasses) {
        DocumentBuilder builder = builders.get( clazz );
        //TODO should we rather choose a polymorphic path and allow non mapped entities
        if ( builder == null )
          throw new HibernateException( "Not a mapped entity (don't forget to add @Indexed): " + clazz );

//        final DirectoryProvider[] directoryProviders =
//            builder.getDirectoryProviderSelectionStrategy().getDirectoryProvidersForAllShards();
       
        //changed by jerry
        final DirectoryProvider[] directoryProviders =
          builder.getDirectoryProviderSelectionStrategy().getDirectoryProvidersForSearch(clazz,luceneQuery);

        for (DirectoryProvider provider : directoryProviders) {
          if ( !directories.contains( provider ) ) {
            directories.add( provider );
          }
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.