public SearcherResult findRuleMatchesOnIndex(PatternRule rule, Language language) throws IOException, UnsupportedPatternRuleException {
// it seems wasteful to re-open the index every time, but I had strange problems (OOM, Array out of bounds, ...)
// when not doing so...
open();
try {
final PatternRuleQueryBuilder patternRuleQueryBuilder = new PatternRuleQueryBuilder(language);
final Query query = patternRuleQueryBuilder.buildRelaxedQuery(rule);
if (query == null) {
throw new NullPointerException("Cannot search on null query for rule: " + rule.getId());
}
final SearchRunnable runnable = new SearchRunnable(indexSearcher, query, language, rule);