private QueryBuilder createQueryBuilder(final NodeVersionQuery nodeVersionQuery) { final QueryBuilderFactory.Builder queryBuilderBuilder = QueryBuilderFactory.newBuilder() .queryExpr(nodeVersionQuery.getQuery()) .addQueryFilters(nodeVersionQuery.getQueryFilters()) .fieldNameResolver(this.fieldNameResolver); addNodeIdFilter(nodeVersionQuery, queryBuilderBuilder); return queryBuilderBuilder.build().create(); }
private static void addNodeIdFilter( final NodeVersionQuery nodeVersionQuery, final QueryBuilderFactory.Builder queryBuilderBuilder) { if (nodeVersionQuery.getNodeId() != null) { queryBuilderBuilder.addQueryFilter( ValueFilter.create() .fieldName(VersionIndexPath.NODE_ID.getPath()) .addValue(ValueFactory.newString(nodeVersionQuery.getNodeId().toString())) .build()); } }