Search in sources :

Example 26 with Tuple

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

the class FloorEvaluatorTest method floorNoValue.

@Test
public void floorNoValue() throws Exception {
    StreamEvaluator evaluator = factory.constructEvaluator("floor(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 27 with Tuple

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

the class HyperbolicTangentEvaluatorTest method noValue.

@Test
public void noValue() throws Exception {
    StreamEvaluator evaluator = factory.constructEvaluator("tanh(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 28 with Tuple

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

the class CubedRootEvaluatorTest method noValue.

@Test
public void noValue() throws Exception {
    StreamEvaluator evaluator = factory.constructEvaluator("cbrt(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 29 with Tuple

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

the class DivideEvaluatorTest method divTwoFieldsWithValues.

@Test
public void divTwoFieldsWithValues() throws Exception {
    StreamEvaluator evaluator = factory.constructEvaluator("div(a,b)");
    Object result;
    values.clear();
    values.put("a", 1);
    values.put("b", 2);
    result = evaluator.evaluate(new Tuple(values));
    Assert.assertTrue(result instanceof Double);
    Assert.assertEquals(1.0 / 2, result);
    values.clear();
    values.put("a", 1.1);
    values.put("b", 2);
    result = evaluator.evaluate(new Tuple(values));
    Assert.assertTrue(result instanceof Double);
    Assert.assertEquals(1.1 / 2, result);
    values.clear();
    values.put("a", 1.1);
    values.put("b", 2.1);
    result = evaluator.evaluate(new Tuple(values));
    Assert.assertTrue(result instanceof Double);
    Assert.assertEquals(1.1 / 2.1, 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 30 with Tuple

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

the class DivideEvaluatorTest method divTwoFieldsWithMissingNumerator.

@Test(expected = IOException.class)
public void divTwoFieldsWithMissingNumerator() throws Exception {
    StreamEvaluator evaluator = factory.constructEvaluator("div(a,b)");
    values.clear();
    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)

Aggregations

Tuple (org.apache.solr.client.solrj.io.Tuple)382 Test (org.junit.Test)259 StreamEvaluator (org.apache.solr.client.solrj.io.eval.StreamEvaluator)135 UpdateRequest (org.apache.solr.client.solrj.request.UpdateRequest)114 SolrClientCache (org.apache.solr.client.solrj.io.SolrClientCache)92 ModifiableSolrParams (org.apache.solr.common.params.ModifiableSolrParams)88 StreamFactory (org.apache.solr.client.solrj.io.stream.expr.StreamFactory)64 HashMap (java.util.HashMap)54 ArrayList (java.util.ArrayList)47 SolrParams (org.apache.solr.common.params.SolrParams)43 Map (java.util.Map)41 StreamExpression (org.apache.solr.client.solrj.io.stream.expr.StreamExpression)36 IOException (java.io.IOException)34 List (java.util.List)28 FieldComparator (org.apache.solr.client.solrj.io.comp.FieldComparator)23 StreamOperation (org.apache.solr.client.solrj.io.ops.StreamOperation)16 MultipleFieldComparator (org.apache.solr.client.solrj.io.comp.MultipleFieldComparator)15 SolrStream (org.apache.solr.client.solrj.io.stream.SolrStream)15 MeanMetric (org.apache.solr.client.solrj.io.stream.metrics.MeanMetric)15 MinMetric (org.apache.solr.client.solrj.io.stream.metrics.MinMetric)14