package com.tzld.piaoquan.recommend.server.service.score4recall.strategy;

import com.tzld.piaoquan.recommend.server.service.score.ScorerConfigInfo;
import com.tzld.piaoquan.recommend.server.service.score4recall.AbstractScorer4Recall;
import com.tzld.piaoquan.recommend.server.service.score4recall.model4recall.Model4RecallList;
import org.apache.commons.lang3.tuple.Pair;

import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;


public class RegionRecallScorerV5HighValue extends AbstractScorer4Recall {

    public RegionRecallScorerV5HighValue(ScorerConfigInfo configInfo) {
        super(configInfo);
    }
    @Override
    public void loadModel() {
        doLoadModel(Model4RecallList.class);
    }

    @Override
    public List<Pair<Long, Double>> recall(Map<String, String> params){
        // todo zhangbo 这里要写实现功能
        Model4RecallList model = (Model4RecallList) this.getModel();
        List<Pair<Long, Double>> lists = model.recallList;
        lists.sort(Comparator.comparingDouble(o -> -o.getRight()));
        return lists.subList(0, Math.min(100, lists.size()));
    }


}