Search in sources :

Example 1 with DslRangeQuery

use of io.vertigo.dynamox.search.dsl.model.DslRangeQuery in project vertigo by KleeGroup.

the class DslRangeQueryRule method handle.

/**
 * {@inheritDoc}
 */
@Override
protected DslRangeQuery handle(final List<Object> parsing) {
    final String preQuery = (String) parsing.get(0);
    final PegChoice startChoice = (PegChoice) parsing.get(1);
    final PegChoice startTermQuery = (PegChoice) parsing.get(2);
    final DslQuery startQueryDefinitions;
    if (startTermQuery.getChoiceIndex() == 0) {
        startQueryDefinitions = new DslFixedQuery("*");
    } else {
        startQueryDefinitions = (DslQuery) startTermQuery.getValue();
    }
    final PegChoice endTermQuery = (PegChoice) parsing.get(6);
    final DslQuery endQueryDefinitions;
    if (endTermQuery.getChoiceIndex() == 0) {
        endQueryDefinitions = new DslFixedQuery("*");
    } else {
        endQueryDefinitions = (DslQuery) endTermQuery.getValue();
    }
    final PegChoice endChoice = (PegChoice) parsing.get(8);
    final String postQuery = (String) parsing.get(9);
    final String startRange = (String) startChoice.getValue();
    final String endRange = (String) endChoice.getValue();
    return new DslRangeQuery(preQuery, startRange, startQueryDefinitions, endQueryDefinitions, endRange, postQuery);
}
Also used : DslFixedQuery(io.vertigo.dynamox.search.dsl.model.DslFixedQuery) DslRangeQuery(io.vertigo.dynamox.search.dsl.model.DslRangeQuery) PegChoice(io.vertigo.commons.peg.PegChoice) DslQuery(io.vertigo.dynamox.search.dsl.model.DslQuery)

Aggregations

PegChoice (io.vertigo.commons.peg.PegChoice)1 DslFixedQuery (io.vertigo.dynamox.search.dsl.model.DslFixedQuery)1 DslQuery (io.vertigo.dynamox.search.dsl.model.DslQuery)1 DslRangeQuery (io.vertigo.dynamox.search.dsl.model.DslRangeQuery)1