public class ExpressionFactory extends Object
In order to use, first call startRequest()
and create all ungrouped expressions,
then call createReductionManager(boolean)
to get the ungrouped reduction manager.
Then for each grouping call startGrouping()
first then create all expressions within that grouping,
finally calling createGroupingReductionManager(boolean)
to get the reduction manager for that grouping.
Modifier and Type | Class and Description |
---|---|
static interface |
ExpressionFactory.ConstantFunction
Used to initialize analytics constants.
|
static interface |
ExpressionFactory.CreatorFunction
Used for system analytics functions for initialization.
|
Modifier and Type | Field and Description |
---|---|
static char |
variableForEachParam
The character used to denote the looped parameter in the for each lambda expression
|
static char |
variableForEachSep
The character used to denote the start of a for each lambda expression
|
static String |
variableLengthParamSuffix
Used to denote a variable length parameter.
|
Constructor and Description |
---|
ExpressionFactory(IndexSchema schema) |
Modifier and Type | Method and Description |
---|---|
ExpressionFactory |
addSystemFunction(String functionName,
ExpressionFactory.CreatorFunction functionCreator)
Add a system function to the expression factory.
|
void |
addSystemFunctions()
Add the natively supported functionality.
|
ExpressionFactory |
addSystemVariableFunction(String functionName,
String functionParams,
String returnSignature)
Add a variable function that will be treated like a system function.
|
ExpressionFactory |
addUserDefinedVariableFunction(String functionSignature,
String returnSignature)
Add a variable function that was defined in an analytics request.
|
AnalyticsValueStream |
createExpression(String expressionStr)
Parse and build an expression from the given expression string.
|
ReductionCollectionManager |
createGroupingReductionManager(boolean isCloudCollection)
Create a reduction manager to manage the collection of all expressions that have been created since
startGrouping() was called. |
ReductionCollectionManager |
createReductionManager(boolean isCloudCollection)
Create a reduction manager to manage the collection of all expressions that have been created since
startRequest() was called. |
IndexSchema |
getSchema()
Get the index schema used by this factory.
|
void |
startGrouping()
Prepare the factory to start building the next grouping.
|
void |
startRequest()
Prepare the factory to start building the request.
|
public static final String variableLengthParamSuffix
public static final char variableForEachSep
public static final char variableForEachParam
public ExpressionFactory(IndexSchema schema)
public IndexSchema getSchema()
public void startRequest()
public void startGrouping()
public ExpressionFactory addSystemFunction(String functionName, ExpressionFactory.CreatorFunction functionCreator) throws SolrException
functionName
- the unique name for the functionfunctionCreator
- the creator function to generate an expressionSolrException
- if the functionName is not uniquepublic ExpressionFactory addSystemVariableFunction(String functionName, String functionParams, String returnSignature) throws SolrException
functionName
- the function's namefunctionParams
- the comma separated and ordered parameters of the function (e.g. "a,b"
)returnSignature
- the return signature of the variable function (e.g. div(sum(a,b),count(b))
)SolrException
- if the name of the function is not unique or the syntax of either signature is incorrectpublic ExpressionFactory addUserDefinedVariableFunction(String functionSignature, String returnSignature) throws SolrException
functionSignature
- the function signature of the variable function (e.g. func(a,b)
)returnSignature
- the return signature of the variable function (e.g. div(sum(a,b),count(b))
)SolrException
- if the name of the function is not unique or the syntax of either signature is incorrectpublic ReductionCollectionManager createReductionManager(boolean isCloudCollection)
startRequest()
was called.isCloudCollection
- whether the request is a distributed requestpublic ReductionCollectionManager createGroupingReductionManager(boolean isCloudCollection)
startGrouping()
was called.isCloudCollection
- whether the request is a distributed requestpublic AnalyticsValueStream createExpression(String expressionStr) throws SolrException
expressionStr
- string that represents the desired expressionSolrException
- if an error occurs while constructing the expressionpublic void addSystemFunctions()
Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.