int hlsnippets = request.paramAsInt("hl.snippets", 1);
int hlfragsize = request.paramAsInt("hl.fragsize", 100);
String hlsimplepre = request.param("hl.simple.pre");
String hlsimplepost = request.param("hl.simple.post");
HighlightBuilder highlightBuilder = new HighlightBuilder();
if (hlfl == null) {
// run against default _all field
highlightBuilder.field("_all", hlfragsize, hlsnippets);
} else {
String[] hlfls = hlfl.split("\\s|,");
for (String hlField : hlfls) {
// skip wildcarded fields
if (!hlField.contains("*")) {
highlightBuilder.field(hlField, hlfragsize, hlsnippets);
}
}
}
// pre tags
if (hlsimplepre != null) {
highlightBuilder.preTags(hlsimplepre);
}
// post tags
if (hlsimplepost != null) {
highlightBuilder.postTags(hlsimplepost);
}
searchSourceBuilder.highlight(highlightBuilder);
}