Source:
protected static String buildQueryStringWithPageProvider(PageProvider provider, boolean useAggregates) { String quickFiltersClause = ""; List<QuickFilter> quickFilters = provider.getQuickFilters(); if (quickFilters != null) { for (QuickFilter quickFilter : quickFilters) { String clause = quickFilter.getClause(); if (!quickFiltersClause.isEmpty() && clause != null) { quickFiltersClause = NXQLQueryBuilder.appendClause(quickFiltersClause, clause); } else { quickFiltersClause = StringUtils.defaultString(clause); } } } String aggregatesClause = useAggregates ? buildAggregatesClause(provider) : null; PageProviderDefinition def = provider.getDefinition(); WhereClauseDefinition whereClause = def.getWhereClause(); DocumentModel searchDocumentModel = provider.getSearchDocumentModel(); Object[] parameters = provider.getParameters(); String query; if (whereClause == null) { String pattern = def.getPattern(); if (!quickFiltersClause.isEmpty()) { pattern = appendToPattern(pattern, quickFiltersClause); } if (StringUtils.isNotEmpty(aggregatesClause)) { pattern = appendToPattern(pattern, aggregatesClause); } query = NXQLQueryBuilder.getQuery(pattern, parameters, def.getQuotePatternParameters(), def.getEscapePatternParameters(), searchDocumentModel, null); } else { if (searchDocumentModel == null) { throw new NuxeoException( String.format("Cannot build query of provider '%s': " + "no search document model is set", provider.getName())); } String additionalClause = aggregatesClause; if (StringUtils.isNotEmpty(quickFiltersClause)) { additionalClause = StringUtils.isNotEmpty(additionalClause) ? NXQLQueryBuilder.appendClause(additionalClause, quickFiltersClause) : quickFiltersClause; } query = NXQLQueryBuilder.getQuery(searchDocumentModel, whereClause, additionalClause, parameters, null); } return query; }

Target:
protected static String buildQueryStringWithPageProvider(PageProvider provider, boolean useAggregates) { String quickFiltersClause = ""; List<QuickFilter> quickFilters = provider.getQuickFilters(); if (quickFilters != null) { for (QuickFilter quickFilter : quickFilters) { String clause = quickFilter.getClause(); if (!quickFiltersClause.isEmpty() && clause != null) { quickFiltersClause = NXQLQueryBuilder.appendClause(quickFiltersClause, clause); } else { quickFiltersClause = StringUtils.defaultString(clause); } } } String aggregatesClause = useAggregates ? buildAggregatesClause(provider) : null; PageProviderDefinition def = provider.getDefinition(); WhereClauseDefinition whereClause = def.getWhereClause(); DocumentModel searchDocumentModel = provider.getSearchDocumentModel(); Object[] parameters = provider.getParameters(); String query; if (whereClause == null) { String pattern = def.getPattern(); if (!quickFiltersClause.isEmpty()) { pattern = appendToPattern(pattern, quickFiltersClause); } if (StringUtils.isNotEmpty(aggregatesClause)) { pattern = appendToPattern(pattern, aggregatesClause); } query = NXQLQueryBuilder.getQuery(pattern, parameters, def.getQuotePatternParameters(), def.getEscapePatternParameters(), searchDocumentModel, null); } else { if (searchDocumentModel == null) { throw new NuxeoException( String.format("Cannot build query of provider '%s': " + "no search document model is set", provider.getName())); } String additionalClause = NXQLQueryBuilder.appendClause(aggregatesClause, quickFiltersClause); query = NXQLQueryBuilder.getQuery(searchDocumentModel, whereClause, additionalClause, parameters, null); } return query; }