use of org.graylog.shaded.elasticsearch6.org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder in project graylog2-server by Graylog2.
the class SearchesAdapterES6 method applyHighlighting.
private void applyHighlighting(SearchSourceBuilder searchSourceBuilder, ScrollCommand scrollCommand) {
if (scrollCommand.highlight() && configuration.isAllowHighlighting()) {
final HighlightBuilder highlightBuilder = new HighlightBuilder().requireFieldMatch(false).field("*").fragmentSize(0).numOfFragments(0);
searchSourceBuilder.highlighter(highlightBuilder);
}
}
use of org.graylog.shaded.elasticsearch6.org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder in project graylog2-server by Graylog2.
the class SearchesAdapterES6 method standardSearchRequest.
private SearchSourceBuilder standardSearchRequest(String query, int limit, int offset, TimeRange range, String filter, Sorting sort, boolean highlight) {
if (query == null || query.trim().isEmpty()) {
query = "*";
}
final QueryBuilder queryBuilder;
if ("*".equals(query.trim())) {
queryBuilder = matchAllQuery();
} else {
queryBuilder = queryStringQuery(query).allowLeadingWildcard(configuration.isAllowLeadingWildcardSearches());
}
final SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder().query(QueryBuilders.boolQuery().must(queryBuilder).filter(standardFilters(range, filter)));
if (offset >= 0) {
searchSourceBuilder.from(offset);
}
if (limit > 0) {
searchSourceBuilder.size(limit);
}
if (sort != null) {
searchSourceBuilder.sort(sort.getField(), sortOrderMapper.fromSorting(sort));
}
if (highlight && configuration.isAllowHighlighting()) {
final HighlightBuilder highlightBuilder = new HighlightBuilder().requireFieldMatch(false).field("*").fragmentSize(0).numOfFragments(0);
searchSourceBuilder.highlighter(highlightBuilder);
}
return searchSourceBuilder;
}
use of org.graylog.shaded.elasticsearch6.org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder in project graylog2-server by Graylog2.
the class SearchRequestFactory method applyHighlighting.
private void applyHighlighting(SearchSourceBuilder searchSourceBuilder) {
if (allowHighlighting) {
final HighlightBuilder highlightBuilder = new HighlightBuilder().requireFieldMatch(false).field("*").fragmentSize(0).numOfFragments(0);
searchSourceBuilder.highlighter(highlightBuilder);
}
}
Aggregations