예제 #1
0
 public Query toQuery(Reference reference, DataType type, Object value) {
   String columnName = reference.info().ident().columnIdent().fqn();
   QueryBuilderHelper builder = QueryBuilderHelper.forType(type);
   Tuple<?, ?> bounds = boundsFunction.apply(value);
   assert bounds != null;
   return builder.rangeQuery(columnName, bounds.v1(), bounds.v2(), includeLower, includeUpper);
 }
예제 #2
0
      @Override
      protected Query applyArrayReference(
          Reference arrayReference, Literal literal, Context context) throws IOException {
        // 1 != any ( col ) -->  gt 1 or lt 1
        String columnName = arrayReference.info().ident().columnIdent().fqn();
        Object value = literal.value();

        QueryBuilderHelper builder = QueryBuilderHelper.forType(arrayReference.valueType());
        BooleanQuery query = new BooleanQuery();
        query.setMinimumNumberShouldMatch(1);
        query.add(
            builder.rangeQuery(columnName, value, null, false, false), BooleanClause.Occur.SHOULD);
        query.add(
            builder.rangeQuery(columnName, null, value, false, false), BooleanClause.Occur.SHOULD);
        return query;
      }