public abstract class QParser extends Object
Modifier and Type | Field and Description |
---|---|
protected SolrParams |
localParams |
protected int |
localParamsEnd |
protected SolrParams |
params |
protected String |
qstr |
protected org.apache.lucene.search.Query |
query |
protected int |
recurseCount |
protected SolrQueryRequest |
req |
protected String |
stringIncludingLocalParams |
protected boolean |
valFollowedParams |
Constructor and Description |
---|
QParser(String qstr,
SolrParams localParams,
SolrParams params,
SolrQueryRequest req)
Constructor for the QParser
|
Modifier and Type | Method and Description |
---|---|
void |
addDebugInfo(NamedList<Object> debugInfo) |
String[] |
getDefaultHighlightFields() |
org.apache.lucene.search.Query |
getHighlightQuery() |
SolrParams |
getLocalParams() |
String |
getParam(String name)
check both local and global params
|
SolrParams |
getParams() |
static QParser |
getParser(String qstr,
String defaultType,
SolrQueryRequest req)
Create a
QParser to parse qstr ,
assuming that the default query type is defaultType . |
org.apache.lucene.search.Query |
getQuery()
Returns the resulting query from this QParser, calling parse() only the
first time and caching the Query result.
|
SolrQueryRequest |
getReq() |
SortSpec |
getSort(boolean useGlobalParams) |
String |
getString() |
abstract org.apache.lucene.search.Query |
parse()
Create and return the
Query object represented by qstr . |
void |
setLocalParams(SolrParams localParams) |
void |
setParams(SolrParams params) |
void |
setReq(SolrQueryRequest req) |
void |
setString(String s) |
QParser |
subQuery(String q,
String defaultType)
Create a new QParser for parsing an embedded sub-query
|
protected String qstr
protected SolrParams params
protected SolrParams localParams
protected SolrQueryRequest req
protected int recurseCount
protected org.apache.lucene.search.Query query
protected String stringIncludingLocalParams
protected boolean valFollowedParams
protected int localParamsEnd
public QParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req)
qstr
- The part of the query string specific to this parserlocalParams
- The set of parameters that are specific to this QParser. See http://wiki.apache.org/solr/LocalParamsparams
- The rest of the SolrParams
req
- The original SolrQueryRequest
.public abstract org.apache.lucene.search.Query parse() throws org.apache.lucene.queryParser.ParseException
Query
object represented by qstr
. Null MAY be returned to signify
there was no input (e.g. no query string) to parse.org.apache.lucene.queryParser.ParseException
getQuery()
public SolrParams getLocalParams()
public void setLocalParams(SolrParams localParams)
public SolrParams getParams()
public void setParams(SolrParams params)
public SolrQueryRequest getReq()
public void setReq(SolrQueryRequest req)
public String getString()
public void setString(String s)
public org.apache.lucene.search.Query getQuery() throws org.apache.lucene.queryParser.ParseException
org.apache.lucene.queryParser.ParseException
public QParser subQuery(String q, String defaultType) throws org.apache.lucene.queryParser.ParseException
org.apache.lucene.queryParser.ParseException
public SortSpec getSort(boolean useGlobalParams) throws org.apache.lucene.queryParser.ParseException
useGlobalParams
- look up sort, start, rows in global params if not in local paramsorg.apache.lucene.queryParser.ParseException
public String[] getDefaultHighlightFields()
public org.apache.lucene.search.Query getHighlightQuery() throws org.apache.lucene.queryParser.ParseException
org.apache.lucene.queryParser.ParseException
public static QParser getParser(String qstr, String defaultType, SolrQueryRequest req) throws org.apache.lucene.queryParser.ParseException
QParser
to parse qstr
,
assuming that the default query type is defaultType
.
The query type may be overridden by local parameters in the query
string itself. For example if defaultType="dismax"
and qstr=foo
, then the dismax query parser will be used
to parse and construct the query object. However
if qstr={!prefix f=myfield}foo
then the prefix query parser will be used.org.apache.lucene.queryParser.ParseException