org.apache.solr.search
Class DisMaxQParser

java.lang.Object
  extended by org.apache.solr.search.QParser
      extended by 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
protected  QParser altQParser
           
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
DisMaxQParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req)
           
 
Method Summary
protected  void addBoostFunctions(BooleanQuery query, SolrParams solrParams)
           
protected  void addBoostQuery(BooleanQuery query, SolrParams solrParams)
           
 void addDebugInfo(NamedList<Object> debugInfo)
           
protected  boolean addMainQuery(BooleanQuery 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, getPaging, getParam, getParams, getParser, getQuery, getReq, getSort, 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

altQParser

protected QParser altQParser
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 ParseException
Uses SolrPluginUtils.parseFieldBoosts(String) with the 'qf' parameter. Falls back to the 'df' parameter or IndexSchema.getDefaultSearchFieldName().

Throws:
ParseException

parse

public Query parse()
            throws ParseException
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:
ParseException
See Also:
QParser.getQuery()

addBoostFunctions

protected void addBoostFunctions(BooleanQuery query,
                                 SolrParams solrParams)
                          throws ParseException
Throws:
ParseException

addBoostQuery

protected void addBoostQuery(BooleanQuery query,
                             SolrParams solrParams)
                      throws ParseException
Throws:
ParseException

addMainQuery

protected boolean addMainQuery(BooleanQuery query,
                               SolrParams solrParams)
                        throws ParseException
Adds the main query to the query argument. If its blank then false is returned.

Throws:
ParseException

getAlternateUserQuery

protected Query getAlternateUserQuery(SolrParams solrParams)
                               throws ParseException
Throws:
ParseException

getPhraseQuery

protected Query getPhraseQuery(String userQuery,
                               SolrPluginUtils.DisjunctionMaxQueryParser pp)
                        throws ParseException
Throws:
ParseException

getUserQuery

protected Query getUserQuery(String userQuery,
                             SolrPluginUtils.DisjunctionMaxQueryParser up,
                             SolrParams solrParams)
                      throws ParseException
Throws:
ParseException

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 ParseException
Overrides:
getHighlightQuery in class QParser
Throws:
ParseException

addDebugInfo

public void addDebugInfo(NamedList<Object> debugInfo)
Overrides:
addDebugInfo in class QParser


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