Package 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 queriesNote: This API is experimental and may change in non backward-compatible ways in the future
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.lucene.search.Query
altUserQuery
protected String[]
boostParams
protected List<org.apache.lucene.search.Query>
boostQueries
protected org.apache.lucene.search.Query
parsedUserQuery
protected Map<String,Float>
queryFields
-
Fields inherited from class org.apache.solr.search.QParser
FLAG_FILTER, flags, localParams, localParamsEnd, params, qstr, query, recurseCount, req, stringIncludingLocalParams, valFollowedParams
-
-
Constructor Summary
Constructors Constructor Description DisMaxQParser(String qstr, org.apache.solr.common.params.SolrParams localParams, org.apache.solr.common.params.SolrParams params, SolrQueryRequest req)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addBoostFunctions(org.apache.lucene.search.BooleanQuery.Builder query, org.apache.solr.common.params.SolrParams solrParams)
protected void
addBoostQuery(org.apache.lucene.search.BooleanQuery.Builder query, org.apache.solr.common.params.SolrParams solrParams)
void
addDebugInfo(org.apache.solr.common.util.NamedList<Object> debugInfo)
protected boolean
addMainQuery(org.apache.lucene.search.BooleanQuery.Builder query, org.apache.solr.common.params.SolrParams solrParams)
Adds the main query to the query argument.protected org.apache.lucene.search.Query
getAlternateUserQuery(org.apache.solr.common.params.SolrParams solrParams)
String[]
getDefaultHighlightFields()
org.apache.lucene.search.Query
getHighlightQuery()
protected SolrPluginUtils.DisjunctionMaxQueryParser
getParser(Map<String,Float> fields, String paramName, org.apache.solr.common.params.SolrParams solrParams, float tiebreaker)
protected org.apache.lucene.search.Query
getPhraseQuery(String userQuery, SolrPluginUtils.DisjunctionMaxQueryParser pp)
protected org.apache.lucene.search.Query
getUserQuery(String userQuery, SolrPluginUtils.DisjunctionMaxQueryParser up, org.apache.solr.common.params.SolrParams solrParams)
org.apache.lucene.search.Query
parse()
Create and return theQuery
object represented byqstr
.static String
parseMinShouldMatch(IndexSchema schema, org.apache.solr.common.params.SolrParams params)
Applies the appropriate default rules for the "mm" param based on the effective value of the "q.op" paramstatic Map<String,Float>
parseQueryFields(IndexSchema indexSchema, org.apache.solr.common.params.SolrParams solrParams)
UsesSolrPluginUtils.parseFieldBoosts(String)
with the 'qf' parameter.-
Methods inherited from class org.apache.solr.search.QParser
getFlags, getLocalParams, getParam, getParams, getParser, getParser, getParser, getQuery, getReq, getSortSpec, getString, isFilter, setFlags, setIsFilter, setLocalParams, setParams, setReq, setString, subQuery
-
-
-
-
Constructor Detail
-
DisMaxQParser
public DisMaxQParser(String qstr, org.apache.solr.common.params.SolrParams localParams, org.apache.solr.common.params.SolrParams params, SolrQueryRequest req)
-
-
Method Detail
-
parseMinShouldMatch
public static String parseMinShouldMatch(IndexSchema schema, org.apache.solr.common.params.SolrParams params)
Applies the appropriate default rules for the "mm" param based on the effective value of the "q.op" param- See Also:
QueryParsing.OP
,DisMaxParams.MM
-
parseQueryFields
public static Map<String,Float> parseQueryFields(IndexSchema indexSchema, org.apache.solr.common.params.SolrParams solrParams) throws SyntaxError
UsesSolrPluginUtils.parseFieldBoosts(String)
with the 'qf' parameter. Falls back to the 'df' parameter- Throws:
SyntaxError
-
parse
public org.apache.lucene.search.Query parse() throws SyntaxError
Description copied from class:QParser
Create and return theQuery
object represented byqstr
. Null MAY be returned to signify there was no input (e.g. no query string) to parse.- Specified by:
parse
in classQParser
- Throws:
SyntaxError
- See Also:
QParser.getQuery()
-
addBoostFunctions
protected void addBoostFunctions(org.apache.lucene.search.BooleanQuery.Builder query, org.apache.solr.common.params.SolrParams solrParams) throws SyntaxError
- Throws:
SyntaxError
-
addBoostQuery
protected void addBoostQuery(org.apache.lucene.search.BooleanQuery.Builder query, org.apache.solr.common.params.SolrParams solrParams) throws SyntaxError
- Throws:
SyntaxError
-
addMainQuery
protected boolean addMainQuery(org.apache.lucene.search.BooleanQuery.Builder query, org.apache.solr.common.params.SolrParams solrParams) throws SyntaxError
Adds the main query to the query argument. If it's blank then false is returned.- Throws:
SyntaxError
-
getAlternateUserQuery
protected org.apache.lucene.search.Query getAlternateUserQuery(org.apache.solr.common.params.SolrParams solrParams) throws SyntaxError
- Throws:
SyntaxError
-
getPhraseQuery
protected org.apache.lucene.search.Query getPhraseQuery(String userQuery, SolrPluginUtils.DisjunctionMaxQueryParser pp) throws SyntaxError
- Throws:
SyntaxError
-
getUserQuery
protected org.apache.lucene.search.Query getUserQuery(String userQuery, SolrPluginUtils.DisjunctionMaxQueryParser up, org.apache.solr.common.params.SolrParams solrParams) throws SyntaxError
- Throws:
SyntaxError
-
getParser
protected SolrPluginUtils.DisjunctionMaxQueryParser getParser(Map<String,Float> fields, String paramName, org.apache.solr.common.params.SolrParams solrParams, float tiebreaker)
-
getDefaultHighlightFields
public String[] getDefaultHighlightFields()
- Overrides:
getDefaultHighlightFields
in classQParser
-
getHighlightQuery
public org.apache.lucene.search.Query getHighlightQuery() throws SyntaxError
- Overrides:
getHighlightQuery
in classQParser
- Throws:
SyntaxError
-
addDebugInfo
public void addDebugInfo(org.apache.solr.common.util.NamedList<Object> debugInfo)
- Overrides:
addDebugInfo
in classQParser
-
-