org.apache.solr.search
Class SolrQueryParser
java.lang.Object
org.apache.lucene.queryParser.QueryParser
org.apache.solr.search.SolrQueryParser
- All Implemented Interfaces:
- QueryParserConstants
- Direct Known Subclasses:
- SolrPluginUtils.DisjunctionMaxQueryParser
public class SolrQueryParser
- extends QueryParser
A variation on the Lucene QueryParser which knows about the field
types and query time analyzers configured in Solr's schema.xml.
This class also deviates from the Lucene QueryParser by using
ConstantScore versions of RangeQuery and PrefixQuery to prevent
TooManyClauses exceptions.
If the magic field name "_val_
" is used in a term or
phrase query, the value is parsed as a function.
- See Also:
QueryParsing.parseFunction(java.lang.String, org.apache.solr.schema.IndexSchema)
,
ConstantScoreRangeQuery
,
ConstantScorePrefixQuery
Fields inherited from interface org.apache.lucene.queryParser.QueryParserConstants |
_ESCAPED_CHAR, _NUM_CHAR, _QUOTED_CHAR, _TERM_CHAR, _TERM_START_CHAR, _WHITESPACE, AND, Boost, CARAT, COLON, DEFAULT, EOF, FUZZY_SLOP, LPAREN, MINUS, NOT, NUMBER, OR, PLUS, PREFIXTERM, QUOTED, RangeEx, RANGEEX_END, RANGEEX_GOOP, RANGEEX_QUOTED, RANGEEX_START, RANGEEX_TO, RangeIn, RANGEIN_END, RANGEIN_GOOP, RANGEIN_QUOTED, RANGEIN_START, RANGEIN_TO, RPAREN, STAR, TERM, tokenImage, WILDTERM |
Methods inherited from class org.apache.lucene.queryParser.QueryParser |
addClause, addClause, Clause, Conjunction, disable_tracing, enable_tracing, escape, generateParseException, getAllowLeadingWildcard, getAnalyzer, getBooleanQuery, getBooleanQuery, getBooleanQuery, getBooleanQuery, getDateResolution, getDefaultOperator, getEnablePositionIncrements, getField, getFieldQuery, getFuzzyMinSim, getFuzzyPrefixLength, getFuzzyQuery, getLocale, getLowercaseExpandedTerms, getMultiTermRewriteMethod, getNextToken, getPhraseSlop, getRangeCollator, getToken, getUseOldRangeQuery, main, Modifiers, newBooleanClause, newBooleanQuery, newFuzzyQuery, newMatchAllDocsQuery, newMultiPhraseQuery, newPhraseQuery, newPrefixQuery, newRangeQuery, newTermQuery, newWildcardQuery, parse, Query, ReInit, ReInit, setAllowLeadingWildcard, setDateResolution, setDateResolution, setDefaultOperator, setEnablePositionIncrements, setFuzzyMinSim, setFuzzyPrefixLength, setLocale, setLowercaseExpandedTerms, setMultiTermRewriteMethod, setPhraseSlop, setRangeCollator, setUseOldRangeQuery, Term, TopLevelQuery |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
schema
protected final IndexSchema schema
parser
protected final QParser parser
defaultField
protected final String defaultField
leadingWildcards
protected final Map<String,ReversedWildcardFilterFactory> leadingWildcards
SolrQueryParser
public SolrQueryParser(IndexSchema schema,
String defaultField)
- Constructs a SolrQueryParser using the schema to understand the
formats and datatypes of each field. Only the defaultSearchField
will be used from the IndexSchema (unless overridden),
<solrQueryParser> will not be used.
- Parameters:
schema
- Used for default search field name if defaultField is null and field information is used for analysisdefaultField
- default field used for unspecified search terms. if null, the schema default field is used- See Also:
IndexSchema.getDefaultSearchFieldName()
SolrQueryParser
public SolrQueryParser(QParser parser,
String defaultField)
SolrQueryParser
public SolrQueryParser(QParser parser,
String defaultField,
Analyzer analyzer)
checkAllowLeadingWildcards
protected void checkAllowLeadingWildcards()
getFieldQuery
protected Query getFieldQuery(String field,
String queryText)
throws ParseException
- Overrides:
getFieldQuery
in class QueryParser
- Throws:
ParseException
getRangeQuery
protected Query getRangeQuery(String field,
String part1,
String part2,
boolean inclusive)
throws ParseException
- Overrides:
getRangeQuery
in class QueryParser
- Throws:
ParseException
getPrefixQuery
protected Query getPrefixQuery(String field,
String termStr)
throws ParseException
- Overrides:
getPrefixQuery
in class QueryParser
- Throws:
ParseException
getWildcardQuery
protected Query getWildcardQuery(String field,
String termStr)
throws ParseException
- Overrides:
getWildcardQuery
in class QueryParser
- Throws:
ParseException
Copyright © 2011 Apache Software Foundation. All Rights Reserved.