class SearchRunnable implements Runnable {

    private final IndexSearcher indexSearcher;
    private final Query query;
    private final Language language;
    private final PatternRule rule;

    private List<MatchingSentence> matchingSentences;
    private Exception exception;
    private boolean tooManyLuceneMatches;
    private int luceneMatchCount;
    private int maxDocChecked;
    private int docsChecked;
    private int numDocs;

    SearchRunnable(IndexSearcher indexSearcher, Query query, Language language, PatternRule rule) {
      this.indexSearcher = indexSearcher;
      this.query = query;
      this.language = language;
      this.rule = rule;
    }

    @Override
    public void run() {<FILL_FUNCTION_BODY>}

    Exception getException() {
      return exception;
    }

    /**
     * There were more Lucene matches than we can actually check with LanguageTool in
     * an acceptable time, so real matches might be lost.
     */
    boolean hasTooManyLuceneMatches() {
      return tooManyLuceneMatches;
    }

    int getLuceneMatchCount() {
      return luceneMatchCount;
    }

    List<MatchingSentence> getMatchingSentences() {
      return matchingSentences;
    }

    int getMaxDocChecked() {
      return maxDocChecked;
    }
  }

      try {
        long t1 = System.currentTimeMillis();
        JLanguageTool languageTool = getLanguageToolWithOneRule(language, rule);
        long langToolCreationTime = System.currentTimeMillis() - t1;
        long t2 = System.currentTimeMillis();
        PossiblyLimitedTopDocs limitedTopDocs = getTopDocs(query);
        long luceneTime = System.currentTimeMillis() - t2;
        long t3 = System.currentTimeMillis();
        luceneMatchCount = limitedTopDocs.topDocs.totalHits;
        tooManyLuceneMatches = limitedTopDocs.topDocs.scoreDocs.length >= maxHits;
        MatchingSentencesResult res = findMatchingSentences(indexSearcher, limitedTopDocs.topDocs, languageTool);
        matchingSentences = res.matchingSentences;
        maxDocChecked = res.maxDocChecked;
        docsChecked = res.docsChecked;
        numDocs = indexSearcher.getIndexReader().numDocs();
        System.out.println("Check done in " + langToolCreationTime + "/" + luceneTime + "/" + (System.currentTimeMillis() - t3)
            + "ms (LT creation/Lucene/matching) for " + limitedTopDocs.topDocs.scoreDocs.length + " docs");
      } catch (Exception e) {
        exception = e;
      }
    
<no_super_class>