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 **/