Expose internal search source builder
This commit is contained in:
parent
3afe4da550
commit
8db2a217c0
|
@ -47,8 +47,6 @@ public class SearchRequestBuilder extends BaseRequestBuilder<SearchRequest, Sear
|
|||
|
||||
private SearchSourceBuilder sourceBuilder;
|
||||
|
||||
private HighlightBuilder highlightBuilder;
|
||||
|
||||
public SearchRequestBuilder(Client client) {
|
||||
super(client, new SearchRequest());
|
||||
}
|
||||
|
@ -376,10 +374,11 @@ public class SearchRequestBuilder extends BaseRequestBuilder<SearchRequest, Sear
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override protected void doExecute(ActionListener<SearchResponse> listener) {
|
||||
if (highlightBuilder != null) {
|
||||
sourceBuilder().highlight(highlightBuilder);
|
||||
public SearchSourceBuilder internalBuilder() {
|
||||
return sourceBuilder();
|
||||
}
|
||||
|
||||
@Override protected void doExecute(ActionListener<SearchResponse> listener) {
|
||||
request.source(sourceBuilder());
|
||||
client.search(request, listener);
|
||||
}
|
||||
|
@ -392,9 +391,6 @@ public class SearchRequestBuilder extends BaseRequestBuilder<SearchRequest, Sear
|
|||
}
|
||||
|
||||
private HighlightBuilder highlightBuilder() {
|
||||
if (highlightBuilder == null) {
|
||||
highlightBuilder = new HighlightBuilder();
|
||||
}
|
||||
return highlightBuilder;
|
||||
return sourceBuilder().highlighter();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -195,6 +195,13 @@ public class SearchSourceBuilder implements ToXContent {
|
|||
return this;
|
||||
}
|
||||
|
||||
public HighlightBuilder highlighter() {
|
||||
if (highlightBuilder == null) {
|
||||
highlightBuilder = new HighlightBuilder();
|
||||
}
|
||||
return highlightBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds highlight to perform as part of the search.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue