|
|
package com.yoho.search.service.recall.strategy.impls;
|
|
|
|
|
|
import com.yoho.search.service.recall.helper.SortBuilderHelper;
|
|
|
import com.yoho.search.service.recall.strategy.IStrategy;
|
|
|
import com.yoho.search.service.recall.strategy.StrategyEnum;
|
|
|
import com.yoho.search.cache.CacheTimeConstants;
|
|
|
import org.elasticsearch.index.query.QueryBuilder;
|
|
|
import org.elasticsearch.search.sort.SortBuilder;
|
|
|
|
|
|
/**
|
|
|
* 直通车的召回
|
|
|
*
|
|
|
* @author gufei.hu
|
|
|
*
|
|
|
*/
|
|
|
public class CommonCtrValueStrategy implements IStrategy {
|
|
|
|
|
|
private int size;
|
|
|
|
|
|
public CommonCtrValueStrategy(int size) {
|
|
|
this.size = size;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public StrategyEnum strategtEnum() {
|
|
|
return StrategyEnum.COMMON_CTR_VALUE;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public QueryBuilder extendFilter() {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public SortBuilder<?> sortBuilder() {
|
|
|
return SortBuilderHelper.getCtrValueDescSort();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public int size() {
|
|
|
return size;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public int cacheTimeInMinute() {
|
|
|
return CacheTimeConstants.COMMON_RECALL_STRATEGY_CACHE_TIME;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public String strategyCacheKey() {
|
|
|
StringBuilder sb = defaultStrategyKey();
|
|
|
return sb.toString();
|
|
|
}
|
|
|
|
|
|
} |