Search in sources :

Example 1 with LuceneListIndexFunction

use of org.apache.geode.cache.lucene.internal.cli.functions.LuceneListIndexFunction in project geode by apache.

the class LuceneIndexCommands method getIndexListing.

@SuppressWarnings("unchecked")
protected List<LuceneIndexDetails> getIndexListing() {
    final Execution functionExecutor = getMembersFunctionExecutor(getMembers(getCache()));
    if (functionExecutor instanceof AbstractExecution) {
        ((AbstractExecution) functionExecutor).setIgnoreDepartedMembers(true);
    }
    final ResultCollector resultsCollector = functionExecutor.execute(new LuceneListIndexFunction());
    final List<Set<LuceneIndexDetails>> results = (List<Set<LuceneIndexDetails>>) resultsCollector.getResult();
    List<LuceneIndexDetails> sortedResults = results.stream().flatMap(set -> set.stream()).sorted().collect(Collectors.toList());
    LinkedHashSet<LuceneIndexDetails> uniqResults = new LinkedHashSet<>();
    uniqResults.addAll(sortedResults);
    sortedResults.clear();
    sortedResults.addAll(uniqResults);
    return sortedResults;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) AbstractExecution(org.apache.geode.internal.cache.execute.AbstractExecution) Execution(org.apache.geode.cache.execute.Execution) AbstractExecution(org.apache.geode.internal.cache.execute.AbstractExecution) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet) Set(java.util.Set) LuceneListIndexFunction(org.apache.geode.cache.lucene.internal.cli.functions.LuceneListIndexFunction) ArrayList(java.util.ArrayList) List(java.util.List) ResultCollector(org.apache.geode.cache.execute.ResultCollector)

Aggregations

ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 List (java.util.List)1 Set (java.util.Set)1 Execution (org.apache.geode.cache.execute.Execution)1 ResultCollector (org.apache.geode.cache.execute.ResultCollector)1 LuceneListIndexFunction (org.apache.geode.cache.lucene.internal.cli.functions.LuceneListIndexFunction)1 AbstractExecution (org.apache.geode.internal.cache.execute.AbstractExecution)1