code: @Managed
     @ManagedDescription("Index optimization ")
     public void optimize()
     {
        if (handler instanceof SearchIndex)
        {
           try
           {
              if (isSuspended.get())
              {
                 resume();
  
                 try
                 {
                    ((SearchIndex)handler).getIndex().optimize();
                 }
                 finally
                 {
                    suspend();
                 }
              }
              else
              {
                 ((SearchIndex)handler).getIndex().optimize();
              }
           }
           catch (IOException e)
           {
              LOG.error(e.getMessage(), e);
           }
           catch (ResumeException e)
           {
              LOG.error(e.getMessage(), e);
           }
           catch (SuspendException e)
           {
              LOG.error(e.getMessage(), e);
           }
        }
        else
        {
           LOG.error("This kind of QuerHandler class doesn't support index optimization.");
        }
     }
docs: Public method, designed to be called via JMX. Optimizes lucene index.
  See {@link IndexWriter#forceMerge(int)} for details.