Authored by wangnan

自动客服 fix

  1 +package com.yoho.search.consumer.index.fullbuild;
  2 +
  3 +import com.yoho.search.consumer.index.common.IIndexBuilder;
  4 +import com.yoho.search.consumer.service.daoService.RobotQuestionService;
  5 +import com.yoho.search.dal.model.RobotQuestion;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Component;
  8 +
  9 +import java.util.List;
  10 +
  11 +/**
  12 + * Created by wangnan on 2016/11/29.
  13 + */
  14 +@Component
  15 +public class RobotQuestionOldIndexBuilder extends IIndexBuilder {
  16 +
  17 + @Autowired
  18 + private RobotQuestionService robotQuestionService;
  19 +
  20 + @Override
  21 + public int getTotalCount() throws Exception {
  22 + return robotQuestionService.count();
  23 + }
  24 +
  25 + @Override
  26 + public List<?> getPageLists(int offset, int limit) throws Exception {
  27 + return robotQuestionService.getSizePageLists(offset, limit);
  28 + }
  29 +
  30 + @Override
  31 + public String getId(Object object) {
  32 + return ((RobotQuestion) object).getId().toString();
  33 + }
  34 +
  35 +}
@@ -59,6 +59,7 @@ public class IndexRebuildJob implements ApplicationEventPublisherAware { @@ -59,6 +59,7 @@ public class IndexRebuildJob implements ApplicationEventPublisherAware {
59 this.rebuildIndexWithlog(ISearchConstants.INDEX_NAME_STYLE); 59 this.rebuildIndexWithlog(ISearchConstants.INDEX_NAME_STYLE);
60 this.rebuildIndexWithlog(ISearchConstants.INDEX_NAME_STANDARD); 60 this.rebuildIndexWithlog(ISearchConstants.INDEX_NAME_STANDARD);
61 this.rebuildIndexWithlog(ISearchConstants.INDEX_NAME_ROBOTQUESTION); 61 this.rebuildIndexWithlog(ISearchConstants.INDEX_NAME_ROBOTQUESTION);
  62 + this.rebuildIndexWithlog(ISearchConstants.INDEX_NAME_ROBOTQUESTION_OLD);
62 this.rebuildIndexWithlog(ISearchConstants.INDEX_NAME_PRODUCT_PRICE_PLAN); 63 this.rebuildIndexWithlog(ISearchConstants.INDEX_NAME_PRODUCT_PRICE_PLAN);
63 this.rebuildIndexWithlog(ISearchConstants.INDEX_NAME_HELPER); 64 this.rebuildIndexWithlog(ISearchConstants.INDEX_NAME_HELPER);
64 this.rebuildIndexWithlog(ISearchConstants.INDEX_NAME_SHOPS); 65 this.rebuildIndexWithlog(ISearchConstants.INDEX_NAME_SHOPS);
  1 +
  2 +index.analysis.analyzer.default.type: keyword
  1 +{
  2 + "robotquestionold": {
  3 + "_all":{
  4 + "enabled":false
  5 + },
  6 + "_source":{
  7 + "enabled":true
  8 + },
  9 + "properties": {
  10 + "id": {
  11 + "type": "integer"
  12 + },
  13 + "maxSortId": {
  14 + "type": "integer"
  15 + },
  16 + "middleSortId": {
  17 + "type": "integer"
  18 + },
  19 + "smallSortId": {
  20 + "type": "integer"
  21 + },
  22 + "question": {
  23 + "type": "text",
  24 + "analyzer": "ik_max_word"
  25 + },
  26 + "keywords": {
  27 + "type": "text",
  28 + "analyzer": "ik_max_word"
  29 + },
  30 + "pid": {
  31 + "type": "integer"
  32 + },
  33 + "createTime": {
  34 + "type": "integer"
  35 + },
  36 + "isDisable": {
  37 + "type": "integer"
  38 + },
  39 + "effectTime": {
  40 + "type": "integer"
  41 + },
  42 + "updatePid": {
  43 + "type": "integer"
  44 + },
  45 + "updateTime": {
  46 + "type": "integer"
  47 + },
  48 + "questionSeq": {
  49 + "type": "integer"
  50 + },
  51 + "clickTimes": {
  52 + "type": "integer"
  53 + },
  54 + "answer": {
  55 + "type": "text",
  56 + "index": "no"
  57 + }
  58 + }
  59 + }
  60 +}
@@ -153,6 +153,19 @@ @@ -153,6 +153,19 @@
153 </index> 153 </index>
154 154
155 <index> 155 <index>
  156 + <name>robotquestionold</name>
  157 + <properties>
  158 + <property key="number_of_shards" value="1"/>
  159 + <property key="number_of_replicas" value="1"/>
  160 + <property key="refresh_interval" value="10s"/>
  161 + <property key="translog.flush_threshold_size" value="100mb"/>
  162 + </properties>
  163 + <builderClass>com.yoho.search.consumer.index.fullbuild.RobotQuestionOldIndexBuilder</builderClass>
  164 + <mappingFile>esmapping/robotquestionold.json</mappingFile>
  165 + <analysisFile>analysis/robotquestionold.yml</analysisFile>
  166 + </index>
  167 +
  168 + <index>
156 <name>shops</name> 169 <name>shops</name>
157 <properties> 170 <properties>
158 <property key="number_of_shards" value="1"/> 171 <property key="number_of_shards" value="1"/>
@@ -106,7 +106,9 @@ @@ -106,7 +106,9 @@
106 <property key="refresh_interval" value="${search.index.refresh_interval}"/> 106 <property key="refresh_interval" value="${search.index.refresh_interval}"/>
107 <property key="translog.flush_threshold_size" value="${search.index.translog.flush_threshold_size}"/> 107 <property key="translog.flush_threshold_size" value="${search.index.translog.flush_threshold_size}"/>
108 </properties> 108 </properties>
109 - <builderClass>com.yoho.search.consumer.index.fullbuild.SuggestConversionIndexBuilder,com.yoho.search.consumer.index.fullbuild.SuggestConversionFromBrandIndexBuilder,com.yoho.search.consumer.index.fullbuild.SuggestConversionCustomIndexBuilder</builderClass> 109 + <builderClass>
  110 + com.yoho.search.consumer.index.fullbuild.SuggestConversionIndexBuilder,com.yoho.search.consumer.index.fullbuild.SuggestConversionFromBrandIndexBuilder,com.yoho.search.consumer.index.fullbuild.SuggestConversionCustomIndexBuilder
  111 + </builderClass>
110 <mappingFile>esmapping/conversion.json</mappingFile> 112 <mappingFile>esmapping/conversion.json</mappingFile>
111 <analysisFile>analysis/conversion.yml</analysisFile> 113 <analysisFile>analysis/conversion.yml</analysisFile>
112 </index> 114 </index>
@@ -151,6 +153,19 @@ @@ -151,6 +153,19 @@
151 </index> 153 </index>
152 154
153 <index> 155 <index>
  156 + <name>robotquestionold</name>
  157 + <properties>
  158 + <property key="number_of_shards" value="1"/>
  159 + <property key="number_of_replicas" value="${search.index.number_of_replicas}"/>
  160 + <property key="refresh_interval" value="${search.index.refresh_interval}"/>
  161 + <property key="translog.flush_threshold_size" value="${search.index.translog.flush_threshold_size}"/>
  162 + </properties>
  163 + <builderClass>com.yoho.search.consumer.index.fullbuild.RobotQuestionOldIndexBuilder</builderClass>
  164 + <mappingFile>esmapping/robotquestionold.json</mappingFile>
  165 + <analysisFile>analysis/robotquestionold.yml</analysisFile>
  166 + </index>
  167 +
  168 + <index>
154 <name>shops</name> 169 <name>shops</name>
155 <properties> 170 <properties>
156 <property key="number_of_shards" value="1"/> 171 <property key="number_of_shards" value="1"/>