admin
2021-05-08 56481656c7de11cdca69c1a7dd69db176ffd9ecd
src/main/java/com/yeshi/buwan/service/imp/SearchService.java
@@ -345,16 +345,18 @@
                }
            }
            //按关键词的匹配度排序
            Comparator<VideoInfo> cm = new Comparator<VideoInfo>() {
                @Override
                public int compare(VideoInfo o1, VideoInfo o2) {
            Comparator<VideoInfo> cm = (VideoInfo o1, VideoInfo o2) -> {
                if (o1.getDefinition() - o2.getDefinition() == 0) {
                    float s1 = CompareStrSimUtil.getSimilarityRatio(o1.getName(), key, true);
                    float s2 = CompareStrSimUtil.getSimilarityRatio(o2.getName(), key, true);
                    if (s1 != s2)//相似度越高越靠前
                        return s2 > s1 ? 1 : -1;
                    else
                        return o1.getDefinition() - o2.getDefinition();//高清排在前
//                        if (s1 != s2)//相似度越高越靠前
                    return s2 > s1 ? 1 : -1;
//                        else
//                            return o1.getDefinition() - o2.getDefinition();//高清排在前
                } else {
                    return o2.getDefinition() - o1.getDefinition();//高清排在前
                }
            };
            Collections.sort(localList, cm);