Examples of IndexDeletionPolicy


Examples of org.apache.lucene.index.IndexDeletionPolicy

   * {@link IndexCommit} found in the {@link Directory} managed by the given
   * writer.
   */
  public IndexAndTaxonomyRevision(IndexWriter indexWriter, SnapshotDirectoryTaxonomyWriter taxoWriter)
      throws IOException {
    IndexDeletionPolicy delPolicy = indexWriter.getConfig().getIndexDeletionPolicy();
    if (!(delPolicy instanceof SnapshotDeletionPolicy)) {
      throw new IllegalArgumentException("IndexWriter must be created with SnapshotDeletionPolicy");
    }
    this.indexWriter = indexWriter;
    this.taxoWriter = taxoWriter;
View Full Code Here

Examples of org.apache.lucene.index.IndexDeletionPolicy

            indexWriter.close();
            log.debug("closing IndexWriter.");
            indexWriter = null;
        }
        if (indexReader == null) {
            IndexDeletionPolicy idp = getIndexDeletionPolicy();
            IndexReader reader = IndexReader.open(getDirectory(), idp, false, termInfosIndexDivisor);
            indexReader = new CommittableIndexReader(reader);
        }
        return indexReader;
    }
View Full Code Here

Examples of org.apache.lucene.index.IndexDeletionPolicy

      // if we only want to replicate on optimize, we need the deletion policy to
      // save the last optimized commit point.
      if (replicateOnOptimize && !replicateOnCommit) {
        IndexDeletionPolicyWrapper wrapper = core.getDeletionPolicy();
        IndexDeletionPolicy policy = wrapper == null ? null : wrapper.getWrappedDeletionPolicy();
        if (policy instanceof SolrDeletionPolicy) {
          SolrDeletionPolicy solrPolicy = (SolrDeletionPolicy)policy;
          if (solrPolicy.getMaxOptimizedCommitsToKeep() < 1) {
            solrPolicy.setMaxOptimizedCommitsToKeep(1);
          }
View Full Code Here

Examples of org.apache.lucene.index.IndexDeletionPolicy

 
  public static IndexWriterConfig createWriterConfig(Config config, PerfRunData runData, OpenMode mode, IndexCommit commit) {
    Version version = Version.valueOf(config.get("writer.version", Version.LUCENE_40.toString()));
    IndexWriterConfig iwConf = new IndexWriterConfig(version, runData.getAnalyzer());
    iwConf.setOpenMode(mode);
    IndexDeletionPolicy indexDeletionPolicy = getIndexDeletionPolicy(config);
    iwConf.setIndexDeletionPolicy(indexDeletionPolicy);
    if(commit != null)
      iwConf.setIndexCommit(commit);
   
View Full Code Here

Examples of org.apache.lucene.index.IndexDeletionPolicy

    Config config = getRunData().getConfig();
    IndexReader r = null;
    if (commitUserData != null) {
      r = openCommitPoint(commitUserData, dir, config, readOnly);
    } else {
      IndexDeletionPolicy indexDeletionPolicy = CreateIndexTask.getIndexDeletionPolicy(config);
      r = IndexReader.open(dir, indexDeletionPolicy, readOnly);
    }
    getRunData().setIndexReader(r);
    return 1;
  }
View Full Code Here

Examples of org.apache.lucene.index.IndexDeletionPolicy

      String ud = null;
      if (map != null) {
        ud = (String)map.get(USER_DATA);
      }
      if (ud != null && ud.equals(userData)) {
        IndexDeletionPolicy indexDeletionPolicy = CreateIndexTask.getIndexDeletionPolicy(config);
        r = IndexReader.open(ic, indexDeletionPolicy, readOnly);
        break;
      }
    }
    if (r == null) throw new IOException("cannot find commitPoint userData:"+userData);
View Full Code Here

Examples of org.apache.lucene.index.IndexDeletionPolicy

    }
  }
 
  public static IndexDeletionPolicy getIndexDeletionPolicy(Config config) {
    String deletionPolicyName = config.get("deletion.policy", "org.apache.lucene.index.KeepOnlyLastCommitDeletionPolicy");
    IndexDeletionPolicy indexDeletionPolicy = null;
    RuntimeException err = null;
    try {
      indexDeletionPolicy = ((IndexDeletionPolicy) Class.forName(deletionPolicyName).newInstance());
    } catch (IllegalAccessException iae) {
      err = new RuntimeException("unable to instantiate class '" + deletionPolicyName + "' as IndexDeletionPolicy");
View Full Code Here

Examples of org.apache.lucene.index.IndexDeletionPolicy

 
  public int doLogic() throws IOException {
    PerfRunData runData = getRunData();
    Config config = runData.getConfig();
   
    IndexDeletionPolicy indexDeletionPolicy = getIndexDeletionPolicy(config);
   
    IndexWriter writer = new IndexWriter(runData.getDirectory(),
                                         runData.getConfig().get("autocommit", OpenIndexTask.DEFAULT_AUTO_COMMIT),
                                         runData.getAnalyzer(),
                                         true, indexDeletionPolicy);
View Full Code Here

Examples of org.apache.lucene.index.IndexDeletionPolicy

   * {@link IndexCommit} found in the {@link Directory} managed by the given
   * writer.
   */
  public IndexAndTaxonomyRevision(IndexWriter indexWriter, SnapshotDirectoryTaxonomyWriter taxoWriter)
      throws IOException {
    IndexDeletionPolicy delPolicy = indexWriter.getConfig().getIndexDeletionPolicy();
    if (!(delPolicy instanceof SnapshotDeletionPolicy)) {
      throw new IllegalArgumentException("IndexWriter must be created with SnapshotDeletionPolicy");
    }
    this.indexWriter = indexWriter;
    this.taxoWriter = taxoWriter;
View Full Code Here

Examples of org.apache.lucene.index.IndexDeletionPolicy

   * Constructor over the given {@link IndexWriter}. Uses the last
   * {@link IndexCommit} found in the {@link Directory} managed by the given
   * writer.
   */
  public IndexRevision(IndexWriter writer) throws IOException {
    IndexDeletionPolicy delPolicy = writer.getConfig().getIndexDeletionPolicy();
    if (!(delPolicy instanceof SnapshotDeletionPolicy)) {
      throw new IllegalArgumentException("IndexWriter must be created with SnapshotDeletionPolicy");
    }
    this.writer = writer;
    this.sdp = (SnapshotDeletionPolicy) delPolicy;
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.