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);
}
Aggregations