public class ExtendedDismaxQParser extends QParser
Modifier and Type | Class and Description |
---|---|
protected static class |
ExtendedDismaxQParser.Clause |
static class |
ExtendedDismaxQParser.ExtendedDismaxConfiguration
Simple container for configuration information used when parsing queries
|
static class |
ExtendedDismaxQParser.ExtendedSolrQueryParser
A subclass of SolrQueryParser that supports aliasing fields for
constructing DisjunctionMaxQueries.
|
FLAG_FILTER, flags, localParams, localParamsEnd, params, qstr, query, recurseCount, req, stringIncludingLocalParams, valFollowedParams
Constructor and Description |
---|
ExtendedDismaxQParser(String qstr,
SolrParams localParams,
SolrParams params,
SolrQueryRequest req) |
Modifier and Type | Method and Description |
---|---|
void |
addDebugInfo(NamedList<Object> debugInfo) |
protected void |
addPhraseFieldQueries(BooleanQuery.Builder query,
List<ExtendedDismaxQParser.Clause> clauses,
ExtendedDismaxQParser.ExtendedDismaxConfiguration config)
Adds shingled phrase queries to all the fields specified in the pf, pf2 anf pf3 parameters
|
protected void |
addShingledPhraseQueries(BooleanQuery.Builder mainQuery,
List<ExtendedDismaxQParser.Clause> clauses,
Collection<FieldParams> fields,
int shingleSize,
float tiebreaker,
int slop)
Modifies the main query by adding a new optional Query consisting
of shingled phrase queries across the specified clauses using the
specified field => boost mappings.
|
protected ExtendedDismaxQParser.ExtendedDismaxConfiguration |
createConfiguration(String qstr,
SolrParams localParams,
SolrParams params,
SolrQueryRequest req)
Creates an instance of ExtendedDismaxConfiguration.
|
protected ExtendedDismaxQParser.ExtendedSolrQueryParser |
createEdismaxQueryParser(QParser qParser,
String field)
Creates an instance of ExtendedSolrQueryParser, the query parser that's going to be used
to parse the query.
|
protected List<Query> |
getBoostFunctions()
Parses all function queries
|
protected List<Query> |
getBoostQueries()
Parses all boost queries
|
String[] |
getDefaultHighlightFields() |
String |
getFieldName(String s,
int pos,
int end)
returns a field name or legal field alias from the current
position of the string
|
Query |
getHighlightQuery() |
protected List<ValueSource> |
getMultiplicativeBoosts()
Parses all multiplicative boosts
|
Query |
parse()
Create and return the
Query object represented by qstr . |
protected Query |
parseEscapedQuery(ExtendedDismaxQParser.ExtendedSolrQueryParser up,
String escapedUserQuery,
ExtendedDismaxQParser.ExtendedDismaxConfiguration config)
Parses an escaped version of the user's query.
|
protected Query |
parseOriginalQuery(ExtendedDismaxQParser.ExtendedSolrQueryParser up,
String mainUserQuery,
List<ExtendedDismaxQParser.Clause> clauses,
ExtendedDismaxQParser.ExtendedDismaxConfiguration config)
Parses the user's original query.
|
protected String |
rebuildUserQuery(List<ExtendedDismaxQParser.Clause> clauses,
boolean lowercaseOperators)
Generates a query string from the raw clauses, uppercasing
'and' and 'or' as needed.
|
protected boolean |
shouldRemoveStopFilter(ExtendedDismaxQParser.ExtendedDismaxConfiguration config,
Query query)
Determines if query should be re-parsed removing the stop filter.
|
static List<String> |
split(String s,
boolean ignoreQuote) |
List<ExtendedDismaxQParser.Clause> |
splitIntoClauses(String s,
boolean ignoreQuote) |
getFlags, getLocalParams, getParam, getParams, getParser, getParser, getParser, getQuery, getReq, getSortSpec, getString, isFilter, setFlags, setIsFilter, setLocalParams, setParams, setReq, setString, subQuery
public ExtendedDismaxQParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req)
public Query parse() throws SyntaxError
QParser
Query
object represented by qstr
. Null MAY be returned to signify
there was no input (e.g. no query string) to parse.parse
in class QParser
SyntaxError
QParser.getQuery()
protected void addPhraseFieldQueries(BooleanQuery.Builder query, List<ExtendedDismaxQParser.Clause> clauses, ExtendedDismaxQParser.ExtendedDismaxConfiguration config) throws SyntaxError
SyntaxError
protected ExtendedDismaxQParser.ExtendedDismaxConfiguration createConfiguration(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req)
protected ExtendedDismaxQParser.ExtendedSolrQueryParser createEdismaxQueryParser(QParser qParser, String field)
protected Query parseEscapedQuery(ExtendedDismaxQParser.ExtendedSolrQueryParser up, String escapedUserQuery, ExtendedDismaxQParser.ExtendedDismaxConfiguration config) throws SyntaxError
up
- parser usedescapedUserQuery
- query that is parsed, should already be escaped so that no trivial parse errors are encounteredconfig
- Configuration options for this parse requestSyntaxError
parseOriginalQuery(org.apache.solr.search.ExtendedDismaxQParser.ExtendedSolrQueryParser, java.lang.String, java.util.List<org.apache.solr.search.ExtendedDismaxQParser.Clause>, org.apache.solr.search.ExtendedDismaxQParser.ExtendedDismaxConfiguration)
,
SolrPluginUtils.flattenBooleanQuery(org.apache.lucene.search.BooleanQuery.Builder, org.apache.lucene.search.BooleanQuery)
protected Query parseOriginalQuery(ExtendedDismaxQParser.ExtendedSolrQueryParser up, String mainUserQuery, List<ExtendedDismaxQParser.Clause> clauses, ExtendedDismaxQParser.ExtendedDismaxConfiguration config)
up
- parser usedmainUserQuery
- query string that is parsedclauses
- used to dictate "min should match" logicconfig
- Configuration options for this parse requestparseEscapedQuery(org.apache.solr.search.ExtendedDismaxQParser.ExtendedSolrQueryParser, java.lang.String, org.apache.solr.search.ExtendedDismaxQParser.ExtendedDismaxConfiguration)
protected boolean shouldRemoveStopFilter(ExtendedDismaxQParser.ExtendedDismaxConfiguration config, Query query)
protected String rebuildUserQuery(List<ExtendedDismaxQParser.Clause> clauses, boolean lowercaseOperators)
clauses
- the clauses of the query string to be rebuiltlowercaseOperators
- if true, lowercase 'and' and 'or' clauses will
be recognized as operators and uppercased in the final query string.protected List<ValueSource> getMultiplicativeBoosts() throws SyntaxError
SyntaxError
protected List<Query> getBoostFunctions() throws SyntaxError
SyntaxError
protected List<Query> getBoostQueries() throws SyntaxError
SyntaxError
protected void addShingledPhraseQueries(BooleanQuery.Builder mainQuery, List<ExtendedDismaxQParser.Clause> clauses, Collection<FieldParams> fields, int shingleSize, float tiebreaker, int slop) throws SyntaxError
mainQuery
- Where the phrase boosting queries will be addedclauses
- Clauses that will be used to construct the phrasesfields
- Field => boost mappings for the phrase queriesshingleSize
- how big the phrases should be, 0 means a single phrasetiebreaker
- tie breaker value for the DisjunctionMaxQueriesSyntaxError
public String[] getDefaultHighlightFields()
getDefaultHighlightFields
in class QParser
public Query getHighlightQuery() throws SyntaxError
getHighlightQuery
in class QParser
SyntaxError
public void addDebugInfo(NamedList<Object> debugInfo)
addDebugInfo
in class QParser
public List<ExtendedDismaxQParser.Clause> splitIntoClauses(String s, boolean ignoreQuote)
public String getFieldName(String s, int pos, int end)
Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.