SearchResult (@NotNull DataContext dataContext, @NotNull List<RunAnythingItem> model, @NotNull String pattern, int itemsToInsert) { ProgressManager.checkCanceled(); SearchResult result = new SearchResult(); for (RunAnythingItem item : getGroupItems(dataContext, pattern)) { Matcher matcher = getMatcher(dataContext, pattern); if (matcher == null) { matcher = RUN_ANYTHING_MATCHER_BUILDER.fun(pattern).build(); } if (!model.contains(item) && matcher.matches(item.getCommand())) { if (result.size() == itemsToInsert) { result.setNeedMore(true); break; } result.add(item); } ProgressManager.checkCanceled(); } return result; }