Search in sources :

Example 41 with StreamEvaluator

use of org.apache.solr.client.solrj.io.eval.StreamEvaluator in project lucene-solr by apache.

the class MultiplyEvaluatorTest method multTwoFieldWithNulls.

@Test
public void multTwoFieldWithNulls() throws Exception {
    StreamEvaluator evaluator = factory.constructEvaluator("mult(a,b)");
    Object result;
    values.clear();
    result = evaluator.evaluate(new Tuple(values));
    Assert.assertNull(result);
}
Also used : StreamEvaluator(org.apache.solr.client.solrj.io.eval.StreamEvaluator) Tuple(org.apache.solr.client.solrj.io.Tuple) Test(org.junit.Test)

Example 42 with StreamEvaluator

use of org.apache.solr.client.solrj.io.eval.StreamEvaluator in project lucene-solr by apache.

the class NaturalLogEvaluatorTest method logNullValue.

@Test
public void logNullValue() throws Exception {
    StreamEvaluator evaluator = factory.constructEvaluator("log(a)");
    values.clear();
    values.put("a", null);
    Object result = evaluator.evaluate(new Tuple(values));
    assertNull(result);
}
Also used : StreamEvaluator(org.apache.solr.client.solrj.io.eval.StreamEvaluator) Tuple(org.apache.solr.client.solrj.io.Tuple) Test(org.junit.Test)

Example 43 with StreamEvaluator

use of org.apache.solr.client.solrj.io.eval.StreamEvaluator in project lucene-solr by apache.

the class NaturalLogEvaluatorTest method logNoValue.

@Test
public void logNoValue() throws Exception {
    StreamEvaluator evaluator = factory.constructEvaluator("log(a)");
    values.clear();
    Object result = evaluator.evaluate(new Tuple(values));
    assertNull(result);
}
Also used : StreamEvaluator(org.apache.solr.client.solrj.io.eval.StreamEvaluator) Tuple(org.apache.solr.client.solrj.io.Tuple) Test(org.junit.Test)

Example 44 with StreamEvaluator

use of org.apache.solr.client.solrj.io.eval.StreamEvaluator in project lucene-solr by apache.

the class GreaterThanEqualToEvaluatorTest method gteDifferentTypes3.

@Test(expected = IOException.class)
public void gteDifferentTypes3() throws Exception {
    StreamEvaluator evaluator = factory.constructEvaluator("gte(a,b)");
    values.clear();
    values.put("a", "1");
    values.put("b", 1);
    evaluator.evaluate(new Tuple(values));
}
Also used : StreamEvaluator(org.apache.solr.client.solrj.io.eval.StreamEvaluator) Tuple(org.apache.solr.client.solrj.io.Tuple) Test(org.junit.Test)

Example 45 with StreamEvaluator

use of org.apache.solr.client.solrj.io.eval.StreamEvaluator in project lucene-solr by apache.

the class GreaterThanEqualToEvaluatorTest method gteTwoBooleans.

@Test(expected = IOException.class)
public void gteTwoBooleans() throws Exception {
    StreamEvaluator evaluator = factory.constructEvaluator("gte(a,b)");
    values.clear();
    values.put("a", true);
    values.put("b", true);
    evaluator.evaluate(new Tuple(values));
}
Also used : StreamEvaluator(org.apache.solr.client.solrj.io.eval.StreamEvaluator) Tuple(org.apache.solr.client.solrj.io.Tuple) Test(org.junit.Test)

Aggregations

StreamEvaluator (org.apache.solr.client.solrj.io.eval.StreamEvaluator)137 Tuple (org.apache.solr.client.solrj.io.Tuple)135 Test (org.junit.Test)119 StreamContext (org.apache.solr.client.solrj.io.stream.StreamContext)6 HashMap (java.util.HashMap)4 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 UUID (java.util.UUID)1 StreamOperation (org.apache.solr.client.solrj.io.ops.StreamOperation)1