View Javadoc
1   package com.acumenvelocity.ath.solr;
2   
3   import java.util.List;
4   import java.util.Map;
5   
6   import com.acumenvelocity.ath.common.Const;
7   
8   public class AthIndex {
9     private static Solr solr;
10  
11    public static void init() throws Exception {
12      solr = new Solr();
13      solr.ping(Const.SOLR_CORE_ATH_DOC_SEGMENTS);
14      solr.ping(Const.SOLR_CORE_ATH_TM_SEGMENTS);
15    }
16  
17    public static void done() throws Exception {
18      solr.close();
19    }
20  
21    public static Solr getIndex() {
22      return solr;
23    }
24  
25    public static Solr getSolr() {
26      return solr;
27    }
28  
29    public static void createOne(String coreName, Map<String, Object> doc) throws Exception {
30      solr.createOne(coreName, doc);
31    }
32  
33    public static long createMany(String coreName, List<Map<String, Object>> docs) throws Exception {
34      return solr.createMany(coreName, docs);
35    }
36  
37    public static void deleteById(String coreName, String id) throws Exception {
38      solr.deleteById(coreName, id);
39    }
40  
41    public static void deleteByIds(String coreName, List<String> ids) throws Exception {
42      solr.deleteByIds(coreName, ids);
43    }
44  
45    public static void deleteByQuery(String coreName, String query) throws Exception {
46      solr.deleteByQuery(coreName, query);
47    }
48  
49    public static <Response> Response getMany(String coreName, String query,
50        Map<String, Object> queryParams, Class<Response> responseClass) throws Exception {
51      return solr.getMany(coreName, query, queryParams, responseClass);
52    }
53  
54  }