Showing
21 changed files
with
630 additions
and
0 deletions
1 | +package com.yoho.search.dal; | ||
2 | + | ||
3 | +import com.yoho.search.dal.model.BigdataBrandVector; | ||
4 | +import org.apache.ibatis.annotations.Param; | ||
5 | + | ||
6 | +import java.util.List; | ||
7 | + | ||
8 | +public interface BigdataBrandVectorMapper { | ||
9 | + | ||
10 | + int selectCount(); | ||
11 | + | ||
12 | + List<BigdataBrandVector> selectPageLists(@Param(value="start")Integer start, @Param(value="limit")Integer limit); | ||
13 | +} |
1 | +package com.yoho.search.dal; | ||
2 | + | ||
3 | +import com.yoho.search.dal.model.BigdataBrandVectorW2v; | ||
4 | +import org.apache.ibatis.annotations.Param; | ||
5 | + | ||
6 | +import java.util.List; | ||
7 | + | ||
8 | +public interface BigdataBrandVectorMapperW2v { | ||
9 | + | ||
10 | + int selectCount(); | ||
11 | + | ||
12 | + List<BigdataBrandVectorW2v> selectPageLists(@Param(value="start")Integer start, @Param(value="limit")Integer limit); | ||
13 | +} |
1 | +package com.yoho.search.dal; | ||
2 | + | ||
3 | +import com.yoho.search.dal.model.BigdataSortBrandVectorW2v; | ||
4 | +import org.apache.ibatis.annotations.Param; | ||
5 | +import java.util.List; | ||
6 | + | ||
7 | +public interface BigdataSortBrandVectorW2vMapper { | ||
8 | + | ||
9 | + int selectCount(); | ||
10 | + | ||
11 | + List<BigdataSortBrandVectorW2v> selectPageLists(@Param(value="start")Integer start, @Param(value="limit")Integer limit); | ||
12 | + | ||
13 | +} |
1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | ||
3 | +<mapper namespace="com.yoho.search.dal.BigdataBrandVectorMapper"> | ||
4 | + <resultMap id="BaseResultMap" type="com.yoho.search.dal.model.BigdataBrandVector"> | ||
5 | + <id column="brand_id" property="brandId" jdbcType="INTEGER"/> | ||
6 | + <result column="vector" property="vector" jdbcType="VARCHAR"/> | ||
7 | + <result column="update_time" property="updateTime" jdbcType="INTEGER"/> | ||
8 | + </resultMap> | ||
9 | + | ||
10 | + <sql id="Base_Column_List"> | ||
11 | + brand_id, vector, update_time | ||
12 | + </sql> | ||
13 | + | ||
14 | + <select id="selectCount" resultType="int"> | ||
15 | + select count(0) from bigdata_brand_vector | ||
16 | + </select> | ||
17 | + | ||
18 | + <select id="selectPageLists" resultMap="BaseResultMap" timeout="20000"> | ||
19 | + select <include refid="Base_Column_List" /> from bigdata_brand_vector limit #{start}, #{limit} | ||
20 | + </select> | ||
21 | + | ||
22 | +</mapper> |
1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | ||
3 | +<mapper namespace="com.yoho.search.dal.BigdataBrandVectorMapperW2v"> | ||
4 | + <resultMap id="BaseResultMap" type="com.yoho.search.dal.model.BigdataBrandVectorW2v"> | ||
5 | + <id column="brand_id" property="brandId" jdbcType="INTEGER"/> | ||
6 | + <result column="vector" property="vector" jdbcType="VARCHAR"/> | ||
7 | + <result column="update_time" property="updateTime" jdbcType="INTEGER"/> | ||
8 | + </resultMap> | ||
9 | + | ||
10 | + <sql id="Base_Column_List"> | ||
11 | + brand_id, vector, update_time | ||
12 | + </sql> | ||
13 | + | ||
14 | + <select id="selectCount" resultType="int"> | ||
15 | + select count(0) from bigdata_brand_vector_w2v | ||
16 | + </select> | ||
17 | + | ||
18 | + <select id="selectPageLists" resultMap="BaseResultMap" timeout="20000"> | ||
19 | + select <include refid="Base_Column_List" /> from bigdata_brand_vector_w2v limit #{start}, #{limit} | ||
20 | + </select> | ||
21 | + | ||
22 | +</mapper> |
1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | ||
3 | +<mapper namespace="com.yoho.search.dal.BigdataSortBrandVectorW2vMapper"> | ||
4 | + <resultMap id="BaseResultMap" type="com.yoho.search.dal.model.BigdataSortBrandVectorW2v"> | ||
5 | + <id column="brand_id" property="brandId" jdbcType="INTEGER"/> | ||
6 | + <id column="middle_sort_id" property="middleSortId" jdbcType="INTEGER"/> | ||
7 | + <result column="vector" property="vector" jdbcType="VARCHAR"/> | ||
8 | + <result column="update_time" property="updateTime" jdbcType="INTEGER"/> | ||
9 | + </resultMap> | ||
10 | + | ||
11 | + <sql id="Base_Column_List"> | ||
12 | + brand_id, middle_sort_id, vector, update_time | ||
13 | + </sql> | ||
14 | + | ||
15 | + <select id="selectCount" resultType="int"> | ||
16 | + select count(0) from bigdata_sort_brand_vector_w2v | ||
17 | + </select> | ||
18 | + | ||
19 | + <select id="selectPageLists" resultMap="BaseResultMap" timeout="20000"> | ||
20 | + select <include refid="Base_Column_List" /> from bigdata_sort_brand_vector_w2v limit #{start}, #{limit} | ||
21 | + </select> | ||
22 | + | ||
23 | +</mapper> |
index/src/main/java/com/yoho/search/consumer/index/fullbuild/BigdataBrandVectorIndexBuilder.java
0 → 100644
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.bo.BigdataBrandVectorBO; | ||
5 | +import com.yoho.search.dal.BigdataBrandVectorMapper; | ||
6 | +import com.yoho.search.dal.model.BigdataBrandVector; | ||
7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
8 | +import org.springframework.stereotype.Component; | ||
9 | +import org.springframework.util.CollectionUtils; | ||
10 | + | ||
11 | +import java.util.ArrayList; | ||
12 | +import java.util.Collections; | ||
13 | +import java.util.List; | ||
14 | + | ||
15 | +@Component | ||
16 | +public class BigdataBrandVectorIndexBuilder extends IIndexBuilder { | ||
17 | + | ||
18 | + @Autowired | ||
19 | + private BigdataBrandVectorMapper bigdataBrandVectorMapper; | ||
20 | + | ||
21 | + @Override | ||
22 | + public int getTotalCount() throws Exception { | ||
23 | + return bigdataBrandVectorMapper.selectCount(); | ||
24 | + } | ||
25 | + | ||
26 | + @Override | ||
27 | + public List<?> getPageLists(int offset, int limit) throws Exception { | ||
28 | + List<BigdataBrandVector> vectorList = bigdataBrandVectorMapper.selectPageLists(offset, limit); | ||
29 | + if (CollectionUtils.isEmpty(vectorList)) { | ||
30 | + return Collections.emptyList(); | ||
31 | + } | ||
32 | + List<BigdataBrandVectorBO> vectorBOS = new ArrayList<>(); | ||
33 | + for (BigdataBrandVector vector : vectorList) { | ||
34 | + if (vector.getBrandId() == null) { | ||
35 | + continue; | ||
36 | + } | ||
37 | + vectorBOS.add(getBigdataBrandVectorBO(vector)); | ||
38 | + } | ||
39 | + return vectorBOS; | ||
40 | + } | ||
41 | + | ||
42 | + @Override | ||
43 | + public String getId(Object object) { | ||
44 | + return ((BigdataBrandVectorBO) object).getId().toString(); | ||
45 | + } | ||
46 | + | ||
47 | + public BigdataBrandVectorBO getBigdataBrandVectorBO(BigdataBrandVector vector) { | ||
48 | + BigdataBrandVectorBO vectorBO = new BigdataBrandVectorBO(); | ||
49 | + vectorBO.setId(vector.getBrandId().longValue()); | ||
50 | + vectorBO.setBrandId(vector.getBrandId()); | ||
51 | + vectorBO.setVector(vector.getVector()); | ||
52 | + vectorBO.setUpdateTime(vector.getUpdateTime()); | ||
53 | + return vectorBO; | ||
54 | + } | ||
55 | +} | ||
56 | + |
index/src/main/java/com/yoho/search/consumer/index/fullbuild/BigdataBrandVectorW2vIndexBuilder.java
0 → 100644
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.bo.BigdataBrandVectorBO; | ||
5 | +import com.yoho.search.dal.BigdataBrandVectorMapperW2v; | ||
6 | +import com.yoho.search.dal.model.BigdataBrandVectorW2v; | ||
7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
8 | +import org.springframework.stereotype.Component; | ||
9 | +import org.springframework.util.CollectionUtils; | ||
10 | + | ||
11 | +import java.util.ArrayList; | ||
12 | +import java.util.Collections; | ||
13 | +import java.util.List; | ||
14 | + | ||
15 | +@Component | ||
16 | +public class BigdataBrandVectorW2vIndexBuilder extends IIndexBuilder { | ||
17 | + | ||
18 | + @Autowired | ||
19 | + private BigdataBrandVectorMapperW2v bigdataBrandVectorMapperW2v; | ||
20 | + | ||
21 | + @Override | ||
22 | + public int getTotalCount() throws Exception { | ||
23 | + return bigdataBrandVectorMapperW2v.selectCount(); | ||
24 | + } | ||
25 | + | ||
26 | + @Override | ||
27 | + public List<?> getPageLists(int offset, int limit) throws Exception { | ||
28 | + List<BigdataBrandVectorW2v> vectorList = bigdataBrandVectorMapperW2v.selectPageLists(offset, limit); | ||
29 | + if (CollectionUtils.isEmpty(vectorList)) { | ||
30 | + return Collections.emptyList(); | ||
31 | + } | ||
32 | + List<BigdataBrandVectorBO> vectorBOS = new ArrayList<>(); | ||
33 | + for (BigdataBrandVectorW2v vector : vectorList) { | ||
34 | + if (vector.getBrandId() == null) { | ||
35 | + continue; | ||
36 | + } | ||
37 | + vectorBOS.add(getBigdataBrandVectorBO(vector)); | ||
38 | + } | ||
39 | + return vectorBOS; | ||
40 | + } | ||
41 | + | ||
42 | + @Override | ||
43 | + public String getId(Object object) { | ||
44 | + return ((BigdataBrandVectorBO) object).getId().toString(); | ||
45 | + } | ||
46 | + | ||
47 | + public BigdataBrandVectorBO getBigdataBrandVectorBO(BigdataBrandVectorW2v vector) { | ||
48 | + BigdataBrandVectorBO vectorBO = new BigdataBrandVectorBO(); | ||
49 | + vectorBO.setId(vector.getBrandId().longValue()); | ||
50 | + vectorBO.setBrandId(vector.getBrandId()); | ||
51 | + vectorBO.setVector(vector.getVector()); | ||
52 | + vectorBO.setUpdateTime(vector.getUpdateTime()); | ||
53 | + return vectorBO; | ||
54 | + } | ||
55 | +} |
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.bo.BigdataSortBrandVectorBO; | ||
5 | +import com.yoho.search.dal.BigdataSortBrandVectorW2vMapper; | ||
6 | +import com.yoho.search.dal.model.BigdataSortBrandVectorW2v; | ||
7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
8 | +import org.springframework.stereotype.Component; | ||
9 | +import org.springframework.util.CollectionUtils; | ||
10 | + | ||
11 | +import java.util.ArrayList; | ||
12 | +import java.util.Collections; | ||
13 | +import java.util.List; | ||
14 | + | ||
15 | +@Component | ||
16 | +public class BigdataSortBrandVectorW2vIndexBuilder extends IIndexBuilder { | ||
17 | + | ||
18 | + @Autowired | ||
19 | + private BigdataSortBrandVectorW2vMapper bigdataSortBrandVectorW2vMapper; | ||
20 | + | ||
21 | + @Override | ||
22 | + public int getTotalCount() throws Exception { | ||
23 | + return bigdataSortBrandVectorW2vMapper.selectCount(); | ||
24 | + } | ||
25 | + | ||
26 | + @Override | ||
27 | + public List<?> getPageLists(int offset, int limit) throws Exception { | ||
28 | + List<BigdataSortBrandVectorW2v> vectorList = bigdataSortBrandVectorW2vMapper.selectPageLists(offset, limit); | ||
29 | + if (CollectionUtils.isEmpty(vectorList)) { | ||
30 | + return Collections.emptyList(); | ||
31 | + } | ||
32 | + List<BigdataSortBrandVectorBO> vectorBOS = new ArrayList<>(); | ||
33 | + for (BigdataSortBrandVectorW2v vector : vectorList) { | ||
34 | + if (vector.getBrandId() == null || vector.getMiddleSortId() == null) { | ||
35 | + continue; | ||
36 | + } | ||
37 | + vectorBOS.add(getBigdataSortBrandVectorBO(vector)); | ||
38 | + } | ||
39 | + return vectorBOS; | ||
40 | + } | ||
41 | + | ||
42 | + @Override | ||
43 | + public String getId(Object object) { | ||
44 | + return ((BigdataSortBrandVectorBO) object).getId(); | ||
45 | + } | ||
46 | + | ||
47 | + public BigdataSortBrandVectorBO getBigdataSortBrandVectorBO(BigdataSortBrandVectorW2v vector) { | ||
48 | + BigdataSortBrandVectorBO vectorBO = new BigdataSortBrandVectorBO(); | ||
49 | + vectorBO.setId(vector.getBrandId() + "_" + vector.getMiddleSortId()); | ||
50 | + vectorBO.setBrandId(vector.getBrandId()); | ||
51 | + vectorBO.setMiddleSortId(vector.getMiddleSortId()); | ||
52 | + vectorBO.setVector(vector.getVector()); | ||
53 | + vectorBO.setUpdateTime(vector.getUpdateTime()); | ||
54 | + return vectorBO; | ||
55 | + } | ||
56 | +} |
1 | +package com.yoho.search.consumer.index.increment.otherIndex; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSONObject; | ||
4 | +import com.yoho.search.base.utils.ConvertUtils; | ||
5 | +import com.yoho.search.base.utils.EventReportEnum; | ||
6 | +import com.yoho.search.base.utils.ISearchConstants; | ||
7 | +import com.yoho.search.consumer.index.common.IYohoIndexService; | ||
8 | +import com.yoho.search.consumer.index.fullbuild.BigdataBrandVectorIndexBuilder; | ||
9 | +import com.yoho.search.consumer.index.increment.AbstractMqListener; | ||
10 | +import com.yoho.search.consumer.service.bo.BigdataBrandVectorBO; | ||
11 | +import com.yoho.search.core.message.beans.SearchMqConsumerListerner; | ||
12 | +import com.yoho.search.dal.model.BigdataBrandVector; | ||
13 | +import org.slf4j.Logger; | ||
14 | +import org.slf4j.LoggerFactory; | ||
15 | +import org.springframework.beans.factory.annotation.Autowired; | ||
16 | +import org.springframework.stereotype.Component; | ||
17 | + | ||
18 | +@Component | ||
19 | +@SearchMqConsumerListerner(tableName = "bigdata_brand_vector") | ||
20 | +public class BigdataBrandVectorMqListener extends AbstractMqListener { | ||
21 | + private static final Logger logger = LoggerFactory.getLogger(BigdataBrandVectorMqListener.class); | ||
22 | + | ||
23 | + @Autowired | ||
24 | + private IYohoIndexService indexService; | ||
25 | + @Autowired | ||
26 | + private BigdataBrandVectorIndexBuilder bigdataBrandVectorIndexBuilder; | ||
27 | + | ||
28 | + @Override | ||
29 | + protected String getIndexName() { | ||
30 | + return ISearchConstants.INDEX_NAME_BIGDATABRANDVECTOR; | ||
31 | + } | ||
32 | + | ||
33 | + @Override | ||
34 | + protected EventReportEnum getEventReportEnum() { | ||
35 | + return EventReportEnum.BIGDATABRANDVECTORMQLISTENER_ONMESSAGE; | ||
36 | + } | ||
37 | + | ||
38 | + @Override | ||
39 | + protected void deleteData(String id) throws Exception { | ||
40 | + indexService.deleteIndexData(ISearchConstants.INDEX_NAME_BIGDATABRANDVECTOR, id); | ||
41 | + } | ||
42 | + | ||
43 | + @Override | ||
44 | + protected void updateData(JSONObject data) throws Exception { | ||
45 | + BigdataBrandVector vector = ConvertUtils.toJavaObject(BigdataBrandVector.class, data); | ||
46 | + if (vector != null && vector.getBrandId() != null) { | ||
47 | + BigdataBrandVectorBO vectorBO = bigdataBrandVectorIndexBuilder.getBigdataBrandVectorBO(vector); | ||
48 | + indexService.updateIndexData(ISearchConstants.INDEX_NAME_BIGDATABRANDVECTOR, vectorBO.getId().toString(), vectorBO); | ||
49 | + } | ||
50 | + } | ||
51 | +} |
1 | +package com.yoho.search.consumer.index.increment.otherIndex; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSONObject; | ||
4 | +import com.yoho.search.base.utils.ConvertUtils; | ||
5 | +import com.yoho.search.base.utils.EventReportEnum; | ||
6 | +import com.yoho.search.base.utils.ISearchConstants; | ||
7 | +import com.yoho.search.consumer.index.common.IYohoIndexService; | ||
8 | +import com.yoho.search.consumer.index.fullbuild.BigdataBrandVectorW2vIndexBuilder; | ||
9 | +import com.yoho.search.consumer.index.increment.AbstractMqListener; | ||
10 | +import com.yoho.search.consumer.service.bo.BigdataBrandVectorBO; | ||
11 | +import com.yoho.search.core.message.beans.SearchMqConsumerListerner; | ||
12 | +import com.yoho.search.dal.model.BigdataBrandVectorW2v; | ||
13 | +import org.springframework.beans.factory.annotation.Autowired; | ||
14 | +import org.springframework.stereotype.Component; | ||
15 | + | ||
16 | +@Component | ||
17 | +@SearchMqConsumerListerner(tableName = "bigdata_brand_vector_w2v") | ||
18 | +public class BigdataBrandVectorW2vMqListener extends AbstractMqListener { | ||
19 | + | ||
20 | + @Autowired | ||
21 | + private IYohoIndexService indexService; | ||
22 | + @Autowired | ||
23 | + private BigdataBrandVectorW2vIndexBuilder bigdataBrandVectorW2vIndexBuilder; | ||
24 | + | ||
25 | + @Override | ||
26 | + protected String getIndexName() { | ||
27 | + return ISearchConstants.INDEX_NAME_BIGDATABRANDVECTORW2V; | ||
28 | + } | ||
29 | + | ||
30 | + @Override | ||
31 | + protected EventReportEnum getEventReportEnum() { | ||
32 | + return EventReportEnum.BIGDATABRANDVECTORW2VMQLISTENER_ONMESSAGE; | ||
33 | + } | ||
34 | + | ||
35 | + @Override | ||
36 | + protected void deleteData(String id) throws Exception { | ||
37 | + indexService.deleteIndexData(ISearchConstants.INDEX_NAME_BIGDATABRANDVECTORW2V, id); | ||
38 | + } | ||
39 | + | ||
40 | + @Override | ||
41 | + protected void updateData(JSONObject data) throws Exception { | ||
42 | + BigdataBrandVectorW2v vector = ConvertUtils.toJavaObject(BigdataBrandVectorW2v.class, data); | ||
43 | + if (vector != null && vector.getBrandId() != null) { | ||
44 | + BigdataBrandVectorBO vectorBO = bigdataBrandVectorW2vIndexBuilder.getBigdataBrandVectorBO(vector); | ||
45 | + indexService.updateIndexData(ISearchConstants.INDEX_NAME_BIGDATABRANDVECTORW2V, vectorBO.getId().toString(), vectorBO); | ||
46 | + } | ||
47 | + } | ||
48 | +} |
1 | +package com.yoho.search.consumer.index.increment.otherIndex; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSONObject; | ||
4 | +import com.yoho.search.base.utils.ConvertUtils; | ||
5 | +import com.yoho.search.base.utils.EventReportEnum; | ||
6 | +import com.yoho.search.base.utils.ISearchConstants; | ||
7 | +import com.yoho.search.consumer.index.common.IYohoIndexService; | ||
8 | +import com.yoho.search.consumer.index.fullbuild.BigdataSortBrandVectorW2vIndexBuilder; | ||
9 | +import com.yoho.search.consumer.index.increment.AbstractMqListener; | ||
10 | +import com.yoho.search.consumer.service.bo.BigdataSortBrandVectorBO; | ||
11 | +import com.yoho.search.core.message.beans.SearchMqConsumerListerner; | ||
12 | +import com.yoho.search.dal.model.BigdataSortBrandVectorW2v; | ||
13 | +import org.slf4j.Logger; | ||
14 | +import org.slf4j.LoggerFactory; | ||
15 | +import org.springframework.beans.factory.annotation.Autowired; | ||
16 | +import org.springframework.stereotype.Component; | ||
17 | + | ||
18 | +@Component | ||
19 | +@SearchMqConsumerListerner(tableName = "bigdata_sort_brand_vector_w2v") | ||
20 | +public class BigdataSortBrandVectorW2vMqListener extends AbstractMqListener { | ||
21 | + | ||
22 | + private static final Logger logger = LoggerFactory.getLogger(BigdataSortBrandVectorW2vMqListener.class); | ||
23 | + | ||
24 | + @Autowired | ||
25 | + private IYohoIndexService indexService; | ||
26 | + @Autowired | ||
27 | + private BigdataSortBrandVectorW2vIndexBuilder bigdataSortBrandVectorW2vIndexBuilder; | ||
28 | + | ||
29 | + @Override | ||
30 | + protected String getIndexName() { | ||
31 | + return ISearchConstants.INDEX_NAME_BIGDATASORTBRANDVECTORW2V; | ||
32 | + } | ||
33 | + | ||
34 | + @Override | ||
35 | + protected EventReportEnum getEventReportEnum() { | ||
36 | + return EventReportEnum.BIGDATASORTBRANDVECTORW2VMQLISTENER_ONMESSAGE; | ||
37 | + } | ||
38 | + | ||
39 | + @Override | ||
40 | + protected void deleteData(String id) throws Exception { | ||
41 | + logger.error("[func=deleteData by id ][id={}]", id); | ||
42 | + } | ||
43 | + | ||
44 | + @Override | ||
45 | + protected void deleteDataByObject(final JSONObject data) throws Exception { | ||
46 | + BigdataSortBrandVectorW2v bigdataSortBrandVector = ConvertUtils.toJavaObject(BigdataSortBrandVectorW2v.class, data); | ||
47 | + if (bigdataSortBrandVector != null && bigdataSortBrandVector.getBrandId() != null && bigdataSortBrandVector.getMiddleSortId() != null) { | ||
48 | + String indexId = bigdataSortBrandVector.getBrandId() + "_" + bigdataSortBrandVector.getMiddleSortId(); | ||
49 | + indexService.deleteIndexData(ISearchConstants.INDEX_NAME_BIGDATASORTBRANDVECTORW2V, indexId); | ||
50 | + } | ||
51 | + } | ||
52 | + | ||
53 | + @Override | ||
54 | + protected void updateData(JSONObject data) throws Exception { | ||
55 | + BigdataSortBrandVectorW2v vector = ConvertUtils.toJavaObject(BigdataSortBrandVectorW2v.class, data); | ||
56 | + if (vector != null && vector.getBrandId() != null && vector.getMiddleSortId() != null) { | ||
57 | + BigdataSortBrandVectorBO vectorBO = bigdataSortBrandVectorW2vIndexBuilder.getBigdataSortBrandVectorBO(vector); | ||
58 | + indexService.updateIndexData(ISearchConstants.INDEX_NAME_BIGDATASORTBRANDVECTORW2V, vectorBO.getId(), vectorBO); | ||
59 | + } | ||
60 | + } | ||
61 | + | ||
62 | +} |
1 | +index.analysis.analyzer.default.type: keyword |
1 | +index.analysis.analyzer.default.type: keyword |
1 | +index.analysis.analyzer.default.type: keyword |
1 | +{ | ||
2 | + "bigdatabrandvector": { | ||
3 | + "_all":{ | ||
4 | + "enabled":false | ||
5 | + }, | ||
6 | + "_source":{ | ||
7 | + "enabled":true | ||
8 | + }, | ||
9 | + "properties": { | ||
10 | + "id": { | ||
11 | + "type": "long" | ||
12 | + }, | ||
13 | + "brandId": { | ||
14 | + "type": "integer" | ||
15 | + }, | ||
16 | + "vector": { | ||
17 | + "type": "keyword" | ||
18 | + }, | ||
19 | + "updateTime": { | ||
20 | + "type": "text" | ||
21 | + } | ||
22 | + } | ||
23 | + } | ||
24 | +} |
1 | +{ | ||
2 | + "bigdatabrandvectorw2v": { | ||
3 | + "_all":{ | ||
4 | + "enabled":false | ||
5 | + }, | ||
6 | + "_source":{ | ||
7 | + "enabled":true | ||
8 | + }, | ||
9 | + "properties": { | ||
10 | + "id": { | ||
11 | + "type": "long" | ||
12 | + }, | ||
13 | + "brandId": { | ||
14 | + "type": "integer" | ||
15 | + }, | ||
16 | + "vector": { | ||
17 | + "type": "keyword" | ||
18 | + }, | ||
19 | + "updateTime": { | ||
20 | + "type": "text" | ||
21 | + } | ||
22 | + } | ||
23 | + } | ||
24 | +} |
1 | +{ | ||
2 | + "bigdatasortbrandvectorw2v": { | ||
3 | + "_all":{ | ||
4 | + "enabled":false | ||
5 | + }, | ||
6 | + "_source":{ | ||
7 | + "enabled":true | ||
8 | + }, | ||
9 | + "properties": { | ||
10 | + "id": { | ||
11 | + "type": "keyword" | ||
12 | + }, | ||
13 | + "brandId": { | ||
14 | + "type": "integer" | ||
15 | + }, | ||
16 | + "middleSortId": { | ||
17 | + "type": "integer" | ||
18 | + }, | ||
19 | + "vector": { | ||
20 | + "type": "keyword" | ||
21 | + }, | ||
22 | + "updateTime": { | ||
23 | + "type": "text" | ||
24 | + } | ||
25 | + } | ||
26 | + } | ||
27 | +} |
1 | +package com.yoho.search.consumer.service.bo; | ||
2 | + | ||
3 | +public class BigdataBrandVectorBO { | ||
4 | + private Long id; | ||
5 | + private Integer brandId; | ||
6 | + private String vector; | ||
7 | + private Integer updateTime; | ||
8 | + | ||
9 | + public Long getId() { | ||
10 | + return id; | ||
11 | + } | ||
12 | + | ||
13 | + public void setId(Long id) { | ||
14 | + this.id = id; | ||
15 | + } | ||
16 | + | ||
17 | + public Integer getBrandId() { | ||
18 | + return brandId; | ||
19 | + } | ||
20 | + | ||
21 | + public void setBrandId(Integer brandId) { | ||
22 | + this.brandId = brandId; | ||
23 | + } | ||
24 | + | ||
25 | + public String getVector() { | ||
26 | + return vector; | ||
27 | + } | ||
28 | + | ||
29 | + public void setVector(String vector) { | ||
30 | + this.vector = vector; | ||
31 | + } | ||
32 | + | ||
33 | + public Integer getUpdateTime() { | ||
34 | + return updateTime; | ||
35 | + } | ||
36 | + | ||
37 | + public void setUpdateTime(Integer updateTime) { | ||
38 | + this.updateTime = updateTime; | ||
39 | + } | ||
40 | +} |
@@ -296,5 +296,44 @@ | @@ -296,5 +296,44 @@ | ||
296 | <analysisFile>analysis/bigdatasortbrandvector.yml</analysisFile> | 296 | <analysisFile>analysis/bigdatasortbrandvector.yml</analysisFile> |
297 | </index> | 297 | </index> |
298 | 298 | ||
299 | + <index> | ||
300 | + <name>bigdatasortbrandvectorw2v</name> | ||
301 | + <properties> | ||
302 | + <property key="number_of_shards" value="1"/> | ||
303 | + <property key="number_of_replicas" value="0"/> | ||
304 | + <property key="refresh_interval" value="10s"/> | ||
305 | + <property key="translog.flush_threshold_size" value="100mb"/> | ||
306 | + </properties> | ||
307 | + <builderClass>com.yoho.search.consumer.index.fullbuild.BigdataSortBrandVectorW2vIndexBuilder</builderClass> | ||
308 | + <mappingFile>esmapping/bigdatasortbrandvectorw2v.json</mappingFile> | ||
309 | + <analysisFile>analysis/bigdatasortbrandvectorw2v.yml</analysisFile> | ||
310 | + </index> | ||
311 | + | ||
312 | + <index> | ||
313 | + <name>bigdatabrandvector</name> | ||
314 | + <properties> | ||
315 | + <property key="number_of_shards" value="1"/> | ||
316 | + <property key="number_of_replicas" value="0"/> | ||
317 | + <property key="refresh_interval" value="10s"/> | ||
318 | + <property key="translog.flush_threshold_size" value="100mb"/> | ||
319 | + </properties> | ||
320 | + <builderClass>com.yoho.search.consumer.index.fullbuild.BigdataBrandVectorIndexBuilder</builderClass> | ||
321 | + <mappingFile>esmapping/bigdatabrandvector.json</mappingFile> | ||
322 | + <analysisFile>analysis/bigdatabrandvector.yml</analysisFile> | ||
323 | + </index> | ||
324 | + | ||
325 | + <index> | ||
326 | + <name>bigdatabrandvectorw2v</name> | ||
327 | + <properties> | ||
328 | + <property key="number_of_shards" value="1"/> | ||
329 | + <property key="number_of_replicas" value="0"/> | ||
330 | + <property key="refresh_interval" value="10s"/> | ||
331 | + <property key="translog.flush_threshold_size" value="100mb"/> | ||
332 | + </properties> | ||
333 | + <builderClass>com.yoho.search.consumer.index.fullbuild.BigdataBrandVectorW2vIndexBuilder</builderClass> | ||
334 | + <mappingFile>esmapping/bigdatabrandvectorw2v.json</mappingFile> | ||
335 | + <analysisFile>analysis/bigdatabrandvectorw2v.yml</analysisFile> | ||
336 | + </index> | ||
337 | + | ||
299 | </client> | 338 | </client> |
300 | </IndexConfigs> | 339 | </IndexConfigs> |
@@ -295,5 +295,44 @@ | @@ -295,5 +295,44 @@ | ||
295 | <analysisFile>analysis/bigdatasortbrandvector.yml</analysisFile> | 295 | <analysisFile>analysis/bigdatasortbrandvector.yml</analysisFile> |
296 | </index> | 296 | </index> |
297 | 297 | ||
298 | + <index> | ||
299 | + <name>bigdatasortbrandvectorw2v</name> | ||
300 | + <properties> | ||
301 | + <property key="number_of_shards" value="1"/> | ||
302 | + <property key="number_of_replicas" value="${search.index.number_of_replicas}"/> | ||
303 | + <property key="refresh_interval" value="${search.index.refresh_interval}"/> | ||
304 | + <property key="translog.flush_threshold_size" value="${search.index.translog.flush_threshold_size}"/> | ||
305 | + </properties> | ||
306 | + <builderClass>com.yoho.search.consumer.index.fullbuild.BigdataSortBrandVectorW2vIndexBuilder</builderClass> | ||
307 | + <mappingFile>esmapping/bigdatasortbrandvectorw2v.json</mappingFile> | ||
308 | + <analysisFile>analysis/bigdatasortbrandvectorw2v.yml</analysisFile> | ||
309 | + </index> | ||
310 | + | ||
311 | + <index> | ||
312 | + <name>bigdatabrandvector</name> | ||
313 | + <properties> | ||
314 | + <property key="number_of_shards" value="1"/> | ||
315 | + <property key="number_of_replicas" value="${search.index.number_of_replicas}"/> | ||
316 | + <property key="refresh_interval" value="${search.index.refresh_interval}"/> | ||
317 | + <property key="translog.flush_threshold_size" value="${search.index.translog.flush_threshold_size}"/> | ||
318 | + </properties> | ||
319 | + <builderClass>com.yoho.search.consumer.index.fullbuild.BigdataBrandVectorIndexBuilder</builderClass> | ||
320 | + <mappingFile>esmapping/bigdatabrandvector.json</mappingFile> | ||
321 | + <analysisFile>analysis/bigdatabrandvector.yml</analysisFile> | ||
322 | + </index> | ||
323 | + | ||
324 | + <index> | ||
325 | + <name>bigdatabrandvectorw2v</name> | ||
326 | + <properties> | ||
327 | + <property key="number_of_shards" value="1"/> | ||
328 | + <property key="number_of_replicas" value="${search.index.number_of_replicas}"/> | ||
329 | + <property key="refresh_interval" value="${search.index.refresh_interval}"/> | ||
330 | + <property key="translog.flush_threshold_size" value="${search.index.translog.flush_threshold_size}"/> | ||
331 | + </properties> | ||
332 | + <builderClass>com.yoho.search.consumer.index.fullbuild.BigdataBrandVectorW2vIndexBuilder</builderClass> | ||
333 | + <mappingFile>esmapping/bigdatabrandvectorw2v.json</mappingFile> | ||
334 | + <analysisFile>analysis/bigdatabrandvectorw2v.yml</analysisFile> | ||
335 | + </index> | ||
336 | + | ||
298 | </client> | 337 | </client> |
299 | </IndexConfigs> | 338 | </IndexConfigs> |
-
Please register or login to post a comment