@Override
  public void init(IControllerContext context) {
    super.init(context);

    if (dontHighlightPattern != null) {
      dontHighlightPatternCompiled = Pattern.compile(dontHighlightPattern);
    }

    if (querySanitizePattern != null) {
      querySanitizePatternCompiled = Pattern.compile(querySanitizePattern);
    }
  }
  @SuppressWarnings("unchecked")
  @Override
  public void init(IControllerContext context) {
    super.init(context);
    this.context = context;

    synchronized (context) {
      final String key = AttributeUtils.getKey(getClass(), "openIndexes");
      if (context.getAttribute(key) == null) {
        context.setAttribute(key, Maps.newIdentityHashMap());
        context.addListener(
            new IControllerContextListener() {
              public void beforeDisposal(IControllerContext context) {
                closeAllIndexes();
              }
            });
      }

      this.openIndexes = (IdentityHashMap<Directory, IndexSearcher>) context.getAttribute(key);
    }
  }
 /** Memory cleanups. */
 @Override
 public void afterProcessing() {
   super.afterProcessing();
   this.context = null;
   this.sb = null;
 }