Package org.apache.solr.util
Class SolrPluginUtils.DisjunctionMaxQueryParser
- 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.util.SolrPluginUtils.DisjunctionMaxQueryParser
-
- All Implemented Interfaces:
QueryParserConstants
- Enclosing class:
- SolrPluginUtils
public static class SolrPluginUtils.DisjunctionMaxQueryParser extends SolrQueryParser
A subclass of SolrQueryParser that supports aliasing fields for constructing DisjunctionMaxQueries.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
SolrPluginUtils.DisjunctionMaxQueryParser.Alias
A simple container for storing alias info-
Nested classes/interfaces inherited from class org.apache.solr.parser.QueryParser
QueryParser.Operator
-
Nested classes/interfaces inherited from class org.apache.solr.parser.SolrQueryParserBase
SolrQueryParserBase.MagicFieldName, SolrQueryParserBase.RawQuery, SolrQueryParserBase.SynonymQueryStyle
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,SolrPluginUtils.DisjunctionMaxQueryParser.Alias>
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.-
Fields inherited from class org.apache.solr.parser.QueryParser
DEFAULT_SPLIT_ON_WHITESPACE, jj_nt, token, token_source
-
Fields inherited from class org.apache.solr.parser.SolrQueryParserBase
AND_OPERATOR, explicitField, operator, OR_OPERATOR, parser, REVERSE_WILDCARD_LOWER_BOUND, schema, synonymQueryStyle, TERMS_QUERY_THRESHOLD
-
Fields inherited from class org.apache.lucene.util.QueryBuilder
analyzer, autoGenerateMultiTermSynonymsPhraseQuery, enableGraphQueries, enablePositionIncrements
-
Fields 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 Constructor Description DisjunctionMaxQueryParser(QParser qp, String defaultField)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAlias(String field, float tiebreaker, Map<String,Float> fieldBoosts)
Add an alias to this query parser.protected org.apache.lucene.search.Query
getFieldQuery(String field, String queryText, boolean quoted, boolean raw)
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.-
Methods inherited from class org.apache.solr.parser.QueryParser
Clause, Conjunction, disable_tracing, enable_tracing, generateParseException, getNextToken, getSplitOnWhitespace, getToken, Modifiers, MultiTerm, newFieldQuery, Query, ReInit, ReInit, setSplitOnWhitespace, Term, TopLevelQuery
-
Methods inherited from class org.apache.solr.parser.SolrQueryParserBase
addClause, addMultiTermClause, analyzeIfMultitermTermText, escape, getAllowLeadingWildcard, getAutoGeneratePhraseQueries, getBooleanQuery, getDefaultField, getDefaultOperator, getExplicitField, getField, getFieldQuery, getFieldQuery, getFieldQuery, getFuzzyMinSim, getFuzzyPrefixLength, getFuzzyQuery, getLocalParams, getMultiTermRewriteMethod, getPhraseSlop, getPrefixQuery, getRangeQuery, getRangeQueryImpl, getRegexpQuery, getReversedWildcardFilterFactory, getSynonymQueryStyle, getWildcardQuery, init, isAllowSubQueryParsing, isRangeShouldBeProtectedFromReverse, newBooleanClause, newFuzzyQuery, newMatchAllDocsQuery, newPrefixQuery, newRegexpQuery, newSynonymQuery, newWildcardQuery, parse, setAllowLeadingWildcard, setAllowSubQueryParsing, setAutoGeneratePhraseQueries, setDefaultOperator, setFuzzyMinSim, setFuzzyPrefixLength, setMultiTermRewriteMethod, setPhraseSlop, setSynonymQueryStyle
-
Methods inherited from class org.apache.lucene.util.QueryBuilder
add, analyzeBoolean, analyzeGraphBoolean, analyzeGraphPhrase, analyzeMultiBoolean, analyzeMultiPhrase, analyzePhrase, analyzeTerm, createBooleanQuery, createBooleanQuery, createFieldQuery, createFieldQuery, createMinShouldMatchQuery, createPhraseQuery, createPhraseQuery, createSpanQuery, getAnalyzer, getAutoGenerateMultiTermSynonymsPhraseQuery, getEnableGraphQueries, getEnablePositionIncrements, newBooleanQuery, newGraphSynonymQuery, newMultiPhraseQueryBuilder, newTermQuery, setAnalyzer, setAutoGenerateMultiTermSynonymsPhraseQuery, setEnableGraphQueries, setEnablePositionIncrements
-
-
-
-
Field Detail
-
aliases
protected Map<String,SolrPluginUtils.DisjunctionMaxQueryParser.Alias> 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.
-
-
Method Detail
-
addAlias
public void addAlias(String field, float tiebreaker, Map<String,Float> fieldBoosts)
Add an alias to this query parser.- Parameters:
field
- the field name that should trigger alias mappingfieldBoosts
- the mapping from fieldname to boost value that should be used to build up the clauses of the DisjunctionMaxQuery.tiebreaker
- to the tiebreaker to be used in the DisjunctionMaxQuery- See Also:
SolrPluginUtils.parseFieldBoosts(java.lang.String)
-
getFieldQuery
protected org.apache.lucene.search.Query getFieldQuery(String field, String queryText, boolean quoted, boolean raw) throws SyntaxError
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)- Overrides:
getFieldQuery
in classSolrQueryParserBase
- Throws:
SyntaxError
-
-