@NotNull
  private Iterable<FoundItemDescriptor<PsiFileSystemItem>> getItemsForNames(@NotNull GlobalSearchScope scope,
                                                                            @NotNull List<? extends MatchResult> matchResults,
                                                                            @NotNull Function<? super String, Object[]> indexResult) {
    List<PsiFileSystemItem> group = new ArrayList<>();
    Map<PsiFileSystemItem, Integer> nesting = new HashMap<>();
    Map<PsiFileSystemItem, Integer> matchDegrees = new HashMap<>();
    for (MatchResult matchResult : matchResults) {
      Object[] items = indexResult.apply(matchResult.elementName);
      ProgressManager.checkCanceled();
      for (Object item : items) {
        if (!(item instanceof PsiFileSystemItem psiItem)) continue;
        if (!scope.contains(psiItem.getVirtualFile())) continue;
        String qualifier = getParentPath(psiItem);
        if (qualifier != null) {
          group.add(psiItem);
          nesting.put(psiItem, StringUtil.countChars(qualifier, '/'));
          matchDegrees.put(psiItem, matchResult.matchingDegree);
        }
      }
    }

    if (group.size() > 1) {
      group.sort(getPathProximityComparator().
        thenComparing(nesting::get).
        thenComparing(myModel::getFullName));
    }
    return ContainerUtil.map(group, item -> new FoundItemDescriptor<>(item, matchDegrees.get(item)));
  }
@NotNull
  private Iterable<FoundItemDescriptor<PsiFileSystemItem>> getItemsForNames(@NotNull GlobalSearchScope scope,
                                                                            @NotNull List<? extends MatchResult> matchResults,
                                                                            @NotNull Function<? super String, Object[]> indexResult)