Examples of KeepOnlyLastCommitDeletionPolicy


Examples of org.apache.lucene.index.KeepOnlyLastCommitDeletionPolicy

      Directory dir =
          new FileSystemDirectory(fs, new Path(shards[i].getDirectory()),
              false, conf);
      IndexWriter writer =
          new IndexWriter(dir, false, null,
              new KeepOnlyLastCommitDeletionPolicy());
      writer.close();
    }

    // verify the number of segments, must be done after an writer with
    // KeepOnlyLastCommitDeletionPolicy so that earlier checkpoints are removed
View Full Code Here

Examples of org.apache.lucene.index.KeepOnlyLastCommitDeletionPolicy

  }

  private IndexWriter createWriter() throws IOException {
    IndexWriter writer =
//        new IndexWriter(dir, false, null, new KeepOnlyLastCommitDeletionPolicy());
      new IndexWriter(dir,  null, new KeepOnlyLastCommitDeletionPolicy(), MaxFieldLength.UNLIMITED);
    writer.setUseCompoundFile(true)//use compound file fortmat to speed up;

    if (conf != null) {
      int maxFieldLength = conf.getInt(SenseiJobConfig.MAX_FIELD_LENGTH, -1);
      if (maxFieldLength > 0) {
View Full Code Here

Examples of org.apache.lucene.index.KeepOnlyLastCommitDeletionPolicy

//        new IndexWriter(dir, null,
//            initGeneration < 0 ? new KeepOnlyLastCommitDeletionPolicy() : new MixedDeletionPolicy(),
//                MaxFieldLength.UNLIMITED);

//    writer =  new IndexWriter(dir, null, new KeepOnlyLastCommitDeletionPolicy(), MaxFieldLength.UNLIMITED);
    writer = new IndexWriter(FSDirectory.open(new File(tempDir)), null, new KeepOnlyLastCommitDeletionPolicy(), MaxFieldLength.UNLIMITED);
    setParameters(iconf);
//    dir = null;
//    writer = null;
   
  }
View Full Code Here

Examples of org.apache.lucene.index.KeepOnlyLastCommitDeletionPolicy

    private IndexCommit snapshot;
    private int snapshotUsers;

    MultipleBackupDeletionPolicy()
    {
        super( new KeepOnlyLastCommitDeletionPolicy() );
    }
View Full Code Here

Examples of org.apache.lucene.index.KeepOnlyLastCommitDeletionPolicy

  }

  public void testReuseAcrossWriters() throws Exception {
    Directory dir = new MockRAMDirectory();

    SnapshotDeletionPolicy dp = new SnapshotDeletionPolicy(new KeepOnlyLastCommitDeletionPolicy());
    IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT), dp, IndexWriter.MaxFieldLength.UNLIMITED);
    // Force frequent flushes
    writer.setMaxBufferedDocs(2);
    Document doc = new Document();
    doc.add(new Field("content", "aaa", Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
View Full Code Here

Examples of org.apache.lucene.index.KeepOnlyLastCommitDeletionPolicy

  private void runTest(Directory dir) throws Exception {
    // Run for ~7 seconds
    final long stopTime = System.currentTimeMillis() + 7000;

    SnapshotDeletionPolicy dp = new SnapshotDeletionPolicy(new KeepOnlyLastCommitDeletionPolicy());
    final IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT), dp, IndexWriter.MaxFieldLength.UNLIMITED);

    // Force frequent flushes
    writer.setMaxBufferedDocs(2);
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.