|
|
package com.yoho.search.recall.scene.beans.strategy.impls;
|
|
|
|
|
|
import com.yoho.search.recall.scene.beans.helper.SortBuilderHelper;
|
|
|
import com.yoho.search.recall.scene.beans.strategy.IStrategy;
|
|
|
import com.yoho.search.recall.scene.beans.strategy.StrategyEnum;
|
|
|
import com.yoho.search.recall.scene.constants.CacheTimeConstants;
|
|
|
import org.elasticsearch.index.query.QueryBuilder;
|
|
|
import org.elasticsearch.search.sort.SortBuilder;
|
|
|
|
|
|
/**
|
|
|
* 按人气兜底的召回
|
|
|
*
|
|
|
* @author gufei.hu
|
|
|
*
|
|
|
*/
|
|
|
public class CommonHeatValueStrategy implements IStrategy {
|
|
|
|
|
|
private int size;
|
|
|
|
|
|
public CommonHeatValueStrategy(int size) {
|
|
|
this.size = size;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public StrategyEnum strategtEnum() {
|
|
|
return StrategyEnum.COMMON_HEAT_VALUE;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public QueryBuilder extendFilter() {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public SortBuilder<?> sortBuilder() {
|
|
|
return SortBuilderHelper.getHeatValueDescSort();
|
|
|
}
|
|
|
|
|
|
@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();
|
|
|
}
|
|
|
|
|
|
} |
|
|
package com.yoho.search.recall.scene.beans.strategy.impls;
|
|
|
|
|
|
import com.yoho.search.recall.scene.beans.helper.SortBuilderHelper;
|
|
|
import com.yoho.search.recall.scene.beans.strategy.IStrategy;
|
|
|
import com.yoho.search.recall.scene.beans.strategy.StrategyEnum;
|
|
|
import com.yoho.search.recall.scene.constants.CacheTimeConstants;
|
|
|
import org.elasticsearch.index.query.QueryBuilder;
|
|
|
import org.elasticsearch.search.sort.SortBuilder;
|
|
|
|
|
|
/**
|
|
|
* 按人气兜底的召回
|
|
|
*
|
|
|
* @author gufei.hu
|
|
|
*
|
|
|
*/
|
|
|
public class CommonHeatValueStrategy implements IStrategy {
|
|
|
|
|
|
private int size;
|
|
|
|
|
|
public CommonHeatValueStrategy(int size) {
|
|
|
this.size = size;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public StrategyEnum strategtEnum() {
|
|
|
return StrategyEnum.COMMON_HEAT_VALUE;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public QueryBuilder extendFilter() {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public SortBuilder<?> sortBuilder() {
|
|
|
return SortBuilderHelper.getHeatValueDescSort();
|
|
|
}
|
|
|
|
|
|
@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();
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|