Package org.apache.solr.search
Class FunctionQParser
java.lang.Object
org.apache.solr.search.QParser
org.apache.solr.search.FunctionQParser
Does "function query" parsing of function-call like strings, producing a
ValueSource. As
this implements QParser, we produce a Query, but more often parseAsValueSource() is called instead.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intFields inherited from class org.apache.solr.search.QParser
FLAG_FILTER, flags, localParams, localParamsEnd, params, qstr, query, recurseCount, req, stringIncludingLocalParams, valFollowedParams -
Constructor Summary
ConstructorsConstructorDescriptionFunctionQParser(String qstr, org.apache.solr.common.params.SolrParams localParams, org.apache.solr.common.params.SolrParams params, SolrQueryRequest req) -
Method Summary
Modifier and TypeMethodDescriptionbooleanprotected booleanConsume an argument delimiter (a comma) from the token stream.booleanDeprecated.this is only needed for an unusual use-case and seems hard to supportbooleanthrow exception if there is extra stuff at the end of the parsed valuesource(s).booleanAre there more arguments in the argument list being parsed?org.apache.lucene.search.Queryparse()Create and return theQueryobject represented byqstr.parseAgg(int flags) parseArg()org.apache.lucene.queries.function.ValueSourceParses as a ValueSource, not a Query.static org.apache.lucene.queries.function.ValueSourceparseAsValueSource(String string, SolrQueryRequest request) Parses the string to aValueSource.org.apache.lucene.queries.function.ValueSourceparseConstVector(int flags) doubleParse a DoubleParse a float.parseId()intparseInt()Parse an integerorg.apache.lucene.search.Queryorg.apache.lucene.queries.function.ValueSourceParse an individual ValueSource.protected org.apache.lucene.queries.function.ValueSourceparseValueSource(boolean doConsumeDelimiter) Parse an individual value source.protected org.apache.lucene.queries.function.ValueSourceparseValueSource(int flags) List<org.apache.lucene.queries.function.ValueSource> Parse a list of ValueSource.List<org.apache.lucene.queries.function.ValueSource> parseValueSourceList(int flags) Parse a list of ValueSource.parseVector(org.apache.lucene.index.VectorEncoding encoding) voidsetParseMultipleSources(boolean parseMultipleSources) Deprecated.voidsetParseToEnd(boolean parseToEnd) voidMethods inherited from class org.apache.solr.search.QParser
addDebugInfo, getDefaultHighlightFields, getFlags, getHighlightQuery, getLocalParams, getParam, getParams, getParser, getParser, getParser, getPrefixQueryMinPrefixLength, getQuery, getReq, getSortSpec, getString, isFilter, setFlags, setIsFilter, setLocalParams, setParams, setReq, subQuery
-
Field Details
-
FLAG_CONSUME_DELIMITER
public static final int FLAG_CONSUME_DELIMITER- See Also:
-
FLAG_IS_AGG
public static final int FLAG_IS_AGG- See Also:
-
FLAG_USE_FIELDNAME_SOURCE
public static final int FLAG_USE_FIELDNAME_SOURCE- See Also:
-
FLAG_PARSE_VECTOR_BYTE_ENCODING
public static final int FLAG_PARSE_VECTOR_BYTE_ENCODING- See Also:
-
FLAG_DEFAULT
public static final int FLAG_DEFAULT- See Also:
-
sp
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
-
Constructor Details
-
FunctionQParser
public FunctionQParser(String qstr, org.apache.solr.common.params.SolrParams localParams, org.apache.solr.common.params.SolrParams params, SolrQueryRequest req)
-
-
Method Details
-
parseAsValueSource
public static org.apache.lucene.queries.function.ValueSource parseAsValueSource(String string, SolrQueryRequest request) throws SyntaxError Parses the string to aValueSource. Typically, this is not used, however.- Throws:
SyntaxError- See Also:
-
setString
-
setParseMultipleSources
Deprecated. -
getParseMultipleSources
Deprecated.this is only needed for an unusual use-case and seems hard to supportParse multiple comma separated value sources encapsulated into aVectorValueSourcewhenQParser.getQuery()orparseAsValueSource()is called. -
setParseToEnd
public void setParseToEnd(boolean parseToEnd) -
getParseToEnd
public boolean getParseToEnd()throw exception if there is extra stuff at the end of the parsed valuesource(s). -
parse
Description copied from class:QParserCreate and return theQueryobject represented byqstr. Null MAY be returned to signify there was no input (e.g. no query string) to parse.- Specified by:
parsein classQParser- Throws:
SyntaxError- See Also:
-
parseAsValueSource
Parses as a ValueSource, not a Query. NOT intended to be called byValueSourceParser.parse(FunctionQParser); it's intended for general code that has aQParserbut actually wants to parse a ValueSource.- Overrides:
parseAsValueSourcein classQParser- Returns:
- A
VectorValueSourcefor multiple VS, otherwise just the single VS. - Throws:
SyntaxError
-
hasMoreArguments
Are there more arguments in the argument list being parsed?- Returns:
- whether more args exist
- Throws:
SyntaxError
-
parseId
- Throws:
SyntaxError
-
parseFloat
Parse a float.- Returns:
- Float
- Throws:
SyntaxError
-
parseDouble
Parse a Double- Returns:
- double
- Throws:
SyntaxError
-
parseInt
Parse an integer- Returns:
- An int
- Throws:
SyntaxError
-
argWasQuoted
public boolean argWasQuoted() -
parseArg
- Throws:
SyntaxError
-
parseVector
- Throws:
SyntaxError
-
parseValueSourceList
public List<org.apache.lucene.queries.function.ValueSource> parseValueSourceList() throws SyntaxErrorParse a list of ValueSource. Must be the final set of arguments to a ValueSource.- Returns:
- List<ValueSource>
- Throws:
SyntaxError
-
parseValueSourceList
public List<org.apache.lucene.queries.function.ValueSource> parseValueSourceList(int flags) throws SyntaxError Parse a list of ValueSource. Must be the final set of arguments to a ValueSource.- Parameters:
flags- - customize parsing behavior- Returns:
- List<ValueSource>
- Throws:
SyntaxError
-
parseValueSource
Parse an individual ValueSource.- Throws:
SyntaxError
-
parseNestedQuery
- Throws:
SyntaxError
-
parseValueSource
protected org.apache.lucene.queries.function.ValueSource parseValueSource(boolean doConsumeDelimiter) throws SyntaxError Parse an individual value source.- Parameters:
doConsumeDelimiter- whether to consume a delimiter following the ValueSource- Throws:
SyntaxError
-
parseValueSource
protected org.apache.lucene.queries.function.ValueSource parseValueSource(int flags) throws SyntaxError - Throws:
SyntaxError
-
parseConstVector
public org.apache.lucene.queries.function.ValueSource parseConstVector(int flags) throws SyntaxError - Throws:
SyntaxError
-
parseAgg
- Throws:
SyntaxError- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
consumeArgumentDelimiter
Consume an argument delimiter (a comma) from the token stream. Only consumes if more arguments should exist (no ending parens or end of string).- Returns:
- whether a delimiter was consumed
- Throws:
SyntaxError
-