分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 运营维护

Apache Solr 实现去掉重复的搜索结果

发布时间:2023-09-06 02:34责任编辑:董明明关键词:暂无标签

https://lucene.apache.org/solr/guide/7_2/collapse-and-expand-results.html#collapsing-query-parser

对应的源码实现QParserPlugin

static { ???HashMap<String, Class<? extends QParserPlugin>> map = new HashMap<>(30, 1); ???map.put(LuceneQParserPlugin.NAME, LuceneQParserPlugin.class); ???map.put(FunctionQParserPlugin.NAME, FunctionQParserPlugin.class); ???map.put(PrefixQParserPlugin.NAME, PrefixQParserPlugin.class); ???map.put(BoostQParserPlugin.NAME, BoostQParserPlugin.class); ???map.put(DisMaxQParserPlugin.NAME, DisMaxQParserPlugin.class); ???map.put(ExtendedDismaxQParserPlugin.NAME, ExtendedDismaxQParserPlugin.class); ???map.put(FieldQParserPlugin.NAME, FieldQParserPlugin.class); ???map.put(RawQParserPlugin.NAME, RawQParserPlugin.class); ???map.put(TermQParserPlugin.NAME, TermQParserPlugin.class); ???map.put(TermsQParserPlugin.NAME, TermsQParserPlugin.class); ???map.put(NestedQParserPlugin.NAME, NestedQParserPlugin.class); ???map.put(FunctionRangeQParserPlugin.NAME, FunctionRangeQParserPlugin.class); ???map.put(SpatialFilterQParserPlugin.NAME, SpatialFilterQParserPlugin.class); ???map.put(SpatialBoxQParserPlugin.NAME, SpatialBoxQParserPlugin.class); ???map.put(JoinQParserPlugin.NAME, JoinQParserPlugin.class); ???map.put(SurroundQParserPlugin.NAME, SurroundQParserPlugin.class); ???map.put(SwitchQParserPlugin.NAME, SwitchQParserPlugin.class); ???map.put(MaxScoreQParserPlugin.NAME, MaxScoreQParserPlugin.class); ???map.put(BlockJoinParentQParserPlugin.NAME, BlockJoinParentQParserPlugin.class); ???map.put(BlockJoinChildQParserPlugin.NAME, BlockJoinChildQParserPlugin.class); ???map.put(CollapsingQParserPlugin.NAME, CollapsingQParserPlugin.class); ???map.put(SimpleQParserPlugin.NAME, SimpleQParserPlugin.class); ???map.put(ComplexPhraseQParserPlugin.NAME, ComplexPhraseQParserPlugin.class); ???map.put(ReRankQParserPlugin.NAME, ReRankQParserPlugin.class); ???map.put(ExportQParserPlugin.NAME, ExportQParserPlugin.class); ???map.put(MLTQParserPlugin.NAME, MLTQParserPlugin.class); ???map.put(HashQParserPlugin.NAME, HashQParserPlugin.class); ???map.put(GraphQParserPlugin.NAME, GraphQParserPlugin.class); ???map.put(XmlQParserPlugin.NAME, XmlQParserPlugin.class); ???map.put(GraphTermsQParserPlugin.NAME, GraphTermsQParserPlugin.class); ???map.put(IGainTermsQParserPlugin.NAME, IGainTermsQParserPlugin.class); ???map.put(TextLogisticRegressionQParserPlugin.NAME, TextLogisticRegressionQParserPlugin.class); ???map.put(SignificantTermsQParserPlugin.NAME, SignificantTermsQParserPlugin.class); ???map.put(PayloadScoreQParserPlugin.NAME, PayloadScoreQParserPlugin.class); ???map.put(PayloadCheckQParserPlugin.NAME, PayloadCheckQParserPlugin.class); ???map.put(BoolQParserPlugin.NAME, BoolQParserPlugin.class); ???standardPlugins = Collections.unmodifiableMap(map); ?}

具体如下:

/** The <b>CollapsingQParserPlugin</b> is a PostFilter that performs field collapsing. This is a high performance alternative to standard Solr field collapsing (with ngroups) when the number of distinct groups in the result set is high. <p> Sample syntax: <p> Collapse based on the highest scoring document: <p> fq=(!collapse field=field_name} <p> Collapse based on the min value of a numeric field: <p> fq={!collapse field=field_name min=field_name} <p> Collapse based on the max value of a numeric field: <p> fq={!collapse field=field_name max=field_name} <p> Collapse with a null policy: <p> fq={!collapse field=field_name nullPolicy=nullPolicy} <p> There are three null policies: <br> ignore : removes docs with a null value in the collapse field (default).<br> expand : treats each doc with a null value in the collapse field as a separate group.<br> collapse : collapses all docs with a null value into a single group using either highest score, or min/max. <p> The CollapsingQParserPlugin fully supports the QueryElevationComponent **/

Apache Solr 实现去掉重复的搜索结果

原文地址:https://www.cnblogs.com/davidwang456/p/10490896.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved