当前位置: 首页>>代码示例>>Java>>正文


Java IndexDeletionPolicy类代码示例

本文整理汇总了Java中org.apache.lucene.index.IndexDeletionPolicy的典型用法代码示例。如果您正苦于以下问题:Java IndexDeletionPolicy类的具体用法?Java IndexDeletionPolicy怎么用?Java IndexDeletionPolicy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IndexDeletionPolicy类属于org.apache.lucene.index包,在下文中一共展示了IndexDeletionPolicy类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: IndexAndTaxonomyRevision

import org.apache.lucene.index.IndexDeletionPolicy; //导入依赖的package包/类
/**
 * Constructor over the given {@link IndexWriter}. Uses the last
 * {@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;
  this.indexSDP = (SnapshotDeletionPolicy) delPolicy;
  this.taxoSDP = taxoWriter.getDeletionPolicy();
  this.indexCommit = indexSDP.snapshot();
  this.taxoCommit = taxoSDP.snapshot();
  this.version = revisionVersion(indexCommit, taxoCommit);
  this.sourceFiles = revisionFiles(indexCommit, taxoCommit);
}
 
开发者ID:europeana,项目名称:search,代码行数:21,代码来源:IndexAndTaxonomyRevision.java

示例2: test

import org.apache.lucene.index.IndexDeletionPolicy; //导入依赖的package包/类
public void test() throws Exception {

        Directory dir = null;

        IndexDeletionPolicy policy = new KeepOnlyLastCommitDeletionPolicy();
        SnapshotDeletionPolicy snapshotter = new SnapshotDeletionPolicy(policy);
        IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_41,
                AosAnalyser.NO_LIMIT_TOKEN_COUNT_SIMPLE_ANALYSER);
        conf.setIndexDeletionPolicy(snapshotter);
        IndexWriter writer = new IndexWriter(dir, conf);

        try {
            IndexCommit commit = snapshotter.snapshot("unique-id");
            Collection<String> fileNames = commit.getFileNames();
            /* <iterate over & copy files from fileNames> */
        }
        finally {
            snapshotter.release("unique-id");
        }
    }
 
开发者ID:xuzhikethinker,项目名称:t4f-data,代码行数:21,代码来源:SnapshotIndex.java

示例3: configure

import org.apache.lucene.index.IndexDeletionPolicy; //导入依赖的package包/类
@Override
protected void configure() {
    bind(IndexDeletionPolicy.class)
            .annotatedWith(Names.named("actual"))
            .to(KeepOnlyLastDeletionPolicy.class)
            .asEagerSingleton();

    bind(SnapshotDeletionPolicy.class)
            .asEagerSingleton();
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:11,代码来源:DeletionPolicyModule.java

示例4: updateIndex

import org.apache.lucene.index.IndexDeletionPolicy; //导入依赖的package包/类
public void updateIndex(Directory dir, int base, int numDocs,
    IndexDeletionPolicy policy) throws IOException {
  IndexWriter writer =
      new IndexWriter(dir, false, new StandardAnalyzer(), policy);
  writer.setMaxBufferedDocs(maxBufferedDocs);
  writer.setMergeFactor(1000);
  for (int i = 0; i < numDocs; i++) {
    addDoc(writer, base + i);
  }
  writer.close();
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:12,代码来源:TestMixedDirectory.java

示例5: getIndexDeletionPolicy

import org.apache.lucene.index.IndexDeletionPolicy; //导入依赖的package包/类
public static IndexDeletionPolicy getIndexDeletionPolicy(Config config) {
  String deletionPolicyName = config.get("deletion.policy", "org.apache.lucene.index.KeepOnlyLastCommitDeletionPolicy");
  if (deletionPolicyName.equals(NoDeletionPolicy.class.getName())) {
    return NoDeletionPolicy.INSTANCE;
  } else {
    try {
      return Class.forName(deletionPolicyName).asSubclass(IndexDeletionPolicy.class).newInstance();
    } catch (Exception e) {
      throw new RuntimeException("unable to instantiate class '" + deletionPolicyName + "' as IndexDeletionPolicy", e);
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:13,代码来源:CreateIndexTask.java

示例6: IndexRevision

import org.apache.lucene.index.IndexDeletionPolicy; //导入依赖的package包/类
/**
 * 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;
  this.commit = sdp.snapshot();
  this.version = revisionVersion(commit);
  this.sourceFiles = revisionFiles(commit);
}
 
开发者ID:europeana,项目名称:search,代码行数:17,代码来源:IndexRevision.java

示例7: SolrIndexWriter

import org.apache.lucene.index.IndexDeletionPolicy; //导入依赖的package包/类
private SolrIndexWriter(String name, String path, Directory directory, boolean create, IndexSchema schema, SolrIndexConfig config, IndexDeletionPolicy delPolicy, Codec codec) throws IOException {
  super(directory,
        config.toIndexWriterConfig(schema).
        setOpenMode(create ? IndexWriterConfig.OpenMode.CREATE : IndexWriterConfig.OpenMode.APPEND).
        setIndexDeletionPolicy(delPolicy).setCodec(codec)
        );
  log.debug("Opened Writer " + name);
  this.name = name;
  infoStream = getConfig().getInfoStream();
  this.directory = directory;
  numOpens.incrementAndGet();
}
 
开发者ID:europeana,项目名称:search,代码行数:13,代码来源:SolrIndexWriter.java

示例8: initDeletionPolicy

import org.apache.lucene.index.IndexDeletionPolicy; //导入依赖的package包/类
private void initDeletionPolicy() {
  PluginInfo info = solrConfig.getPluginInfo(IndexDeletionPolicy.class.getName());
  IndexDeletionPolicy delPolicy = null;
  if(info != null){
    delPolicy = createInstance(info.className,IndexDeletionPolicy.class,"Deletion Policy for SOLR");
    if (delPolicy instanceof NamedListInitializedPlugin) {
      ((NamedListInitializedPlugin) delPolicy).init(info.initArgs);
    }
  } else {
    delPolicy = new SolrDeletionPolicy();
  }     
  solrDelPolicy = new IndexDeletionPolicyWrapper(delPolicy);
}
 
开发者ID:europeana,项目名称:search,代码行数:14,代码来源:SolrCore.java

示例9: SolrIndexWriter

import org.apache.lucene.index.IndexDeletionPolicy; //导入依赖的package包/类
private SolrIndexWriter(String name, String path, Directory directory, boolean create, IndexSchema schema, SolrIndexConfig config, IndexDeletionPolicy delPolicy, Codec codec) throws IOException {
  super(directory,
        config.toIndexWriterConfig(schema).
        setOpenMode(create ? IndexWriterConfig.OpenMode.CREATE : IndexWriterConfig.OpenMode.APPEND).
        setIndexDeletionPolicy(delPolicy).setCodec(codec).setInfoStream(toInfoStream(config))
        );
  log.debug("Opened Writer " + name);
  this.name = name;
  numOpens.incrementAndGet();
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:11,代码来源:SolrIndexWriter.java

示例10: initDeletionPolicy

import org.apache.lucene.index.IndexDeletionPolicy; //导入依赖的package包/类
private void initDeletionPolicy() {
	PluginInfo info = solrConfig.getPluginInfo(IndexDeletionPolicy.class.getName());
	IndexDeletionPolicy delPolicy = null;
	if(info != null) {
		delPolicy = createInstance(info.className, IndexDeletionPolicy.class, "Deletion Policy for SOLR");
		if(delPolicy instanceof NamedListInitializedPlugin) {
			((NamedListInitializedPlugin) delPolicy).init(info.initArgs);
		}
	} else {
		delPolicy = new SolrDeletionPolicy();
	}
	solrDelPolicy = new IndexDeletionPolicyWrapper(delPolicy);
}
 
开发者ID:netboynb,项目名称:search-core,代码行数:14,代码来源:SolrCore.java

示例11: SolrIndexWriter

import org.apache.lucene.index.IndexDeletionPolicy; //导入依赖的package包/类
private SolrIndexWriter(String name, String path, Directory directory, boolean create, IndexSchema schema, SolrIndexConfig config, IndexDeletionPolicy delPolicy, Codec codec) throws IOException {
  super(directory,
        config.toIndexWriterConfig(schema).
        setOpenMode(create ? IndexWriterConfig.OpenMode.CREATE : IndexWriterConfig.OpenMode.APPEND).
        setIndexDeletionPolicy(delPolicy).setCodec(codec)
        );
  log.debug("Opened Writer " + name);
  this.name = name;
  numOpens.incrementAndGet();
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:11,代码来源:SolrIndexWriter.java

示例12: SnapshotDeletionPolicy

import org.apache.lucene.index.IndexDeletionPolicy; //导入依赖的package包/类
/**
 * Constructs a new snapshot deletion policy that wraps the provided deletion policy.
 */
@Inject
public SnapshotDeletionPolicy(@Named("actual") IndexDeletionPolicy primary) {
    super(((IndexShardComponent) primary).shardId(), ((IndexShardComponent) primary).indexSettings());
    this.primary = primary;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:9,代码来源:SnapshotDeletionPolicy.java

示例13: clone

import org.apache.lucene.index.IndexDeletionPolicy; //导入依赖的package包/类
@Override
public IndexDeletionPolicy clone() {
   // Lucene IW makes a clone internally but since we hold on to this instance 
   // the clone will just be the identity. See InternalEngine recovery why we need this.
   return this;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:7,代码来源:SnapshotDeletionPolicy.java

示例14: IndexDeletionPolicyWrapper

import org.apache.lucene.index.IndexDeletionPolicy; //导入依赖的package包/类
public IndexDeletionPolicyWrapper(IndexDeletionPolicy deletionPolicy) {
  this.deletionPolicy = deletionPolicy;
}
 
开发者ID:europeana,项目名称:search,代码行数:4,代码来源:IndexDeletionPolicyWrapper.java


注:本文中的org.apache.lucene.index.IndexDeletionPolicy类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。