Class LambdaFunction
- java.lang.Object
-
- org.apache.solr.analytics.function.mapping.LambdaFunction
-
public class LambdaFunction extends Object
Lambda Functions are used to easily create basic mapping functions.There are lambda functions for all types: boolean, int, long, float, double, date and string. Lambda functions must have parameters of all the same type, which will be the same type as the returned Value or ValueStream.
The types of functions that are accepted are: (multi = multi-valued expression, single = single-valued expression)
-
func(single) -> single -
func(multi) -> multi -
func(single,single) -> single -
func(multi,single) -> multi -
func(single,multi) -> multi -
func(multi) -> single -
func(single,single,...) -> single(You can also specify whether all parameters must exist, or at least one must exist for the returned value to exist)
NOTE: The combination of name and parameters MUST be unique for an expression.
For example consider ifjoin(fieldA, ',')andjoin(fieldA, ';')are both called. If the JoinFunction uses:
LambdaFunction.createStringLambdaFunction("join", (a,b) -> a + sep + b, (StringValueStream)params[0])
then both the name "join" and single parameter fieldA will be used for two DIFFERENT expressions. This does not meet the uniqueness requirmenet and will break the query.
A solution to this is to name the function using the missing information:
LambdaFunction.createStringLambdaFunction("join(" + sep + ")", (a,b) -> a + sep + b, (StringValueStream)params[0])
Therefore both expressions will have fieldA as the only parameter, but the names"join(,)"and"join(;)"will be different. This meets the uniqueness requirement for lambda functions. -
-
-
Nested Class Summary
-
Constructor Summary
Constructors Constructor Description LambdaFunction()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BooleanValueStreamcreateBooleanLambdaFunction(String name, LambdaFunction.BoolInBoolOutLambda lambda, BooleanValueStream param)Creates a function that takes in either a single or multi valued boolean expression and returns the same type of expression with the given lambda function applied to every value.static BooleanValuecreateBooleanLambdaFunction(String name, LambdaFunction.TwoBoolInBoolOutLambda lambda, BooleanValue[] params)Forwards the creation of the function tocreateBooleanLambdaFunction(String, TwoBoolInBoolOutLambda, BooleanValue[], boolean), using true for the last argument (allMustExist).static BooleanValuecreateBooleanLambdaFunction(String name, LambdaFunction.TwoBoolInBoolOutLambda lambda, BooleanValue[] params, boolean allMustExist)Creates a function that associatively (order is guaranteed) reduces multiple single-value boolean expressions into a single-value boolean expression for each document.static BooleanValuecreateBooleanLambdaFunction(String name, LambdaFunction.TwoBoolInBoolOutLambda lambda, BooleanValueStream param)Creates a function that takes in a multi-valued boolean expression and returns a single-valued boolean expression.static BooleanValueStreamcreateBooleanLambdaFunction(String name, LambdaFunction.TwoBoolInBoolOutLambda lambda, BooleanValueStream param1, BooleanValueStream param2)Creates a function that maps two booleans to a single boolean.static DateValueStreamcreateDateLambdaFunction(String name, LambdaFunction.LongInLongOutLambda lambda, DateValueStream param)Creates a function that takes in either a single or multi valued date expression and returns the same type of expression with the given lambda function applied to every value.static DateValuecreateDateLambdaFunction(String name, LambdaFunction.TwoLongInLongOutLambda lambda, DateValue[] params)Forwards the creation of the function tocreateDateLambdaFunction(String, TwoLongInLongOutLambda, DateValue[], boolean), using true for the last argument (allMustExist).static DateValuecreateDateLambdaFunction(String name, LambdaFunction.TwoLongInLongOutLambda lambda, DateValue[] params, boolean allMustExist)Creates a function that associatively (order is guaranteed) reduces multiple single-value date expressions into a single-value date expression for each document.static DateValuecreateDateLambdaFunction(String name, LambdaFunction.TwoLongInLongOutLambda lambda, DateValueStream param)Creates a function that takes in a multi-valued date expression and returns a single-valued date expression.static DateValueStreamcreateDateLambdaFunction(String name, LambdaFunction.TwoLongInLongOutLambda lambda, DateValueStream param1, DateValueStream param2)Creates a function that maps two dates to a single date.static DoubleValueStreamcreateDoubleLambdaFunction(String name, LambdaFunction.DoubleInDoubleOutLambda lambda, DoubleValueStream param)Creates a function that takes in either a single or multi valued double expression and returns the same type of expression with the given lambda function applied to every value.static DoubleValuecreateDoubleLambdaFunction(String name, LambdaFunction.TwoDoubleInDoubleOutLambda lambda, DoubleValue[] params)Forwards the creation of the function tocreateDoubleLambdaFunction(String, TwoDoubleInDoubleOutLambda, DoubleValue[], boolean), using true for the last argument (allMustExist).static DoubleValuecreateDoubleLambdaFunction(String name, LambdaFunction.TwoDoubleInDoubleOutLambda lambda, DoubleValue[] params, boolean allMustExist)Creates a function that associatively (order is guaranteed) reduces multiple single-value double expressions into a single-value double expression for each document.static DoubleValuecreateDoubleLambdaFunction(String name, LambdaFunction.TwoDoubleInDoubleOutLambda lambda, DoubleValueStream param)Creates a function that takes in a multi-valued double expression and returns a single-valued double expression.static DoubleValueStreamcreateDoubleLambdaFunction(String name, LambdaFunction.TwoDoubleInDoubleOutLambda lambda, DoubleValueStream param1, DoubleValueStream param2)Creates a function that maps two doubles to a single double.static FloatValueStreamcreateFloatLambdaFunction(String name, LambdaFunction.FloatInFloatOutLambda lambda, FloatValueStream param)Creates a function that takes in either a single or multi valued float expression and returns the same type of expression with the given lambda function applied to every value.static FloatValuecreateFloatLambdaFunction(String name, LambdaFunction.TwoFloatInFloatOutLambda lambda, FloatValue[] params)Forwards the creation of the function tocreateFloatLambdaFunction(String, TwoFloatInFloatOutLambda, FloatValue[], boolean), using true for the last argument (allMustExist).static FloatValuecreateFloatLambdaFunction(String name, LambdaFunction.TwoFloatInFloatOutLambda lambda, FloatValue[] params, boolean allMustExist)Creates a function that associatively (order is guaranteed) reduces multiple single-value float expressions into a single-value float expression for each document.static FloatValuecreateFloatLambdaFunction(String name, LambdaFunction.TwoFloatInFloatOutLambda lambda, FloatValueStream param)Creates a function that takes in a multi-valued float expression and returns a single-valued float expression.static FloatValueStreamcreateFloatLambdaFunction(String name, LambdaFunction.TwoFloatInFloatOutLambda lambda, FloatValueStream param1, FloatValueStream param2)Creates a function that maps two floats to a single float.static IntValueStreamcreateIntLambdaFunction(String name, LambdaFunction.IntInIntOutLambda lambda, IntValueStream param)Creates a function that takes in either a single or multi valued integer expression and returns the same type of expression with the given lambda function applied to every value.static IntValuecreateIntLambdaFunction(String name, LambdaFunction.TwoIntInIntOutLambda lambda, IntValue[] params)Forwards the creation of the function tocreateIntLambdaFunction(String, TwoIntInIntOutLambda, IntValue[], boolean), using true for the last argument (allMustExist).static IntValuecreateIntLambdaFunction(String name, LambdaFunction.TwoIntInIntOutLambda lambda, IntValue[] params, boolean allMustExist)Creates a function that associatively (order is guaranteed) reduces multiple single-value integer expressions into a single-value integer expression for each document.static IntValuecreateIntLambdaFunction(String name, LambdaFunction.TwoIntInIntOutLambda lambda, IntValueStream param)Creates a function that takes in a multi-valued integer expression and returns a single-valued integer expression.static IntValueStreamcreateIntLambdaFunction(String name, LambdaFunction.TwoIntInIntOutLambda lambda, IntValueStream param1, IntValueStream param2)Creates a function that maps two integers to a single integer.static LongValueStreamcreateLongLambdaFunction(String name, LambdaFunction.LongInLongOutLambda lambda, LongValueStream param)Creates a function that takes in either a single or multi valued long expression and returns the same type of expression with the given lambda function applied to every value.static LongValuecreateLongLambdaFunction(String name, LambdaFunction.TwoLongInLongOutLambda lambda, LongValue[] params)Forwards the creation of the function tocreateLongLambdaFunction(String, TwoLongInLongOutLambda, LongValue[], boolean), using true for the last argument (allMustExist).static LongValuecreateLongLambdaFunction(String name, LambdaFunction.TwoLongInLongOutLambda lambda, LongValue[] params, boolean allMustExist)Creates a function that associatively (order is guaranteed) reduces multiple single-value long expressions into a single-value long expression for each document.static LongValuecreateLongLambdaFunction(String name, LambdaFunction.TwoLongInLongOutLambda lambda, LongValueStream param)Creates a function that takes in a multi-valued long expression and returns a single-valued long expression.static LongValueStreamcreateLongLambdaFunction(String name, LambdaFunction.TwoLongInLongOutLambda lambda, LongValueStream param1, LongValueStream param2)Creates a function that maps two longs to a single long.static StringValueStreamcreateStringLambdaFunction(String name, LambdaFunction.StringInStringOutLambda lambda, StringValueStream param)Creates a function that takes in either a single or multi valued string expression and returns the same type of expression with the given lambda function applied to every value.static StringValuecreateStringLambdaFunction(String name, LambdaFunction.TwoStringInStringOutLambda lambda, StringValue[] params)Forwards the creation of the function tocreateStringLambdaFunction(String, TwoStringInStringOutLambda, StringValue[], boolean), using true for the last argument (allMustExist).static StringValuecreateStringLambdaFunction(String name, LambdaFunction.TwoStringInStringOutLambda lambda, StringValue[] params, boolean allMustExist)Creates a function that associatively (order is guaranteed) reduces multiple single-value string expressions into a single-value string expression for each document.static StringValuecreateStringLambdaFunction(String name, LambdaFunction.TwoStringInStringOutLambda lambda, StringValueStream param)Creates a function that takes in a multi-valued string expression and returns a single-valued string expression.static StringValueStreamcreateStringLambdaFunction(String name, LambdaFunction.TwoStringInStringOutLambda lambda, StringValueStream param1, StringValueStream param2)Creates a function that maps two strings to a single string.
-
-
-
Method Detail
-
createBooleanLambdaFunction
public static BooleanValueStream createBooleanLambdaFunction(String name, LambdaFunction.BoolInBoolOutLambda lambda, BooleanValueStream param)
Creates a function that takes in either a single or multi valued boolean expression and returns the same type of expression with the given lambda function applied to every value.- Parameters:
name- name for the functionlambda- the function to be applied to every value:(boolean) -> booleanparam- the expression to apply the lambda to- Returns:
- an expression the same type as was given with the lambda applied
-
createBooleanLambdaFunction
public static BooleanValue createBooleanLambdaFunction(String name, LambdaFunction.TwoBoolInBoolOutLambda lambda, BooleanValueStream param)
Creates a function that takes in a multi-valued boolean expression and returns a single-valued boolean expression. The given lambda is used to associatively (order not guaranteed) reduce all values for a document down to a single value.- Parameters:
name- name for the functionlambda- the associative function used to reduce the values:(boolean, boolean) -> booleanparam- the expression to be reduced per-document- Returns:
- a single-valued expression which has been reduced for every document
-
createBooleanLambdaFunction
public static BooleanValueStream createBooleanLambdaFunction(String name, LambdaFunction.TwoBoolInBoolOutLambda lambda, BooleanValueStream param1, BooleanValueStream param2) throws SolrException
Creates a function that maps two booleans to a single boolean. This can take the following shapes:- Taking in two single-valued expressions and returning a single-valued expression which represents the lambda combination of the inputs.
- Taking in a single-valued expression and a multi-valued expression and returning a multi-valued expression which
represents the lambda combination of the single-value input with each of the values of the multi-value input.
The inputs can be eitherfunc(single,multi)orfunc(multi,single).
- Parameters:
name- name for the functionlambda- the function to be applied to every value:(boolean,boolean) -> booleanparam1- the first parameter in the lambdaparam2- the second parameter in the lambda- Returns:
- a single or multi valued expression combining the two parameters with the given lambda
- Throws:
SolrException- if neither parameter is single-valued
-
createBooleanLambdaFunction
public static BooleanValue createBooleanLambdaFunction(String name, LambdaFunction.TwoBoolInBoolOutLambda lambda, BooleanValue[] params)
Forwards the creation of the function tocreateBooleanLambdaFunction(String, TwoBoolInBoolOutLambda, BooleanValue[], boolean), using true for the last argument (allMustExist).- Parameters:
name- name for the functionlambda- the associative function used to reduce the values:(boolean, boolean) -> booleanparams- the expressions to reduce- Returns:
- a single-value expression that reduces the parameters with the given lambda
-
createBooleanLambdaFunction
public static BooleanValue createBooleanLambdaFunction(String name, LambdaFunction.TwoBoolInBoolOutLambda lambda, BooleanValue[] params, boolean allMustExist)
Creates a function that associatively (order is guaranteed) reduces multiple single-value boolean expressions into a single-value boolean expression for each document.
For a document, every parameter's value must exist for the resulting value to exist ifallMustExistis true. IfallMustExistis false, only one of the parameters' values must exist.- Parameters:
name- name for the functionlambda- the associative function used to reduce the values:(boolean, boolean) -> booleanparams- the expressions to reduceallMustExist- whether all parameters are required to exist- Returns:
- a single-value expression that reduces the parameters with the given lambda
-
createIntLambdaFunction
public static IntValueStream createIntLambdaFunction(String name, LambdaFunction.IntInIntOutLambda lambda, IntValueStream param)
Creates a function that takes in either a single or multi valued integer expression and returns the same type of expression with the given lambda function applied to every value.- Parameters:
name- name for the functionlambda- the function to be applied to every value:(integer) -> integerparam- the expression to apply the lambda to- Returns:
- an expression the same type as was given with the lambda applied
-
createIntLambdaFunction
public static IntValue createIntLambdaFunction(String name, LambdaFunction.TwoIntInIntOutLambda lambda, IntValueStream param)
Creates a function that takes in a multi-valued integer expression and returns a single-valued integer expression. The given lambda is used to associatively (order not guaranteed) reduce all values for a document down to a single value.- Parameters:
name- name for the functionlambda- the associative function used to reduce the values:(integer, integer) -> integerparam- the expression to be reduced per-document- Returns:
- a single-valued expression which has been reduced for every document
-
createIntLambdaFunction
public static IntValueStream createIntLambdaFunction(String name, LambdaFunction.TwoIntInIntOutLambda lambda, IntValueStream param1, IntValueStream param2) throws SolrException
Creates a function that maps two integers to a single integer. This can take the following shapes:- Taking in two single-valued expressions and returning a single-valued expression which represents the lambda combination of the inputs.
- Taking in a single-valued expression and a multi-valued expression and returning a multi-valued expression which
represents the lambda combination of the single-value input with each of the values of the multi-value input.
The inputs can be eitherfunc(single,multi)orfunc(multi,single).
- Parameters:
name- name for the functionlambda- the function to be applied to every value:(integer,integer) -> integerparam1- the first parameter in the lambdaparam2- the second parameter in the lambda- Returns:
- a single or multi valued expression combining the two parameters with the given lambda
- Throws:
SolrException- if neither parameter is single-valued
-
createIntLambdaFunction
public static IntValue createIntLambdaFunction(String name, LambdaFunction.TwoIntInIntOutLambda lambda, IntValue[] params)
Forwards the creation of the function tocreateIntLambdaFunction(String, TwoIntInIntOutLambda, IntValue[], boolean), using true for the last argument (allMustExist).- Parameters:
name- name for the functionlambda- the associative function used to reduce the values:(boolean, boolean) -> booleanparams- the expressions to reduce- Returns:
- a single-value expression that reduces the parameters with the given lambda
-
createIntLambdaFunction
public static IntValue createIntLambdaFunction(String name, LambdaFunction.TwoIntInIntOutLambda lambda, IntValue[] params, boolean allMustExist)
Creates a function that associatively (order is guaranteed) reduces multiple single-value integer expressions into a single-value integer expression for each document.
For a document, every parameter's value must exist for the resulting value to exist ifallMustExistis true. IfallMustExistis false, only one of the parameters' values must exist.- Parameters:
name- name for the functionlambda- the associative function used to reduce the values:(integer, integer) -> integerparams- the expressions to reduceallMustExist- whether all parameters are required to exist- Returns:
- a single-value expression that reduces the parameters with the given lambda
-
createLongLambdaFunction
public static LongValueStream createLongLambdaFunction(String name, LambdaFunction.LongInLongOutLambda lambda, LongValueStream param)
Creates a function that takes in either a single or multi valued long expression and returns the same type of expression with the given lambda function applied to every value.- Parameters:
name- name for the functionlambda- the function to be applied to every value:(long) -> longparam- the expression to apply the lambda to- Returns:
- an expression the same type as was given with the lambda applied
-
createLongLambdaFunction
public static LongValue createLongLambdaFunction(String name, LambdaFunction.TwoLongInLongOutLambda lambda, LongValueStream param)
Creates a function that takes in a multi-valued long expression and returns a single-valued long expression. The given lambda is used to associatively (order not guaranteed) reduce all values for a document down to a single value.- Parameters:
name- name for the functionlambda- the associative function used to reduce the values:(boolean, boolean) -> booleanparam- the expression to be reduced per-document- Returns:
- a single-valued expression which has been reduced for every document
-
createLongLambdaFunction
public static LongValueStream createLongLambdaFunction(String name, LambdaFunction.TwoLongInLongOutLambda lambda, LongValueStream param1, LongValueStream param2) throws SolrException
Creates a function that maps two longs to a single long. This can take the following shapes:- Taking in two single-valued expressions and returning a single-valued expression which represents the lambda combination of the inputs.
- Taking in a single-valued expression and a multi-valued expression and returning a multi-valued expression which
represents the lambda combination of the single-value input with each of the values of the multi-value input.
The inputs can be eitherfunc(single,multi)orfunc(multi,single).
- Parameters:
name- name for the functionlambda- the function to be applied to every value:(long,long) -> longparam1- the first parameter in the lambdaparam2- the second parameter in the lambda- Returns:
- a single or multi valued expression combining the two parameters with the given lambda
- Throws:
SolrException- if neither parameter is single-valued
-
createLongLambdaFunction
public static LongValue createLongLambdaFunction(String name, LambdaFunction.TwoLongInLongOutLambda lambda, LongValue[] params)
Forwards the creation of the function tocreateLongLambdaFunction(String, TwoLongInLongOutLambda, LongValue[], boolean), using true for the last argument (allMustExist).- Parameters:
name- name for the functionlambda- the associative function used to reduce the values:(boolean, boolean) -> booleanparams- the expressions to reduce- Returns:
- a single-value expression that reduces the parameters with the given lambda
-
createLongLambdaFunction
public static LongValue createLongLambdaFunction(String name, LambdaFunction.TwoLongInLongOutLambda lambda, LongValue[] params, boolean allMustExist)
Creates a function that associatively (order is guaranteed) reduces multiple single-value long expressions into a single-value long expression for each document.
For a document, every parameter's value must exist for the resulting value to exist ifallMustExistis true. IfallMustExistis false, only one of the parameters' values must exist.- Parameters:
name- name for the functionlambda- the associative function used to reduce the values:(long, long) -> longparams- the expressions to reduceallMustExist- whether all parameters are required to exist- Returns:
- a single-value expression that reduces the parameters with the given lambda
-
createFloatLambdaFunction
public static FloatValueStream createFloatLambdaFunction(String name, LambdaFunction.FloatInFloatOutLambda lambda, FloatValueStream param)
Creates a function that takes in either a single or multi valued float expression and returns the same type of expression with the given lambda function applied to every value.- Parameters:
name- name for the functionlambda- the function to be applied to every value:(float) -> floatparam- the expression to apply the lambda to- Returns:
- an expression the same type as was given with the lambda applied
-
createFloatLambdaFunction
public static FloatValue createFloatLambdaFunction(String name, LambdaFunction.TwoFloatInFloatOutLambda lambda, FloatValueStream param)
Creates a function that takes in a multi-valued float expression and returns a single-valued float expression. The given lambda is used to associatively (order not guaranteed) reduce all values for a document down to a single value.- Parameters:
name- name for the functionlambda- the associative function used to reduce the values:(float, float) -> floatparam- the expression to be reduced per-document- Returns:
- a single-valued expression which has been reduced for every document
-
createFloatLambdaFunction
public static FloatValueStream createFloatLambdaFunction(String name, LambdaFunction.TwoFloatInFloatOutLambda lambda, FloatValueStream param1, FloatValueStream param2) throws SolrException
Creates a function that maps two floats to a single float. This can take the following shapes:- Taking in two single-valued expressions and returning a single-valued expression which represents the lambda combination of the inputs.
- Taking in a single-valued expression and a multi-valued expression and returning a multi-valued expression which
represents the lambda combination of the single-value input with each of the values of the multi-value input.
The inputs can be eitherfunc(single,multi)orfunc(multi,single).
- Parameters:
name- name for the functionlambda- the function to be applied to every value:(float,float) -> floatparam1- the first parameter in the lambdaparam2- the second parameter in the lambda- Returns:
- a single or multi valued expression combining the two parameters with the given lambda
- Throws:
SolrException- if neither parameter is single-valued
-
createFloatLambdaFunction
public static FloatValue createFloatLambdaFunction(String name, LambdaFunction.TwoFloatInFloatOutLambda lambda, FloatValue[] params)
Forwards the creation of the function tocreateFloatLambdaFunction(String, TwoFloatInFloatOutLambda, FloatValue[], boolean), using true for the last argument (allMustExist).- Parameters:
name- name for the functionlambda- the associative function used to reduce the values:(boolean, boolean) -> booleanparams- the expressions to reduce- Returns:
- a single-value expression that reduces the parameters with the given lambda
-
createFloatLambdaFunction
public static FloatValue createFloatLambdaFunction(String name, LambdaFunction.TwoFloatInFloatOutLambda lambda, FloatValue[] params, boolean allMustExist)
Creates a function that associatively (order is guaranteed) reduces multiple single-value float expressions into a single-value float expression for each document.
For a document, every parameter's value must exist for the resulting value to exist ifallMustExistis true. IfallMustExistis false, only one of the parameters' values must exist.- Parameters:
name- name for the functionlambda- the associative function used to reduce the values:(float, float) -> floatparams- the expressions to reduceallMustExist- whether all parameters are required to exist- Returns:
- a single-value expression that reduces the parameters with the given lambda
-
createDoubleLambdaFunction
public static DoubleValueStream createDoubleLambdaFunction(String name, LambdaFunction.DoubleInDoubleOutLambda lambda, DoubleValueStream param)
Creates a function that takes in either a single or multi valued double expression and returns the same type of expression with the given lambda function applied to every value.- Parameters:
name- name for the functionlambda- the function to be applied to every value:(double) -> doubleparam- the expression to apply the lambda to- Returns:
- an expression the same type as was given with the lambda applied
-
createDoubleLambdaFunction
public static DoubleValue createDoubleLambdaFunction(String name, LambdaFunction.TwoDoubleInDoubleOutLambda lambda, DoubleValueStream param)
Creates a function that takes in a multi-valued double expression and returns a single-valued double expression. The given lambda is used to associatively (order not guaranteed) reduce all values for a document down to a single value.- Parameters:
name- name for the functionlambda- the associative function used to reduce the values:(double, double) -> doubleparam- the expression to be reduced per-document- Returns:
- a single-valued expression which has been reduced for every document
-
createDoubleLambdaFunction
public static DoubleValueStream createDoubleLambdaFunction(String name, LambdaFunction.TwoDoubleInDoubleOutLambda lambda, DoubleValueStream param1, DoubleValueStream param2) throws SolrException
Creates a function that maps two doubles to a single double. This can take the following shapes:- Taking in two single-valued expressions and returning a single-valued expression which represents the lambda combination of the inputs.
- Taking in a single-valued expression and a multi-valued expression and returning a multi-valued expression which
represents the lambda combination of the single-value input with each of the values of the multi-value input.
The inputs can be eitherfunc(single,multi)orfunc(multi,single).
- Parameters:
name- name for the functionlambda- the function to be applied to every value:(double,double) -> doubleparam1- the first parameter in the lambdaparam2- the second parameter in the lambda- Returns:
- a single or multi valued expression combining the two parameters with the given lambda
- Throws:
SolrException- if neither parameter is single-valued
-
createDoubleLambdaFunction
public static DoubleValue createDoubleLambdaFunction(String name, LambdaFunction.TwoDoubleInDoubleOutLambda lambda, DoubleValue[] params)
Forwards the creation of the function tocreateDoubleLambdaFunction(String, TwoDoubleInDoubleOutLambda, DoubleValue[], boolean), using true for the last argument (allMustExist).- Parameters:
name- name for the functionlambda- the associative function used to reduce the values:(boolean, boolean) -> booleanparams- the expressions to reduce- Returns:
- a single-value expression that reduces the parameters with the given lambda
-
createDoubleLambdaFunction
public static DoubleValue createDoubleLambdaFunction(String name, LambdaFunction.TwoDoubleInDoubleOutLambda lambda, DoubleValue[] params, boolean allMustExist)
Creates a function that associatively (order is guaranteed) reduces multiple single-value double expressions into a single-value double expression for each document.
For a document, every parameter's value must exist for the resulting value to exist ifallMustExistis true. IfallMustExistis false, only one of the parameters' values must exist.- Parameters:
name- name for the functionlambda- the associative function used to reduce the values:(double, double) -> doubleparams- the expressions to reduceallMustExist- whether all parameters are required to exist- Returns:
- a single-value expression that reduces the parameters with the given lambda
-
createDateLambdaFunction
public static DateValueStream createDateLambdaFunction(String name, LambdaFunction.LongInLongOutLambda lambda, DateValueStream param)
Creates a function that takes in either a single or multi valued date expression and returns the same type of expression with the given lambda function applied to every value.NOTE: The lambda must work on longs, not Date objects
- Parameters:
name- name for the functionlambda- the function to be applied to every value:(long) -> longparam- the expression to apply the lambda to- Returns:
- an expression the same type as was given with the lambda applied
-
createDateLambdaFunction
public static DateValue createDateLambdaFunction(String name, LambdaFunction.TwoLongInLongOutLambda lambda, DateValueStream param)
Creates a function that takes in a multi-valued date expression and returns a single-valued date expression. The given lambda is used to associatively (order not guaranteed) reduce all values for a document down to a single value.NOTE: The lambda must work on longs, not Date objects
- Parameters:
name- name for the functionlambda- the associative function used to reduce the values:(long, long) -> longparam- the expression to be reduced per-document- Returns:
- a single-valued expression which has been reduced for every document
-
createDateLambdaFunction
public static DateValueStream createDateLambdaFunction(String name, LambdaFunction.TwoLongInLongOutLambda lambda, DateValueStream param1, DateValueStream param2) throws SolrException
Creates a function that maps two dates to a single date. This can take the following shapes:- Taking in two single-valued expressions and returning a single-valued expression which represents the lambda combination of the inputs.
- Taking in a single-valued expression and a multi-valued expression and returning a multi-valued expression which
represents the lambda combination of the single-value input with each of the values of the multi-value input.
The inputs can be eitherfunc(single,multi)orfunc(multi,single).
NOTE: The lambda must work on longs, not Date objects
- Parameters:
name- name for the functionlambda- the function to be applied to every value:(long,long) -> longparam1- the first parameter in the lambdaparam2- the second parameter in the lambda- Returns:
- a single or multi valued expression combining the two parameters with the given lambda
- Throws:
SolrException- if neither parameter is single-valued
-
createDateLambdaFunction
public static DateValue createDateLambdaFunction(String name, LambdaFunction.TwoLongInLongOutLambda lambda, DateValue[] params)
Forwards the creation of the function tocreateDateLambdaFunction(String, TwoLongInLongOutLambda, DateValue[], boolean), using true for the last argument (allMustExist).- Parameters:
name- name for the functionlambda- the associative function used to reduce the values:(boolean, boolean) -> booleanparams- the expressions to reduce- Returns:
- a single-value expression that reduces the parameters with the given lambda
-
createDateLambdaFunction
public static DateValue createDateLambdaFunction(String name, LambdaFunction.TwoLongInLongOutLambda lambda, DateValue[] params, boolean allMustExist)
Creates a function that associatively (order is guaranteed) reduces multiple single-value date expressions into a single-value date expression for each document.
For a document, every parameter's value must exist for the resulting value to exist ifallMustExistis true. IfallMustExistis false, only one of the parameters' values must exist.NOTE: The lambda must work on longs, not Date objects
- Parameters:
name- name for the functionlambda- the associative function used to reduce the values:(long, long) -> longparams- the expressions to reduceallMustExist- whether all parameters are required to exist- Returns:
- a single-value expression that reduces the parameters with the given lambda
-
createStringLambdaFunction
public static StringValueStream createStringLambdaFunction(String name, LambdaFunction.StringInStringOutLambda lambda, StringValueStream param)
Creates a function that takes in either a single or multi valued string expression and returns the same type of expression with the given lambda function applied to every value.- Parameters:
name- name for the functionlambda- the function to be applied to every value:(String) -> Stringparam- the expression to apply the lambda to- Returns:
- an expression the same type as was given with the lambda applied
-
createStringLambdaFunction
public static StringValue createStringLambdaFunction(String name, LambdaFunction.TwoStringInStringOutLambda lambda, StringValueStream param)
Creates a function that takes in a multi-valued string expression and returns a single-valued string expression. The given lambda is used to associatively (order not guaranteed) reduce all values for a document down to a single value.- Parameters:
name- name for the functionlambda- the associative function used to reduce the values:(String, String) -> Stringparam- the expression to be reduced per-document- Returns:
- a single-valued expression which has been reduced for every document
-
createStringLambdaFunction
public static StringValueStream createStringLambdaFunction(String name, LambdaFunction.TwoStringInStringOutLambda lambda, StringValueStream param1, StringValueStream param2) throws SolrException
Creates a function that maps two strings to a single string. This can take the following shapes:- Taking in two single-valued expressions and returning a single-valued expression which represents the lambda combination of the inputs.
- Taking in a single-valued expression and a multi-valued expression and returning a multi-valued expression which
represents the lambda combination of the single-value input with each of the values of the multi-value input.
The inputs can be eitherfunc(single,multi)orfunc(multi,single).
- Parameters:
name- name for the functionlambda- the function to be applied to every value:(String,String) -> Stringparam1- the first parameter in the lambdaparam2- the second parameter in the lambda- Returns:
- a single or multi valued expression combining the two parameters with the given lambda
- Throws:
SolrException- if neither parameter is single-valued
-
createStringLambdaFunction
public static StringValue createStringLambdaFunction(String name, LambdaFunction.TwoStringInStringOutLambda lambda, StringValue[] params)
Forwards the creation of the function tocreateStringLambdaFunction(String, TwoStringInStringOutLambda, StringValue[], boolean), using true for the last argument (allMustExist).- Parameters:
name- name for the functionlambda- the associative function used to reduce the values:(boolean, boolean) -> booleanparams- the expressions to reduce- Returns:
- a single-value expression that reduces the parameters with the given lambda
-
createStringLambdaFunction
public static StringValue createStringLambdaFunction(String name, LambdaFunction.TwoStringInStringOutLambda lambda, StringValue[] params, boolean allMustExist)
Creates a function that associatively (order is guaranteed) reduces multiple single-value string expressions into a single-value string expression for each document.
For a document, every parameter's value must exist for the resulting value to exist ifallMustExistis true. IfallMustExistis false, only one of the parameters' values must exist.- Parameters:
name- name for the functionlambda- the associative function used to reduce the values:(String, String) -> Stringparams- the expressions to reduceallMustExist- whether all parameters are required to exist- Returns:
- a single-value expression that reduces the parameters with the given lambda
-
-