@Override
  public boolean process(SearchContext searchContext, Hits hits) throws SearchException {

    QueryConfig queryConfig = searchContext.getQueryConfig();

    if (!queryConfig.isCollatedSpellCheckResultEnabled()) {
      return true;
    }

    int collatedSpellCheckResultScoresThreshold =
        queryConfig.getCollatedSpellCheckResultScoresThreshold();

    if (hits.getLength() >= collatedSpellCheckResultScoresThreshold) {
      return true;
    }

    String collatedKeywords = SearchEngineUtil.spellCheckKeywords(searchContext);

    if (collatedKeywords.equals(searchContext.getKeywords())) {
      collatedKeywords = StringPool.BLANK;
    }

    hits.setCollatedSpellCheckResult(collatedKeywords);

    return true;
  }