Package org.apache.lucene.index

Examples of org.apache.lucene.index.IndexWriter.updateDocument()


            final List<Document> documents = myparser.parse(file);

            for (final Document doc : documents) {
                logger.debug("Document " + doc.get(conf.getID()));
                final Term docid = new Term(conf.getID(), doc.get(conf.getID()));
                writer.updateDocument(docid, doc);
            }
        }
        writer.close();
    }
}
View Full Code Here


                if (threadRandom.nextDouble() <= addChance) {
                  String id = String.format(Locale.ROOT, "%d_%04x", threadID, threadRandom.nextInt(idCount));
                  Integer field = threadRandom.nextInt(Integer.MAX_VALUE);
                  doc.add(new StringField("id", id, Field.Store.YES));
                  doc.add(new IntField("field", field.intValue(), Field.Store.YES));
                  w.updateDocument(new Term("id", id), doc);
                  rt.add(id, field);
                  if (values.put(id, field) == null) {
                    allIDs.add(id);
                  }
                }
View Full Code Here

    try {
     
      logger.info("collectionName : {}", collectionName);     
      logger.info("update indexing start................{}", term);
     
      indexWriter.updateDocument(term, document);
         
      logger.info("end");
     
    } catch (IOException e) {
     
View Full Code Here

    doc.add(new Field(field_name, "la la", type));
    doc.add(new Field(field_name, "foo bar foo bar foo", type));

    Directory dir = newDirectory();
    IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(random(), TEST_VERSION_CURRENT, mockAnalyzer));
    writer.updateDocument(new Term("id", "1"), doc);
    writer.commit();
    writer.close();
    DirectoryReader reader = DirectoryReader.open(dir);

    //Index document in Memory index
View Full Code Here

    final String docID = doc.get(DocMaker.ID_FIELD);
    if (docID == null) {
      throw new IllegalStateException("document must define the docid field");
    }
    final IndexWriter iw = getRunData().getIndexWriter();
    iw.updateDocument(new Term(DocMaker.ID_FIELD, docID), doc);
    return 1;
  }

  @Override
  protected String getLogMessage(int recsCount) {
View Full Code Here

    final IndexWriterConfig config = new IndexWriterConfig(
        ConstResolver.VERSION, analyzer);

    final IndexWriter writer = new IndexWriter(getDirectory(), config);

    writer.updateDocument(Status.TERM, doc);

    writer.close();

  }
View Full Code Here

    final IndexWriterConfig config = new IndexWriterConfig(
        ConstResolver.VERSION, analyzer);

    final IndexWriter writer = new IndexWriter(getDirectory(), config);

    writer.updateDocument(Status.TERM, doc);

    writer.close();

  }
View Full Code Here

    try {
      Document document = assertion.makeWritableDocument(context);
      String assertionId = assertion.getSystemPart().getAssertionId();
      Term idTerm = new Term(AsnConstants.FIELD_SYS_ASSERTIONID,assertionId);
      writer = this.makeIndexWriter(this.newAnalyzer(context));
      writer.updateDocument(idTerm,document);
    } finally {
      this.closeWriter(writer);
    }
  }
 
View Full Code Here

     
      // write the document (use update to replace an existing document),
      Term term = new Term(Storeables.FIELD_UUID,uuid);
      this.getObservers().onDocumentUpdate(document,uuid);
      if (batchWriter != null) {
        batchWriter.updateDocument(term,document);
      } else {
        writer = newWriter();
        writer.updateDocument(term,document);
      }
      this.getObservers().onDocumentUpdated(document,uuid);
View Full Code Here

        IndexWriter w = null;

        try {
            w = getWriter();

            w.updateDocument(id, document);
//      w.commit();
        } catch (Exception e) {
            try {
                if (w != null) w.rollback();
            } catch (IOException ex) {
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.