...
|
...
|
@@ -3,6 +3,7 @@ package com.yohomars.search.index.service.impl; |
|
|
|
|
|
import com.yoho.search.dal.model.SearchParam;
|
|
|
import com.yoho.search.dal.model.SearchResult;
|
|
|
import com.yoho.tools.common.redis.RedisValueHelper;
|
|
|
import com.yohomars.search.es.IElasticsearchClient;
|
|
|
import com.yohomars.search.index.builder.IIndexBuilder;
|
|
|
import com.yohomars.search.index.config.ClientConfig;
|
...
|
...
|
@@ -15,6 +16,8 @@ import com.yohomars.search.index.model.IYohoIndex; |
|
|
import com.yohomars.search.index.model.impl.YohoIndexImpl;
|
|
|
import com.yohomars.search.index.service.IYohoIndexService;
|
|
|
import com.yohomars.search.utils.FileUtils;
|
|
|
import com.yohomars.search.utils.ISearchConstans;
|
|
|
import com.yohomars.search.utils.Index;
|
|
|
import com.yohomars.search.utils.JaxbBinder;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.elasticsearch.action.admin.indices.analyze.AnalyzeResponse;
|
...
|
...
|
@@ -36,6 +39,7 @@ import java.util.List; |
|
|
import java.util.Map;
|
|
|
import java.util.Set;
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
@Component
|
...
|
...
|
@@ -52,7 +56,8 @@ public class YohoIndexServiceImpl implements IYohoIndexService { |
|
|
@Autowired
|
|
|
private YohoIndexDataLoader yohoIndexDataLoader;
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
private RedisValueHelper redisValueHelper;
|
|
|
|
|
|
// 索引配置文件
|
|
|
private String configFile = "index.xml";
|
...
|
...
|
@@ -336,8 +341,7 @@ public class YohoIndexServiceImpl implements IYohoIndexService { |
|
|
String yohoTemplateIndexName = yohoIndexHelper.genTempIndexName(yohoIndexName);
|
|
|
|
|
|
// 3、创建临时索引
|
|
|
INDEX_REBUILD_LOG.info("rebuild [{}],step=[3.createTempIndex begin],mappingContent=[{}],setting=[{}],properties=[{}]", yohoIndexName, yohoIndex.getMappingContent(),
|
|
|
yohoIndex.getProperties());
|
|
|
INDEX_REBUILD_LOG.info("rebuild [{}],step=[3.createTempIndex begin],mappingContent=[{}],setting=[{}],properties=[{}]", yohoIndexName, yohoIndex.getMappingContent(), yohoIndex.getProperties());
|
|
|
String tempIndexRealName = this.createIndex(yohoIndexName, yohoTemplateIndexName, false);
|
|
|
INDEX_REBUILD_LOG.info("rebuild [{}],step=[3.createTempIndex success],tempIndexRealName=[{}],", yohoIndexName, tempIndexRealName);
|
|
|
|
...
|
...
|
@@ -375,6 +379,10 @@ public class YohoIndexServiceImpl implements IYohoIndexService { |
|
|
} catch (Exception e) {
|
|
|
INDEX_REBUILD_LOG.error(e.getMessage(), e);
|
|
|
} finally {
|
|
|
if(Index.social_user.getIndexName().equals(yohoIndexName)){
|
|
|
String key = ISearchConstans.LastUpdateTimeRedisKey.socialUser.getKey();
|
|
|
redisValueHelper.set(key,System.currentTimeMillis(),1, TimeUnit.DAYS);
|
|
|
}
|
|
|
rebuildFlagService.updateBuilding(false);
|
|
|
}
|
|
|
}
|
...
|
...
|
|