Examples of deleteDocuments()


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

    writer.close();
  }
 
  private void deleteDocument() throws IOException {
    IndexWriter writer = new IndexWriter( dir, a, false, MaxFieldLength.LIMITED );
    writer.deleteDocuments( new Term( "t_text1", "del" ) );
    // To see negative idf, keep comment the following line
    //writer.optimize();
    writer.close();
  }
 
View Full Code Here

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

    BoboMultiReader reader = null;
    try {
      Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_43);
      IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_43, analyzer);
      IndexWriter idxWriter = new IndexWriter(_indexDir, config);
      idxWriter.deleteDocuments(new Term("id", "1"));
      idxWriter.deleteDocuments(new Term("id", "2"));
      idxWriter.commit();
      reader = newIndexReader();

      br = new BrowseRequest();
View Full Code Here

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

    try {
      Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_43);
      IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_43, analyzer);
      IndexWriter idxWriter = new IndexWriter(_indexDir, config);
      idxWriter.deleteDocuments(new Term("id", "1"));
      idxWriter.deleteDocuments(new Term("id", "2"));
      idxWriter.commit();
      reader = newIndexReader();

      br = new BrowseRequest();
      br.setCount(10);
View Full Code Here

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

          Path dirPath = directory.getPath();
          if (isSuccess) {
            LOG.info("Add index [{0}] [{1}/{2}]", directory, shard, table);
            indexWriter.addIndexes(directory);
            LOG.info("Removing delete markers [{0}] on [{1}/{2}]", directory, shard, table);
            indexWriter.deleteDocuments(new Term(BlurConstants.DELETE_MARKER, BlurConstants.DELETE_MARKER_VALUE));
            LOG.info("Finishing import [{0}], commiting on [{1}/{2}]", directory, shard, table);
            indexWriter.commit();
            indexWriter.maybeMerge();
            LOG.info("Cleaning up old directory [{0}] for [{1}/{2}]", dirPath, shard, table);
            fileSystem.delete(dirPath, true);
View Full Code Here

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

      doc.add(newField("body","body", Field.Store.NO, Field.Index.NOT_ANALYZED));
      writer.addDocument(doc);
    }
   
    writer.optimize();
    writer.deleteDocuments(new Term("id","0"));
    writer.close();

    IndexReader reader = IndexReader.open(dir, true);
    IndexSearcher search = newSearcher(reader);
    assertTrue(reader.hasDeletions());
View Full Code Here

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

    writer.close();
  }
 
  private void deleteDocument() throws IOException {
    IndexWriter writer = new IndexWriter( dir, a, false, MaxFieldLength.LIMITED );
    writer.deleteDocuments( new Term( "t_text1", "del" ) );
    // To see negative idf, keep comment the following line
    //writer.optimize();
    writer.close();
  }
 
View Full Code Here

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

                                      MaxFieldLength.LIMITED);
      for (int i = 0; i < numDeletedDocs; i++) {
        w.addDocument(new Document());
      }
      w.commit();
      w.deleteDocuments( new MatchAllDocsQuery() );
      w.commit();

      if (0 < numDeletedDocs)
        Assert.assertTrue("writer has no deletions", w.hasDeletions());
View Full Code Here

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

      for (int i = 0; i < numDeletedDocs; i++) {
        w.addDocument(new Document());
      }
      w.commit();
      w.deleteDocuments( new MatchAllDocsQuery() );
      _TestUtil.keepFullyDeletedSegments(w);
      w.commit();

      if (0 < numDeletedDocs)
        Assert.assertTrue("writer has no deletions", w.hasDeletions());
View Full Code Here

Examples of org.apache.lucene.index.RandomIndexWriter.deleteDocuments()

    addField(doc, groupField, "a", useDv);
    doc.add(new StringField("airport", "ams", Field.Store.NO));
    w.addDocument(doc);

    w.commit();
    w.deleteDocuments(new TermQuery(new Term("airport", "ams")));

    // 2
    doc = new Document();
    addField(doc, groupField, "a", useDv);
    doc.add(new StringField("airport", "ams", Field.Store.NO));
View Full Code Here

Examples of org.apache.lucene.index.RandomIndexWriter.deleteDocuments()

    // delete some docs
    int numDeletes = numDocs/20;
    for (int i = 0; i < numDeletes; i++) {
      Term toDelete = new Term("id", Integer.toString(random.nextInt(numDocs)));
      if (random.nextBoolean()) {
        iw.deleteDocuments(toDelete);
      } else {
        iw.deleteDocuments(new TermQuery(toDelete));
      }
    }
   
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.