...
|
...
|
@@ -5,8 +5,11 @@ import com.yoho.search.base.utils.ISearchConstants; |
|
|
import com.yoho.search.core.es.model.SearchParam;
|
|
|
import com.yoho.search.core.es.model.SearchResult;
|
|
|
import com.yoho.search.core.personalized.models.SortBrand;
|
|
|
import com.yoho.search.recall.scene.beans.persional.QueryUserPersionalFactorBean;
|
|
|
import com.yoho.search.service.base.SearchCommonService;
|
|
|
import org.apache.commons.collections.MapUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
...
|
...
|
@@ -22,6 +25,8 @@ import java.util.concurrent.TimeUnit; |
|
|
@Component
|
|
|
public class SortBrandVectorCacheBean {
|
|
|
|
|
|
private static final Logger RECALL_NEW_LOGGER = LoggerFactory.getLogger("RECALL");
|
|
|
|
|
|
@Autowired
|
|
|
private SearchCommonService searchCommonService;
|
|
|
|
...
|
...
|
@@ -37,6 +42,7 @@ public class SortBrandVectorCacheBean { |
|
|
public List<Double> queryBrandSortVector(SortBrand sortBrand) {
|
|
|
try {
|
|
|
if (sortBrandVector == null || sortBrandVector.isEmpty()) {
|
|
|
RECALL_NEW_LOGGER.warn("sortBrandVector is empty,please check........");
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
return sortBrandVector.get(sortBrand.key());
|
...
|
...
|
@@ -46,6 +52,9 @@ public class SortBrandVectorCacheBean { |
|
|
}
|
|
|
|
|
|
private Map<String, List<Double>> loadAllSortBrandVectors() {
|
|
|
try {
|
|
|
RECALL_NEW_LOGGER.info("loadAllSortBrandVectors begin ........");
|
|
|
long begin = System.currentTimeMillis();
|
|
|
SearchParam searchParam = new SearchParam();
|
|
|
searchParam.setSize(20000);
|
|
|
SearchResult searchResult = searchCommonService.doSearch(ISearchConstants.INDEX_NAME_BIGDATASORTBRANDVECTOR, searchParam);
|
...
|
...
|
@@ -65,7 +74,12 @@ public class SortBrandVectorCacheBean { |
|
|
|
|
|
}
|
|
|
}
|
|
|
RECALL_NEW_LOGGER.info("loadAllSortBrandVectors end,size is[{}],cost is[{}]",result.size(),System.currentTimeMillis()-begin);
|
|
|
return result;
|
|
|
}catch (Exception e){
|
|
|
RECALL_NEW_LOGGER.error("loadAllSortBrandVectors fail"+e.getMessage(),e);
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
...
|
...
|
|