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.QueryaltUserQueryprotected String[]boostParamsprotected List<org.apache.lucene.search.Query>boostQueriesprotected org.apache.lucene.search.QueryparsedUserQueryprotected 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 voidaddBoostFunctions(org.apache.lucene.search.BooleanQuery.Builder query, org.apache.solr.common.params.SolrParams solrParams)protected voidaddBoostQuery(org.apache.lucene.search.BooleanQuery.Builder query, org.apache.solr.common.params.SolrParams solrParams)voidaddDebugInfo(org.apache.solr.common.util.NamedList<Object> debugInfo)protected booleanaddMainQuery(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.QuerygetAlternateUserQuery(org.apache.solr.common.params.SolrParams solrParams)String[]getDefaultHighlightFields()org.apache.lucene.search.QuerygetHighlightQuery()protected SolrPluginUtils.DisjunctionMaxQueryParsergetParser(Map<String,Float> fields, String paramName, org.apache.solr.common.params.SolrParams solrParams, float tiebreaker)protected org.apache.lucene.search.QuerygetPhraseQuery(String userQuery, SolrPluginUtils.DisjunctionMaxQueryParser pp)protected org.apache.lucene.search.QuerygetUserQuery(String userQuery, SolrPluginUtils.DisjunctionMaxQueryParser up, org.apache.solr.common.params.SolrParams solrParams)org.apache.lucene.search.Queryparse()Create and return theQueryobject represented byqstr.static StringparseMinShouldMatch(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 SyntaxErrorDescription copied from class:QParserCreate and return theQueryobject represented byqstr. Null MAY be returned to signify there was no input (e.g. no query string) to parse.- Specified by:
parsein 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 SyntaxErrorAdds 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:
getDefaultHighlightFieldsin classQParser
-
getHighlightQuery
public org.apache.lucene.search.Query getHighlightQuery() throws SyntaxError- Overrides:
getHighlightQueryin classQParser- Throws:
SyntaxError
-
addDebugInfo
public void addDebugInfo(org.apache.solr.common.util.NamedList<Object> debugInfo)
- Overrides:
addDebugInfoin classQParser
-
-