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


Java IndexCommit.getGeneration方法代码示例

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


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

示例1: getIndexVersion

import org.apache.lucene.index.IndexCommit; //导入方法依赖的package包/类
private long[] getIndexVersion() {
  long version[] = new long[2];
  RefCounted<SolrIndexSearcher> searcher = core.getSearcher();
  try {
    final IndexCommit commit = searcher.get().getIndexReader().getIndexCommit();
    final Map<String,String> commitData = commit.getUserData();
    String commitTime = commitData.get(SolrIndexWriter.COMMIT_TIME_MSEC_KEY);
    if (commitTime != null) {
      version[0] = Long.parseLong(commitTime);
    }
    version[1] = commit.getGeneration();
  } catch (IOException e) {
    LOG.warn("Unable to get index version : ", e);
  } finally {
    searcher.decref();
  }
  return version;
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:19,代码来源:ReplicationHandler.java

示例2: onCommit

import org.apache.lucene.index.IndexCommit; //导入方法依赖的package包/类
@Override
public void onCommit(List<? extends IndexCommit> commits) throws IOException {
  _writeLock.lock();
  try {
    int size = commits.size();
    for (int i = 0; i < size - 1; i++) {
      IndexCommit indexCommit = commits.get(i);
      long generation = indexCommit.getGeneration();
      if (!_generationsToNames.containsKey(generation)) {
        indexCommit.delete();
      }
    }
  } finally {
    _writeLock.unlock();
  }
}
 
开发者ID:apache,项目名称:incubator-blur,代码行数:17,代码来源:SnapshotIndexDeletionPolicy.java

示例3: createSnapshot

import org.apache.lucene.index.IndexCommit; //导入方法依赖的package包/类
public void createSnapshot(String name, DirectoryReader reader, String context) throws IOException {
  _writeLock.lock();
  try {
    if (_namesToGenerations.containsKey(name)) {
      throw new IOException("Snapshot [" + name + "] already exists.");
    }
    LOG.info("Creating snapshot [{0}] in [{1}].", name, context);
    IndexCommit indexCommit = reader.getIndexCommit();
    long generation = indexCommit.getGeneration();
    _namesToGenerations.put(name, generation);
    Set<String> names = _generationsToNames.get(generation);
    if (names == null) {
      names = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>());
      _generationsToNames.put(generation, names);
    }
    names.add(name);
    storeGenerations();
  } finally {
    _writeLock.unlock();
  }
}
 
开发者ID:apache,项目名称:incubator-blur,代码行数:22,代码来源:SnapshotIndexDeletionPolicy.java

示例4: findIndexCommit

import org.apache.lucene.index.IndexCommit; //导入方法依赖的package包/类
private IndexCommit findIndexCommit(List<IndexCommit> listCommits, long generation) throws IOException {
  for (IndexCommit commit : listCommits) {
    if (commit.getGeneration() == generation) {
      return commit;
    }
  }
  throw new IOException("Generation [" + generation + "] not found.");
}
 
开发者ID:apache,项目名称:incubator-blur,代码行数:9,代码来源:MergeSortRowIdMatcher.java

示例5: findIndexCommit

import org.apache.lucene.index.IndexCommit; //导入方法依赖的package包/类
public static IndexCommit findIndexCommit(List<IndexCommit> listCommits, long generation, Path shardDir)
    throws IOException {
  for (IndexCommit commit : listCommits) {
    if (commit.getGeneration() == generation) {
      return commit;
    }
  }
  throw new IOException("Generation [" + generation + "] not found in shard [" + shardDir + "]");
}
 
开发者ID:apache,项目名称:incubator-blur,代码行数:10,代码来源:ExistingDataIndexLookupMapper.java

示例6: findIndexCommit

import org.apache.lucene.index.IndexCommit; //导入方法依赖的package包/类
private static IndexCommit findIndexCommit(List<IndexCommit> listCommits, long generation, Path shardDir)
    throws IOException {
  for (IndexCommit commit : listCommits) {
    if (commit.getGeneration() == generation) {
      return commit;
    }
  }
  throw new IOException("Generation [" + generation + "] not found in shard [" + shardDir + "]");
}
 
开发者ID:apache,项目名称:incubator-blur,代码行数:10,代码来源:BlurInputFormat.java

示例7: isStillInUse

import org.apache.lucene.index.IndexCommit; //导入方法依赖的package包/类
private boolean isStillInUse(IndexCommit commit) {
  long generation = commit.getGeneration();
  return _gens.contains(generation);
}
 
开发者ID:apache,项目名称:incubator-blur,代码行数:5,代码来源:IndexDeletionPolicyReader.java


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