use of org.apache.solr.client.solrj.io.eval.StreamEvaluator in project lucene-solr by apache.
the class GreaterThanEqualToEvaluatorTest method gteDifferentTypes4.
@Test(expected = IOException.class)
public void gteDifferentTypes4() throws Exception {
StreamEvaluator evaluator = factory.constructEvaluator("gte(a,b)");
values.clear();
values.put("a", "true");
values.put("b", true);
evaluator.evaluate(new Tuple(values));
}
use of org.apache.solr.client.solrj.io.eval.StreamEvaluator in project lucene-solr by apache.
the class GreaterThanEqualToEvaluatorTest method gteTwoStrings.
@Test
public void gteTwoStrings() throws Exception {
StreamEvaluator evaluator = factory.constructEvaluator("gte(a,b)");
Object result;
String foo = "foo";
String bar = "bar";
values.clear();
values.put("a", "foo");
values.put("b", "foo");
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Boolean);
Assert.assertEquals(true, result);
values.clear();
values.put("a", "foo");
values.put("b", "bar");
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Boolean);
Assert.assertEquals(true, result);
values.clear();
values.put("a", "foo bar baz");
values.put("b", "foo bar baz");
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Boolean);
Assert.assertEquals(true, result);
values.clear();
values.put("a", "foo bar baz");
values.put("b", "foo bar jaz");
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Boolean);
Assert.assertEquals(false, result);
values.clear();
values.put("a", foo);
values.put("b", foo);
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Boolean);
Assert.assertEquals(true, result);
values.clear();
values.put("a", foo);
values.put("b", bar);
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Boolean);
Assert.assertEquals(true, result);
}
use of org.apache.solr.client.solrj.io.eval.StreamEvaluator in project lucene-solr by apache.
the class ModuloEvaluatorTest method modTwoFieldsWithMissingNumerator.
@Test(expected = IOException.class)
public void modTwoFieldsWithMissingNumerator() throws Exception {
StreamEvaluator evaluator = factory.constructEvaluator("mod(a,b)");
values.clear();
values.put("b", 1);
evaluator.evaluate(new Tuple(values));
}
use of org.apache.solr.client.solrj.io.eval.StreamEvaluator in project lucene-solr by apache.
the class ModuloEvaluatorTest method modTwoFieldsWithMissingDenominator.
@Test(expected = IOException.class)
public void modTwoFieldsWithMissingDenominator() throws Exception {
StreamEvaluator evaluator = factory.constructEvaluator("mod(a,b)");
values.clear();
values.put("a", 1);
evaluator.evaluate(new Tuple(values));
}
use of org.apache.solr.client.solrj.io.eval.StreamEvaluator in project lucene-solr by apache.
the class ModuloEvaluatorTest method modManyFieldsWithSubmods.
@Test
public void modManyFieldsWithSubmods() throws Exception {
StreamEvaluator evaluator = factory.constructEvaluator("mod(a,mod(b,c))");
Object result;
values.clear();
values.put("a", 1);
values.put("b", 2);
values.put("c", 9);
result = evaluator.evaluate(new Tuple(values));
Assert.assertTrue(result instanceof Long);
Assert.assertEquals(Long.valueOf(1 % (2 % 9)), result);
}
Aggregations