public abstract class QParser extends Object
Modifier and Type | Field and Description |
---|---|
static int |
FLAG_FILTER |
protected int |
flags |
protected SolrParams |
localParams |
protected int |
localParamsEnd |
protected SolrParams |
params |
protected String |
qstr |
protected 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() |
int |
getFlags() |
Query |
getHighlightQuery() |
SolrParams |
getLocalParams() |
String |
getParam(String name)
check both local and global params
|
SolrParams |
getParams() |
static QParser |
getParser(String qstr,
SolrQueryRequest req)
Create a
QParser to parse qstr ,
using the "lucene" (QParserPlugin.DEFAULT_QTYPE) query parser. |
static QParser |
getParser(String qstr,
String parserName,
boolean allowLocalParams,
SolrQueryRequest req)
Expert: Create a
QParser to parse qstr using the parserName parser, while allowing a
toggle for whether local-params may be parsed. |
static QParser |
getParser(String qstr,
String defaultParser,
SolrQueryRequest req)
|
Query |
getQuery()
Returns the resulting query from this QParser, calling parse() only the
first time and caching the Query result.
|
SolrQueryRequest |
getReq() |
SortSpec |
getSortSpec(boolean useGlobalParams) |
String |
getString() |
boolean |
isFilter() |
abstract Query |
parse()
Create and return the
Query object represented by qstr . |
void |
setFlags(int flags) |
void |
setIsFilter(boolean isFilter) |
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
|
public static final int FLAG_FILTER
protected String qstr
protected SolrParams params
protected SolrParams localParams
protected SolrQueryRequest req
protected int recurseCount
protected int flags
protected 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 void setFlags(int flags)
public int getFlags()
public boolean isFilter()
public void setIsFilter(boolean isFilter)
public abstract Query parse() throws SyntaxError
Query
object represented by qstr
. Null MAY be returned to signify
there was no input (e.g. no query string) to parse.SyntaxError
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 Query getQuery() throws SyntaxError
SyntaxError
public QParser subQuery(String q, String defaultType) throws SyntaxError
SyntaxError
public SortSpec getSortSpec(boolean useGlobalParams) throws SyntaxError
useGlobalParams
- look up sort, start, rows in global params if not in local paramsSyntaxError
public String[] getDefaultHighlightFields()
public Query getHighlightQuery() throws SyntaxError
SyntaxError
public static QParser getParser(String qstr, SolrQueryRequest req) throws SyntaxError
QParser
to parse qstr
,
using the "lucene" (QParserPlugin.DEFAULT_QTYPE) query parser.
The query parser may be overridden by local-params in the query
string itself. For example if
qstr={!prefix f=myfield}foo
then the prefix query parser will be used.SyntaxError
public static QParser getParser(String qstr, String defaultParser, SolrQueryRequest req) throws SyntaxError
QParser
to parse qstr
using the defaultParser
.
Note that local-params is only parsed when the defaultParser is "lucene" or "func".SyntaxError
public static QParser getParser(String qstr, String parserName, boolean allowLocalParams, SolrQueryRequest req) throws SyntaxError
QParser
to parse qstr
using the parserName
parser, while allowing a
toggle for whether local-params may be parsed.
The query parser may be overridden by local parameters in the query string itself
(assuming allowLocalParams
.
For example if parserName=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.allowLocalParams
- Whether this query parser should parse local-params syntax.
Note that the "lucene" query parser natively parses local-params regardless.SyntaxError
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.