Search in sources :

Example 1 with TemporalEvaluatorDay

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

the class TemporalEvaluatorsTest method testExplain.

@Test
public void testExplain() throws IOException {
    StreamExpression express = StreamExpressionParser.parse("month('myfield')");
    TemporalEvaluatorMonth datePartEvaluator = new TemporalEvaluatorMonth(express, factory);
    Explanation explain = datePartEvaluator.toExplanation(factory);
    assertEquals("month(myfield)", explain.getExpression());
    express = StreamExpressionParser.parse("day(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbb)");
    TemporalEvaluatorDay dayPartEvaluator = new TemporalEvaluatorDay(express, factory);
    explain = dayPartEvaluator.toExplanation(factory);
    assertEquals("day(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbb)", explain.getExpression());
}
Also used : StreamExpression(org.apache.solr.client.solrj.io.stream.expr.StreamExpression) TemporalEvaluatorDay(org.apache.solr.client.solrj.io.eval.TemporalEvaluatorDay) Explanation(org.apache.solr.client.solrj.io.stream.expr.Explanation) TemporalEvaluatorMonth(org.apache.solr.client.solrj.io.eval.TemporalEvaluatorMonth) Test(org.junit.Test)

Aggregations

TemporalEvaluatorDay (org.apache.solr.client.solrj.io.eval.TemporalEvaluatorDay)1 TemporalEvaluatorMonth (org.apache.solr.client.solrj.io.eval.TemporalEvaluatorMonth)1 Explanation (org.apache.solr.client.solrj.io.stream.expr.Explanation)1 StreamExpression (org.apache.solr.client.solrj.io.stream.expr.StreamExpression)1 Test (org.junit.Test)1