Package org.apache.solr.search
Class ExtendedDismaxQParser.ExtendedSolrQueryParser
java.lang.Object
org.apache.lucene.util.QueryBuilder
org.apache.solr.parser.SolrQueryParserBase
org.apache.solr.parser.QueryParser
org.apache.solr.search.SolrQueryParser
org.apache.solr.search.ExtendedDismaxQParser.ExtendedSolrQueryParser
- All Implemented Interfaces:
QueryParserConstants
- Enclosing class:
ExtendedDismaxQParser
A subclass of SolrQueryParser that supports aliasing fields for constructing
DisjunctionMaxQueries.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classA simple container for storing alias infoNested classes/interfaces inherited from class org.apache.solr.parser.QueryParser
QueryParser.OperatorNested classes/interfaces inherited from class org.apache.solr.parser.SolrQueryParserBase
SolrQueryParserBase.MagicFieldName, SolrQueryParserBase.RawQuery, SolrQueryParserBase.SynonymQueryStyleNested classes/interfaces inherited from class org.apache.lucene.util.QueryBuilder
org.apache.lucene.util.QueryBuilder.TermAndBoost -
Field Summary
FieldsModifier and TypeFieldDescriptionWhere we store a map from field name we expect to see in our query string, to Alias object containing the fields to use in our DisjunctionMaxQuery and the tiebreaker to use.Fields inherited from class org.apache.solr.parser.QueryParser
DEFAULT_SPLIT_ON_WHITESPACE, jj_nt, token, token_sourceFields inherited from class org.apache.solr.parser.SolrQueryParserBase
AND_OPERATOR, explicitField, operator, OR_OPERATOR, parser, REVERSE_WILDCARD_LOWER_BOUND, schema, synonymQueryStyle, TERMS_QUERY_THRESHOLDFields inherited from class org.apache.lucene.util.QueryBuilder
analyzer, autoGenerateMultiTermSynonymsPhraseQuery, enableGraphQueries, enablePositionIncrementsFields inherited from interface org.apache.solr.parser.QueryParserConstants
_ESCAPED_CHAR, _NUM_CHAR, _QUOTED_CHAR, _SQUOTED_CHAR, _TERM_CHAR, _TERM_START_CHAR, _WHITESPACE, AND, BAREOPER, Boost, CARAT, COLON, COMMENT, DEFAULT, EOF, FILTER, FUZZY_SLOP, LPARAMS, LPAREN, MINUS, NOT, NUMBER, OR, PLUS, PREFIXTERM, QUOTED, Range, RANGE_GOOP, RANGE_QUOTED, RANGE_TO, RANGEEX_END, RANGEEX_START, RANGEIN_END, RANGEIN_START, REGEXPTERM, RPAREN, STAR, TERM, tokenImage, WILDTERM -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd an alias to this query parser.protected voidaddMultiTermClause(List<org.apache.lucene.search.BooleanClause> clauses, org.apache.lucene.search.Query q) Called from QueryParser's MultiTerm rule.Returns the aliases found for a field.protected org.apache.lucene.search.QueryDelegates to the super class unless the field has been specified as an alias -- in which case we recurse on each of the aliased fields, and the results are composed into a DisjunctionMaxQuery.protected org.apache.lucene.search.QueryDelegates to the super class unless the field has been specified as an alias -- in which case we recurse on each of the aliased fields, and the results are composed into a DisjunctionMaxQuery.protected org.apache.lucene.search.QuerygetBooleanQuery(List<org.apache.lucene.search.BooleanClause> clauses) Factory method for generating query, given a set of clauses.protected org.apache.lucene.search.QuerygetFieldQuery(String field, String val, boolean quoted, boolean raw) protected org.apache.lucene.search.QuerygetFieldQuery(String field, String val, int slop) Base implementation delegates toSolrQueryParserBase.getFieldQuery(String,String,boolean,boolean).protected org.apache.lucene.search.QuerygetFieldQuery(String field, List<String> queryTerms, boolean raw) protected org.apache.lucene.search.QuerygetFuzzyQuery(String field, String val, float minSimilarity) protected List<org.apache.lucene.search.Query> protected org.apache.lucene.search.QuerygetPrefixQuery(String field, String val) protected List<org.apache.lucene.search.Query> protected org.apache.lucene.search.QuerygetRangeQuery(String field, String a, String b, boolean startInclusive, boolean endInclusive) protected org.apache.lucene.search.QuerygetWildcardQuery(String field, String val) protected org.apache.lucene.search.QuerynewFieldQuery(org.apache.lucene.analysis.Analyzer analyzer, String field, String queryText, boolean quoted, boolean fieldAutoGenPhraseQueries, boolean enableGraphQueries, SolrQueryParserBase.SynonymQueryStyle synonymQueryStyle) voidsetRemoveStopFilter(boolean remove) Methods inherited from class org.apache.solr.parser.QueryParser
Clause, Conjunction, disable_tracing, enable_tracing, generateParseException, getNextToken, getSplitOnWhitespace, getToken, Modifiers, MultiTerm, Query, ReInit, ReInit, setSplitOnWhitespace, Term, TopLevelQuery, trace_enabledMethods inherited from class org.apache.solr.parser.SolrQueryParserBase
addClause, analyzeIfMultitermTermText, escape, getAllowLeadingWildcard, getAutoGeneratePhraseQueries, getDefaultField, getDefaultOperator, getExistenceQuery, getExplicitField, getField, getFieldQuery, getFuzzyMinSim, getFuzzyPrefixLength, getLocalParams, getMultiTermRewriteMethod, getPhraseSlop, getRangeQueryImpl, getRegexpQuery, getReversedWildcardFilterFactory, getSynonymQueryStyle, init, isAllowSubQueryParsing, isRangeShouldBeProtectedFromReverse, newBooleanClause, newFuzzyQuery, newGraphSynonymQuery, newMatchAllDocsQuery, newPrefixQuery, newRegexpQuery, newSynonymQuery, newWildcardQuery, parse, setAllowLeadingWildcard, setAllowSubQueryParsing, setAutoGeneratePhraseQueries, setDefaultOperator, setFuzzyMinSim, setFuzzyPrefixLength, setMultiTermRewriteMethod, setPhraseSlop, setSynonymQueryStyleMethods inherited from class org.apache.lucene.util.QueryBuilder
add, analyzeBoolean, analyzeGraphBoolean, analyzeGraphPhrase, analyzeMultiBoolean, analyzeMultiPhrase, analyzePhrase, analyzeTerm, createBooleanQuery, createBooleanQuery, createFieldQuery, createFieldQuery, createMinShouldMatchQuery, createPhraseQuery, createPhraseQuery, getAnalyzer, getAutoGenerateMultiTermSynonymsPhraseQuery, getEnableGraphQueries, getEnablePositionIncrements, newBooleanQuery, newMultiPhraseQueryBuilder, newTermQuery, setAnalyzer, setAutoGenerateMultiTermSynonymsPhraseQuery, setEnableGraphQueries, setEnablePositionIncrements
-
Field Details
-
aliases
Where we store a map from field name we expect to see in our query string, to Alias object containing the fields to use in our DisjunctionMaxQuery and the tiebreaker to use.
-
-
Constructor Details
-
ExtendedSolrQueryParser
-
-
Method Details
-
setRemoveStopFilter
public void setRemoveStopFilter(boolean remove) -
getBooleanQuery
protected org.apache.lucene.search.Query getBooleanQuery(List<org.apache.lucene.search.BooleanClause> clauses) throws SyntaxError Description copied from class:SolrQueryParserBaseFactory method for generating query, given a set of clauses. By default creates a boolean query composed of clauses passed in.Can be overridden by extending classes, to modify query being returned.
- Overrides:
getBooleanQueryin classSolrQueryParserBase- Parameters:
clauses- List that containsBooleanClauseinstances to join.- Returns:
- Resulting
Queryobject. - Throws:
SyntaxError
-
addAlias
Add an alias to this query parser.- Parameters:
field- the field name that should trigger alias mappingtiebreaker- to the tiebreaker to be used in the DisjunctionMaxQueryfieldBoosts- the mapping from fieldname to boost value that should be used to build up the clauses of the DisjunctionMaxQuery.- See Also:
-
getAlias
Returns the aliases found for a field. Returns null if there are no aliases for the field- Returns:
- Alias
-
getFieldQuery
protected org.apache.lucene.search.Query getFieldQuery(String field, String val, boolean quoted, boolean raw) throws SyntaxError - Overrides:
getFieldQueryin classSolrQueryParserBase- Throws:
SyntaxError
-
getFieldQuery
protected org.apache.lucene.search.Query getFieldQuery(String field, String val, int slop) throws SyntaxError Description copied from class:SolrQueryParserBaseBase implementation delegates toSolrQueryParserBase.getFieldQuery(String,String,boolean,boolean). This method may be overridden, for example, to return a SpanNearQuery instead of a PhraseQuery.- Overrides:
getFieldQueryin classSolrQueryParserBase- Throws:
SyntaxError
-
getFieldQuery
protected org.apache.lucene.search.Query getFieldQuery(String field, List<String> queryTerms, boolean raw) throws SyntaxError - Overrides:
getFieldQueryin classSolrQueryParserBase- Throws:
SyntaxError
-
getPrefixQuery
protected org.apache.lucene.search.Query getPrefixQuery(String field, String val) throws SyntaxError - Overrides:
getPrefixQueryin classSolrQueryParserBase- Throws:
SyntaxError
-
newFieldQuery
protected org.apache.lucene.search.Query newFieldQuery(org.apache.lucene.analysis.Analyzer analyzer, String field, String queryText, boolean quoted, boolean fieldAutoGenPhraseQueries, boolean enableGraphQueries, SolrQueryParserBase.SynonymQueryStyle synonymQueryStyle) throws SyntaxError - Overrides:
newFieldQueryin classQueryParser- Throws:
SyntaxError
-
getRangeQuery
protected org.apache.lucene.search.Query getRangeQuery(String field, String a, String b, boolean startInclusive, boolean endInclusive) throws SyntaxError - Overrides:
getRangeQueryin classSolrQueryParserBase- Throws:
SyntaxError
-
getWildcardQuery
protected org.apache.lucene.search.Query getWildcardQuery(String field, String val) throws SyntaxError - Overrides:
getWildcardQueryin classSolrQueryParserBase- Throws:
SyntaxError
-
getFuzzyQuery
protected org.apache.lucene.search.Query getFuzzyQuery(String field, String val, float minSimilarity) throws SyntaxError - Overrides:
getFuzzyQueryin classSolrQueryParserBase- Throws:
SyntaxError
-
getAliasedQuery
Delegates to the super class unless the field has been specified as an alias -- in which case we recurse on each of the aliased fields, and the results are composed into a DisjunctionMaxQuery. (so yes: aliases which point at other aliases should work)- Throws:
SyntaxError
-
getAliasedMultiTermQuery
Delegates to the super class unless the field has been specified as an alias -- in which case we recurse on each of the aliased fields, and the results are composed into a DisjunctionMaxQuery. (so yes: aliases which point at other aliases should work)- Throws:
SyntaxError
-
addMultiTermClause
protected void addMultiTermClause(List<org.apache.lucene.search.BooleanClause> clauses, org.apache.lucene.search.Query q) Description copied from class:SolrQueryParserBaseCalled from QueryParser's MultiTerm rule. Assumption: no conjunction or modifiers (conj == CONJ_NONE and mods == MOD_NONE)- Overrides:
addMultiTermClausein classSolrQueryParserBase
-
getQueries
protected List<org.apache.lucene.search.Query> getQueries(ExtendedDismaxQParser.ExtendedSolrQueryParser.Alias a) throws SyntaxError - Throws:
SyntaxError
-
getMultiTermQueries
protected List<org.apache.lucene.search.Query> getMultiTermQueries(ExtendedDismaxQParser.ExtendedSolrQueryParser.Alias a) throws SyntaxError - Throws:
SyntaxError
-