org.apache.lucene.index.MergeTrigger Java Examples

The following examples show how to use org.apache.lucene.index.MergeTrigger. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SegmentsInfoRequestHandler.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
private SimpleOrderedMap<Object> getMergeInformation(SolrQueryRequest req, SegmentInfos infos, List<String> mergeCandidates) throws IOException {
  SimpleOrderedMap<Object> result = new SimpleOrderedMap<>();
  RefCounted<IndexWriter> refCounted = req.getCore().getSolrCoreState().getIndexWriter(req.getCore());
  try {
    IndexWriter indexWriter = refCounted.get();
    if (indexWriter instanceof SolrIndexWriter) {
      result.addAll(((SolrIndexWriter)indexWriter).getRunningMerges());
    }
    //get chosen merge policy
    MergePolicy mp = indexWriter.getConfig().getMergePolicy();
    //Find merges
    MergeSpecification findMerges = mp.findMerges(MergeTrigger.EXPLICIT, infos, indexWriter);
    if (findMerges != null && findMerges.merges != null && findMerges.merges.size() > 0) {
      for (OneMerge merge : findMerges.merges) {
        //TODO: add merge grouping
        for (SegmentCommitInfo mergeSegmentInfo : merge.segments) {
          mergeCandidates.add(mergeSegmentInfo.info.name);
        }
      }
    }

    return result;
  } finally {
    refCounted.decref();
  }
}
 
Example #2
Source File: ElasticsearchMergePolicy.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public MergeSpecification findMerges(MergeTrigger mergeTrigger,
    SegmentInfos segmentInfos, IndexWriter writer) throws IOException {
    return upgradedMergeSpecification(delegate.findMerges(mergeTrigger, segmentInfos, writer));
}
 
Example #3
Source File: SortingMergePolicyDecorator.java    From linden with Apache License 2.0 4 votes vote down vote up
@Override
public MergeSpecification findMerges(MergeTrigger mergeTrigger, SegmentInfos segmentInfos,
                                     IndexWriter writer) throws IOException {
  return sortingMergePolicy.findMerges(mergeTrigger, segmentInfos, writer);
}