Search in sources :

Example 1 with IndexRangeContainsOneOfStreams

use of org.graylog.plugins.views.search.IndexRangeContainsOneOfStreams in project graylog2-server by Graylog2.

the class MoreSearch method getAffectedIndices.

private Set<String> getAffectedIndices(Set<String> streamIds, TimeRange timeRange) {
    final SortedSet<IndexRange> indexRanges = indexRangeService.find(timeRange.getFrom(), timeRange.getTo());
    // We support an empty streams list and return all affected indices in that case.
    if (streamIds.isEmpty()) {
        return indexRanges.stream().map(IndexRange::indexName).collect(Collectors.toSet());
    } else {
        final Set<Stream> streams = loadStreams(streamIds);
        final IndexRangeContainsOneOfStreams indexRangeContainsOneOfStreams = new IndexRangeContainsOneOfStreams(streams);
        return indexRanges.stream().filter(indexRangeContainsOneOfStreams).map(IndexRange::indexName).collect(Collectors.toSet());
    }
}
Also used : IndexRange(org.graylog2.indexer.ranges.IndexRange) Stream(org.graylog2.plugin.streams.Stream) IndexRangeContainsOneOfStreams(org.graylog.plugins.views.search.IndexRangeContainsOneOfStreams)

Aggregations

IndexRangeContainsOneOfStreams (org.graylog.plugins.views.search.IndexRangeContainsOneOfStreams)1 IndexRange (org.graylog2.indexer.ranges.IndexRange)1 Stream (org.graylog2.plugin.streams.Stream)1