/** * 删除制定索引 * * @param indexName */ @Transactional public void deleteIndex(String indexName) { if (StringUtils.isBlank(indexName)) return; GmIndex index = dao.getByIndexName(indexName); if (index != null) dao.delete(index); }
/** * 保存索引 * * @param indexFile */ @Transactional public void save(String indexName, String clause) { if (!checkIndexValueValid(indexName, clause)) return; GmIndex oldIndex = dao.getByIndexName(indexName); if (oldIndex != null && oldIndex.getIndexClause() != null) { if (oldIndex.getIndexClause().trim().equals(clause.trim())) return; } GmIndex gmIndex = new GmIndex(); gmIndex.setIndexName(indexName); gmIndex.setIndexClause(clause); gmIndex.setUpload_time(new Date()); dao.save(gmIndex); }
/** * 保存索引 * * @param indexFile */ @Transactional public void save(GmIndex gmIndex) { if (!checkIndexValueValid(gmIndex.getIndexName(), gmIndex.getIndexClause())) return; GmIndex oldIndex = dao.getByIndexName(gmIndex.getIndexName()); if (oldIndex != null && oldIndex.getIndexClause() != null && oldIndex.getIndexClause().equals(gmIndex.getIndexClause().trim())) return; if (gmIndex != null) { GmIndex old = dao.getByIndexName(gmIndex.getIndexName()); if (old != null) { dao.save(gmIndex); } } }
public boolean checkIndexExists(String indexName) { boolean result = false; if (dao.getByIndexName(indexName) != null) { result = true; } return result; }
/** * find all index count * * @return */ public int getAllIndexCount() { return dao.findAll().size(); }
/** * 获取所有index索引文件列表 * * @param indexName * @return */ public List<GmIndex> getAllIndexs() { List<GmIndex> indexList = dao.findAll(); return indexList; }
/** 清空表 */ public void deleteAllIndex() { dao.deleteAll(); }