View Javadoc

1   package org.kuali.ole.docstore.discovery.service;
2   
3   import org.apache.solr.client.solrj.SolrServer;
4   
5   /**
6    * User: tirumalesh.b
7    * Date: 23/12/11 Time: 12:09 PM
8    */
9   public class AdminServiceImpl implements AdminService {
10      private static AdminServiceImpl adminService = null;
11  
12      private AdminServiceImpl() {
13      }
14  
15      public static AdminService getInstance() {
16          if (null == adminService) {
17              adminService = new AdminServiceImpl();
18          }
19          return adminService;
20      }
21  
22      @Override
23      public void optimize(String indexName) throws Exception {
24          SolrServer solr = SolrServerManager.getInstance().getSolrServer(indexName, false, false);
25          solr.optimize();
26      }
27  
28      @Override
29      public void optimize() throws Exception {
30          SolrServer solr = SolrServerManager.getInstance().getSolrServer();
31          solr.optimize();
32          // TODO: Handle other cores also, if any.
33      }
34  
35       @Override
36      public void optimize(Boolean waitFlush,Boolean waitSearcher) throws Exception {
37          SolrServer solr = SolrServerManager.getInstance().getSolrServer();
38          solr.optimize(false,false);
39      }
40  }