[ 
https://issues.apache.org/jira/browse/SOLR-9916?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dennis Gove updated SOLR-9916:
------------------------------
    Attachment: SOLR-9916.patch

This is complete. All tests pass.

I have deleted and replaced all existing BooleanOperations with their requisite 
BooleanEvaluators and added additional evaluators.

The registration of default evaluators looks like this
{code}
// Stream Evaluators
.withFunctionName("val", RawValueEvaluator.class)

// Boolean Stream Evaluators
.withFunctionName("and", AndEvaluator.class)
.withFunctionName("eor", ExclusiveOrEvaluator.class)
.withFunctionName("eq", EqualsEvaluator.class)
.withFunctionName("gt", GreaterThanEvaluator.class)
.withFunctionName("gteq", GreaterThanEqualToEvaluator.class)
.withFunctionName("lt", LessThanEvaluator.class)
.withFunctionName("lteq", LessThanEqualToEvaluator.class)
.withFunctionName("not", NotEvaluator.class)
.withFunctionName("or", OrEvaluator.class)

// Number Stream Evaluators
.withFunctionName("abs", AbsoluteValueEvaluator.class)
.withFunctionName("add", AddEvaluator.class)
.withFunctionName("div", DivideEvaluator.class)
.withFunctionName("mult", MultiplyEvaluator.class)
.withFunctionName("sub", SubtractEvaluator.class)

// Conditional Stream Evaluators
.withFunctionName("if", IfThenElseEvaluator.class)
{code}

All evaluators accept the following parameter formats
{code}
add(abc,def) // field abc + field def
add(sub(abc,def),ghi) // (field abc - field def) + field ghi
add(abc,9) // field abc + 9
add(sum(abc), def) // field sum(abc) + field def
{code}

Basically, when an evaluator is parsing its parameters it will first determine 
if the parameter is another evaluator. If not, then it will determine if the 
parameter is a Double, Long, or Boolean raw value. If not, it will treat the 
parameter as a field name. This allows us to use field names like "sum(abc)" 
which are the result of rollups and use raw values and use embedded evaluators.

> Add arithmetic operations to the SelectStream
> ---------------------------------------------
>
>                 Key: SOLR-9916
>                 URL: https://issues.apache.org/jira/browse/SOLR-9916
>             Project: Solr
>          Issue Type: New Feature
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Joel Bernstein
>         Attachments: SOLR-9916.patch, SOLR-9916.patch
>
>
> One of the things that will be needed as the SQL implementation matures is 
> the ability to do arithmetic operations. For example:
> select (a+b) from x;
> select sum(a)+sum(b) from x;
> We will need to support arithmetic operations within the Streaming API to 
> support these types of operations.
> It looks like adding arithmetic operations to the SelectStream is the best 
> place to add this functionality.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to