Class SolrPluginUtils.DisjunctionMaxQueryParser

  • All Implemented Interfaces:
    QueryParserConstants
    Enclosing class:
    SolrPluginUtils

    public static class SolrPluginUtils.DisjunctionMaxQueryParser
    extends SolrQueryParser
    A subclass of SolrQueryParser that supports aliasing fields for constructing DisjunctionMaxQueries.
    • Constructor Detail

      • DisjunctionMaxQueryParser

        public DisjunctionMaxQueryParser​(QParser qp,
                                         String defaultField)
    • Method Detail

      • addAlias

        public void addAlias​(String field,
                             float tiebreaker,
                             Map<String,​Float> fieldBoosts)
        Add an alias to this query parser.
        Parameters:
        field - the field name that should trigger alias mapping
        fieldBoosts - the mapping from fieldname to boost value that should be used to build up the clauses of the DisjunctionMaxQuery.
        tiebreaker - to the tiebreaker to be used in the DisjunctionMaxQuery
        See Also:
        SolrPluginUtils.parseFieldBoosts(java.lang.String)
      • getFieldQuery

        protected org.apache.lucene.search.Query getFieldQuery​(String field,
                                                               String queryText,
                                                               boolean quoted,
                                                               boolean raw)
                                                        throws SyntaxError
        Delegates to the super class unless the field has been specified as an alias -- in which case we recurse on each of the aliased fields, and the results are composed into a DisjunctionMaxQuery. (so yes: aliases which point at other aliases should work)
        Overrides:
        getFieldQuery in class SolrQueryParserBase
        Throws:
        SyntaxError