Java 类org.elasticsearch.index.query.BaseFilterBuilder 实例源码

项目:elasticsql    文件:FilterMaker.java   
private void explanWhere(BoolFilterBuilder boolFilter, Where where) throws SqlParseException {
    while (where.getWheres().size() == 1) {
        where = where.getWheres().getFirst();
    }
    if (where instanceof Condition) {
        addSubFilter(boolFilter, where, (BaseFilterBuilder) make((Condition) where));
    } else {
        BoolFilterBuilder subFilter = FilterBuilders.boolFilter();
        addSubFilter(boolFilter, where, subFilter);
        for (Where subWhere : where.getWheres()) {
            explanWhere(subFilter, subWhere);
        }
    }
}
项目:elasticsql    文件:FilterMaker.java   
/**
 * 增加嵌套插
 * 
 * @param boolFilter
 * @param where
 * @param subFilter
 */
private void addSubFilter(BoolFilterBuilder boolFilter, Where where, BaseFilterBuilder subFilter) {
    if (where.getConn() == CONN.AND) {
        boolFilter.must(subFilter);
    } else {
        boolFilter.should(subFilter);
    }
}