use of com.enonic.xp.query.highlight.HighlightQuery in project xp by enonic.
the class QueryContentHandler method doExecute.
@Override
protected Object doExecute() {
final int start = valueOrDefault(this.start, 0);
final int count = valueOrDefault(this.count, GetChildContentHandler.DEFAULT_COUNT);
final ContentTypeNames contentTypeNames = getContentTypeNames();
final QueryExpr queryExpr = QueryExpr.from(buildConstraintExpr(), buildOrderExpr());
final Filters filters = JsonToFilterMapper.create(this.filters);
final Set<AggregationQuery> aggregations = new QueryAggregationParams().getAggregations(this.aggregations);
final HighlightQuery highlight = new QueryHighlightParams().getHighlightQuery(this.highlight);
final ContentQuery.Builder queryBuilder = ContentQuery.create().from(start).size(count).aggregationQueries(aggregations).highlight(highlight).addContentTypeNames(contentTypeNames).queryExpr(queryExpr);
for (final Filter filter : filters) {
queryBuilder.queryFilter(filter);
}
final FindContentIdsByQueryResult queryResult = contentService.find(queryBuilder.build());
return convert(queryResult);
}
use of com.enonic.xp.query.highlight.HighlightQuery in project xp by enonic.
the class AbstractFindNodesQueryHandler method createNodeQuery.
NodeQuery createNodeQuery() {
final int start = valueOrDefault(this.start, 0);
final int count = valueOrDefault(this.count, 10);
final QueryExpr queryExpr = QueryExpr.from(buildConstraintExpr(), buildOrderExpr());
final Filters filters = JsonToFilterMapper.create(this.filters);
final AggregationQueries aggregations = new QueryAggregationParams().getAggregations(this.aggregations);
final SuggestionQueries suggestions = new QuerySuggestionParams().getSuggestions(this.suggestions);
final HighlightQuery highlight = new QueryHighlightParams().getHighlightQuery(this.highlight);
return NodeQuery.create().from(start).size(count).addAggregationQueries(aggregations).addSuggestionQueries(suggestions).highlight(highlight).query(queryExpr).addQueryFilters(filters).explain(this.explain).build();
}
Aggregations