org.apache.solr.search

## Class ExtendedDismaxQParser.ExtendedSolrQueryParser

- java.lang.Object
- - org.apache.lucene.util.QueryBuilder
  - - org.apache.solr.parser.SolrQueryParserBase
    - - org.apache.solr.parser.QueryParser
      - - org.apache.solr.search.SolrQueryParser
        - - org.apache.solr.search.ExtendedDismaxQParser.ExtendedSolrQueryParser

- All Implemented Interfaces:
    QueryParserConstants
  Enclosing class:
    ExtendedDismaxQParser

      public static class ExtendedDismaxQParser.ExtendedSolrQueryParser
      extends SolrQueryParser

  A subclass of SolrQueryParser that supports aliasing fields for constructing DisjunctionMaxQueries.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `ExtendedDismaxQParser.ExtendedSolrQueryParser.Alias` A simple container for storing alias info

    - ### Nested classes/interfaces inherited from class org.apache.solr.parser.QueryParser

      `QueryParser.Operator`

    - ### Nested classes/interfaces inherited from class org.apache.solr.parser.SolrQueryParserBase

      `SolrQueryParserBase.MagicFieldName`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Map<String,ExtendedDismaxQParser.ExtendedSolrQueryParser.Alias>` | `aliases` Where we store a map from field name we expect to see in our query string, to Alias object containing the fields to use in our DisjunctionMaxQuery and the tiebreaker to use.

    - ### Fields inherited from class org.apache.solr.parser.QueryParser

      `jj_nt, token, token_source`

    - ### Fields inherited from class org.apache.solr.parser.SolrQueryParserBase

      `AND_OPERATOR, explicitField, OR_OPERATOR, parser, schema`

    - ### Fields inherited from interface org.apache.solr.parser.QueryParserConstants

      `_ESCAPED_CHAR, _NUM_CHAR, _QUOTED_CHAR, _SQUOTED_CHAR, _TERM_CHAR, _TERM_START_CHAR, _WHITESPACE, AND, BAREOPER, Boost, CARAT, COLON, COMMENT, DEFAULT, EOF, FILTER, FUZZY_SLOP, LPARAMS, LPAREN, MINUS, NOT, NUMBER, OR, PLUS, PREFIXTERM, QUOTED, Range, RANGE_GOOP, RANGE_QUOTED, RANGE_TO, RANGEEX_END, RANGEEX_START, RANGEIN_END, RANGEIN_START, REGEXPTERM, RPAREN, STAR, TERM, tokenImage, WILDTERM`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExtendedSolrQueryParser(QParser parser, String defaultField)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addAlias(String field, float tiebreaker, Map<String,Float> fieldBoosts)` Add an alias to this query parser.
    `protected ExtendedDismaxQParser.ExtendedSolrQueryParser.Alias` | `getAlias(String field)` Returns the aliases found for a field.
    `protected Query` | `getAliasedQuery()` 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.
    `protected Query` | `getBooleanQuery(List<BooleanClause> clauses)` Factory method for generating query, given a set of clauses.
    `protected Query` | `getFieldQuery(String field, String val, boolean quoted)`
    `protected Query` | `getFieldQuery(String field, String val, int slop)` Base implementation delegates to `SolrQueryParserBase.getFieldQuery(String,String,boolean)`.
    `protected Query` | `getFuzzyQuery(String field, String val, float minSimilarity)`
    `protected Query` | `getPrefixQuery(String field, String val)`
    `protected List<Query>` | `getQueries(ExtendedDismaxQParser.ExtendedSolrQueryParser.Alias a)`
    `protected Query` | `getRangeQuery(String field, String a, String b, boolean startInclusive, boolean endInclusive)`
    `protected Query` | `getWildcardQuery(String field, String val)`
    `protected Query` | `newFieldQuery(Analyzer analyzer, String field, String queryText, boolean quoted)`
    `void` | `setRemoveStopFilter(boolean remove)`

    - ### Methods inherited from class org.apache.solr.parser.QueryParser

      `Clause, Conjunction, disable_tracing, enable_tracing, generateParseException, getNextToken, getToken, Modifiers, Query, ReInit, ReInit, Term, TopLevelQuery`

    - ### Methods inherited from class org.apache.solr.parser.SolrQueryParserBase

      `addClause, analyzeIfMultitermTermText, escape, getAllowLeadingWildcard, getAutoGeneratePhraseQueries, getDefaultField, getDefaultOperator, getExplicitField, getField, getFuzzyMinSim, getFuzzyPrefixLength, getLocalParams, getMultiTermRewriteMethod, getPhraseSlop, getRegexpQuery, getReversedWildcardFilterFactory, init, newBooleanClause, newFuzzyQuery, newMatchAllDocsQuery, newPrefixQuery, newRegexpQuery, newWildcardQuery, parse, setAllowLeadingWildcard, setAutoGeneratePhraseQueries, setDefaultOperator, setFuzzyMinSim, setFuzzyPrefixLength, setMultiTermRewriteMethod, setPhraseSlop`

    - ### Methods inherited from class org.apache.lucene.util.QueryBuilder

      `createBooleanQuery, createBooleanQuery, createFieldQuery, createMinShouldMatchQuery, createPhraseQuery, createPhraseQuery, getAnalyzer, getEnablePositionIncrements, newBooleanQuery, newMultiPhraseQueryBuilder, newSynonymQuery, newTermQuery, setAnalyzer, setEnablePositionIncrements`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### aliases

          protected Map<String,ExtendedDismaxQParser.ExtendedSolrQueryParser.Alias> aliases

      Where we store a map from field name we expect to see in our query string, to Alias object containing the fields to use in our DisjunctionMaxQuery and the tiebreaker to use.

  - ### Constructor Detail

    - #### ExtendedSolrQueryParser

          public ExtendedSolrQueryParser(QParser parser,
                                         String defaultField)

  - ### Method Detail

    - #### setRemoveStopFilter

          public void setRemoveStopFilter(boolean remove)

    - #### getBooleanQuery

          protected Query getBooleanQuery(List<BooleanClause> clauses)
                                   throws SyntaxError

      Description copied from class: `SolrQueryParserBase`
      Factory method for generating query, given a set of clauses. By default creates a boolean query composed of clauses passed in. Can be overridden by extending classes, to modify query being returned.
      Overrides:
        `getBooleanQuery` in class `SolrQueryParserBase`
      Parameters:
        `clauses` - List that contains `BooleanClause` instances to join.
      Returns:
        Resulting `Query` object.
      Throws:
        `SyntaxError`

    - #### 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)`

    - #### getAlias

          protected ExtendedDismaxQParser.ExtendedSolrQueryParser.Alias getAlias(String field)

      Returns the aliases found for a field. Returns null if there are no aliases for the field
      Returns:
        Alias

    - #### getFieldQuery

          protected Query getFieldQuery(String field,
                                        String val,
                                        boolean quoted)
                                 throws SyntaxError

      Overrides:
        `getFieldQuery` in class `SolrQueryParserBase`
      Throws:
        `SyntaxError`

    - #### getFieldQuery

          protected Query getFieldQuery(String field,
                                        String val,
                                        int slop)
                                 throws SyntaxError

      Description copied from class: `SolrQueryParserBase`
      Base implementation delegates to `SolrQueryParserBase.getFieldQuery(String,String,boolean)`. This method may be overridden, for example, to return a SpanNearQuery instead of a PhraseQuery.
      Overrides:
        `getFieldQuery` in class `SolrQueryParserBase`
      Throws:
        `SyntaxError`

    - #### getPrefixQuery

          protected Query getPrefixQuery(String field,
                                         String val)
                                  throws SyntaxError

      Overrides:
        `getPrefixQuery` in class `SolrQueryParserBase`
      Throws:
        `SyntaxError`

    - #### newFieldQuery

          protected Query newFieldQuery(Analyzer analyzer,
                                        String field,
                                        String queryText,
                                        boolean quoted)
                                 throws SyntaxError

      Overrides:
        `newFieldQuery` in class `SolrQueryParserBase`
      Throws:
        `SyntaxError`

    - #### getRangeQuery

          protected Query getRangeQuery(String field,
                                        String a,
                                        String b,
                                        boolean startInclusive,
                                        boolean endInclusive)
                                 throws SyntaxError

      Overrides:
        `getRangeQuery` in class `SolrQueryParserBase`
      Throws:
        `SyntaxError`

    - #### getWildcardQuery

          protected Query getWildcardQuery(String field,
                                           String val)
                                    throws SyntaxError

      Overrides:
        `getWildcardQuery` in class `SolrQueryParserBase`
      Throws:
        `SyntaxError`

    - #### getFuzzyQuery

          protected Query getFuzzyQuery(String field,
                                        String val,
                                        float minSimilarity)
                                 throws SyntaxError

      Overrides:
        `getFuzzyQuery` in class `SolrQueryParserBase`
      Throws:
        `SyntaxError`

    - #### getAliasedQuery

          protected Query getAliasedQuery()
                                   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)
      Throws:
        `SyntaxError`

    - #### getQueries

          protected List<Query> getQueries(ExtendedDismaxQParser.ExtendedSolrQueryParser.Alias a)
                                    throws SyntaxError

      Throws:
        `SyntaxError`

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.