True, but on the other hand the rescore and suggest methods shouldn't end
up in TopHitsBuilder. I think by reusing SearchSourceBuilder we have good
control over what we expose and still have some code reuse.


On 22 May 2014 23:52, Adrien Grand <notifications@github.com> wrote:

> In
> src/main/java/org/elasticsearch/search/aggregations/bucket/tophits/TopHitsBuilder.java:
>
> > +    protected XContentBuilder internalXContent(XContentBuilder builder, Params params) throws IOException {
> > +        sourceBuilder.toXContent(builder, params);
> > +        return builder;
> > +    }
> > +
> > +    private SearchSourceBuilder sourceBuilder() {
> > +        if (sourceBuilder == null) {
> > +            sourceBuilder = new SearchSourceBuilder();
> > +        }
> > +        return sourceBuilder;
> > +    }
> > +
> > +    public HighlightBuilder highlightBuilder() {
> > +        return sourceBuilder().highlighter();
> > +    }
> > +}
>
> It's frustrating that we cannot share this code with SearchRequestBuiler.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/elasticsearch/elasticsearch/pull/6124/files#r12976641>
> .
>



-- 
Met vriendelijke groet,

Martijn van Groningen