@RequestMapping(value = "/lucene/o_create.do")
 public void create(
     Integer siteId,
     Integer channelId,
     Date startDate,
     Date endDate,
     Integer startId,
     Integer max,
     HttpServletRequest request,
     HttpServletResponse response,
     ModelMap model)
     throws JSONException {
   try {
     Integer lastId =
         luceneContentSvc.createIndex(siteId, channelId, startDate, endDate, startId, max);
     JSONObject json = new JSONObject();
     json.put("success", true);
     if (lastId != null) {
       json.put("lastId", lastId);
     }
     ResponseUtils.renderJson(response, json.toString());
   } catch (CorruptIndexException e) {
     JSONObject json = new JSONObject();
     json.put("success", false).put("msg", e.getMessage());
     ResponseUtils.renderJson(response, json.toString());
     log.error("", e);
   } catch (LockObtainFailedException e) {
     JSONObject json = new JSONObject();
     json.put("success", false).put("msg", e.getMessage());
     ResponseUtils.renderJson(response, json.toString());
     log.error("", e);
   } catch (IOException e) {
     JSONObject json = new JSONObject();
     json.put("success", false).put("msg", e.getMessage());
     ResponseUtils.renderJson(response, json.toString());
     log.error("", e);
   } catch (ParseException e) {
     JSONObject json = new JSONObject();
     json.put("success", false).put("msg", e.getMessage());
     ResponseUtils.renderJson(response, json.toString());
     log.error("", e);
   }
 }
예제 #2
0
  public void commit(String collectionName) {

    IndexWriter indexWriter = indexWriterManager.getIndexWriter(collectionName);

    try {

      logger.info("Commit {}", collectionName);

      indexWriter.commit();

    } catch (CorruptIndexException e) {

      logger.error("error : ", e);
      throw new RuntimeException("색인 중 에러가 발생하였습니다. [" + e.getMessage() + "]");

    } catch (IOException e) {

      logger.error("error : ", e);
      throw new RuntimeException("색인 중 에러가 발생하였습니다. [" + e.getMessage() + "]");
    }
  }