org.apache.solr.search

## Class DisMaxQParser

- java.lang.Object
- - org.apache.solr.search.QParser
  - - org.apache.solr.search.DisMaxQParser

-     public class DisMaxQParser
      extends QParser

  Query parser for dismax queries

  Note: This API is experimental and may change in non backward-compatible ways in the future

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Query` | `altUserQuery`
    `protected String[]` | `boostParams`
    `protected List<Query>` | `boostQueries`
    `protected Query` | `parsedUserQuery`
    `protected Map<String,Float>` | `queryFields`

    - ### Fields inherited from class org.apache.solr.search.QParser

      `localParams, localParamsEnd, params, qstr, query, recurseCount, req, stringIncludingLocalParams, valFollowedParams`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DisMaxQParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `addBoostFunctions(BooleanQuery.Builder query, SolrParams solrParams)`
    `protected void` | `addBoostQuery(BooleanQuery.Builder query, SolrParams solrParams)`
    `void` | `addDebugInfo(NamedList<Object> debugInfo)`
    `protected boolean` | `addMainQuery(BooleanQuery.Builder query, SolrParams solrParams)` Adds the main query to the query argument.
    `protected Query` | `getAlternateUserQuery(SolrParams solrParams)`
    `String[]` | `getDefaultHighlightFields()`
    `Query` | `getHighlightQuery()`
    `protected SolrPluginUtils.DisjunctionMaxQueryParser` | `getParser(Map<String,Float> fields, String paramName, SolrParams solrParams, float tiebreaker)`
    `protected Query` | `getPhraseQuery(String userQuery, SolrPluginUtils.DisjunctionMaxQueryParser pp)`
    `protected Query` | `getUserQuery(String userQuery, SolrPluginUtils.DisjunctionMaxQueryParser up, SolrParams solrParams)`
    `Query` | `parse()` Create and return the `Query` object represented by `qstr`.
    `static String` | `parseMinShouldMatch(IndexSchema schema, SolrParams params)` Applies the appropriate default rules for the "mm" param based on the effective value of the "q.op" param
    `static Map<String,Float>` | `parseQueryFields(IndexSchema indexSchema, SolrParams solrParams)` Uses `SolrPluginUtils.parseFieldBoosts(String)` with the 'qf' parameter.

    - ### Methods inherited from class org.apache.solr.search.QParser

      `getLocalParams, getParam, getParams, getParser, getParser, getQuery, getReq, getSort, getSortSpec, getString, setLocalParams, setParams, setReq, setString, subQuery`

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

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

- - ### Field Detail

    - #### queryFields

          protected Map<String,Float> queryFields

    - #### parsedUserQuery

          protected Query parsedUserQuery

    - #### boostParams

          protected String[] boostParams

    - #### boostQueries

          protected List<Query> boostQueries

    - #### altUserQuery

          protected Query altUserQuery

  - ### Constructor Detail

    - #### DisMaxQParser

          public DisMaxQParser(String qstr,
                               SolrParams localParams,
                               SolrParams params,
                               SolrQueryRequest req)

  - ### Method Detail

    - #### parseMinShouldMatch

          public static String parseMinShouldMatch(IndexSchema schema,
                                                   SolrParams params)

      Applies the appropriate default rules for the "mm" param based on the effective value of the "q.op" param
      See Also:
        `QueryParsing.getQueryParserDefaultOperator(org.apache.solr.schema.IndexSchema, java.lang.String)`, `QueryParsing.OP`, `DisMaxParams.MM`

    - #### parseQueryFields

          public static Map<String,Float> parseQueryFields(IndexSchema indexSchema,
                                                           SolrParams solrParams)
                                                    throws SyntaxError

      Uses `SolrPluginUtils.parseFieldBoosts(String)` with the 'qf' parameter. Falls back to the 'df' parameter or `IndexSchema.getDefaultSearchFieldName()`.
      Throws:
        `SyntaxError`

    - #### parse

          public Query parse()
                      throws SyntaxError

      Description copied from class: `QParser`
      Create and return the `Query` object represented by `qstr`. Null MAY be returned to signify there was no input (e.g. no query string) to parse.
      Specified by:
        `parse` in class `QParser`
      Throws:
        `SyntaxError`
      See Also:
        `QParser.getQuery()`

    - #### addBoostFunctions

          protected void addBoostFunctions(BooleanQuery.Builder query,
                                           SolrParams solrParams)
                                    throws SyntaxError

      Throws:
        `SyntaxError`

    - #### addBoostQuery

          protected void addBoostQuery(BooleanQuery.Builder query,
                                       SolrParams solrParams)
                                throws SyntaxError

      Throws:
        `SyntaxError`

    - #### addMainQuery

          protected boolean addMainQuery(BooleanQuery.Builder query,
                                         SolrParams solrParams)
                                  throws SyntaxError

      Adds the main query to the query argument. If it's blank then false is returned.
      Throws:
        `SyntaxError`

    - #### getAlternateUserQuery

          protected Query getAlternateUserQuery(SolrParams solrParams)
                                         throws SyntaxError

      Throws:
        `SyntaxError`

    - #### getPhraseQuery

          protected Query getPhraseQuery(String userQuery,
                                         SolrPluginUtils.DisjunctionMaxQueryParser pp)
                                  throws SyntaxError

      Throws:
        `SyntaxError`

    - #### getUserQuery

          protected Query getUserQuery(String userQuery,
                                       SolrPluginUtils.DisjunctionMaxQueryParser up,
                                       SolrParams solrParams)
                                throws SyntaxError

      Throws:
        `SyntaxError`

    - #### getParser

          protected SolrPluginUtils.DisjunctionMaxQueryParser getParser(Map<String,Float> fields,
                                                                        String paramName,
                                                                        SolrParams solrParams,
                                                                        float tiebreaker)

    - #### getDefaultHighlightFields

          public String[] getDefaultHighlightFields()

      Overrides:
        `getDefaultHighlightFields` in class `QParser`

    - #### getHighlightQuery

          public Query getHighlightQuery()
                                  throws SyntaxError

      Overrides:
        `getHighlightQuery` in class `QParser`
      Throws:
        `SyntaxError`

    - #### addDebugInfo

          public void addDebugInfo(NamedList<Object> debugInfo)

      Overrides:
        `addDebugInfo` in class `QParser`

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