Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the SearchContext from the highlighter context #47733

Merged
merged 9 commits into from
Oct 9, 2019

Conversation

jimczi
Copy link
Contributor

@jimczi jimczi commented Oct 8, 2019

Today built-in highlighter and plugins have access to the SearchContext through the
highlighter context. However most of the information exposed in the SearchContext are not needed and a QueryShardContext
would be enough to perform highlighting. This change replaces the SearchContext by the informations that are absolutely
required by highlighter: a QueryShardContext and the SearchContextHighlight. This change allows to reduce the exposure of the
complex SearchContext and remove the needs to clone it in the percolator sub phase.

Relates #47198
Relates #46523

Today built-in highlighter and plugins have access to the SearchContext through the
highlighter context. However most of the information exposed in the SearchContext are not needed and a QueryShardContext
would be enough to perform highlighting. This change replaces the SearchContext by the informations that are absolutely
required by highlighter: a QueryShardContext and the SearchContextHighlight. This change allows to reduce the exposure of the
complex SearchContext and remove the needs to clone it in the percolator sub phase.

Relates elastic#47198
Relates elastic#46523
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (:Search/Highlighting)

Copy link
Contributor

@romseygeek romseygeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I have one question but I think that's just a typo and will get caught by tests.

hitContext.reset(
new SearchHit(slot, "unknown", Collections.emptyMap()),
percolatorLeafReaderContext, slot, percolatorIndexSearcher
);
hitContext.cache().clear();
highlightPhase.hitExecute(subSearchContext, hitContext);
highlightPhase.hitExecute(context.shardTarget(), context.getQueryShardContext(), query, highlight, hitContext);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be passing shardContext rather than context.getQueryShardContext()?

@jimczi
Copy link
Contributor Author

jimczi commented Oct 9, 2019

@elasticmachine run elasticsearch-ci/2

@jimczi
Copy link
Contributor Author

jimczi commented Oct 9, 2019

@elasticmachine run elasticsearch-ci/packaging-sample

@jimczi
Copy link
Contributor Author

jimczi commented Oct 9, 2019

@elasticmachine update branch

Copy link
Member

@javanna javanna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jimczi jimczi merged commit a8dae10 into elastic:master Oct 9, 2019
@jimczi jimczi deleted the search_context_highlight_sub_phase branch October 9, 2019 12:40
jimczi added a commit that referenced this pull request Oct 10, 2019
Today built-in highlighter and plugins have access to the SearchContext through the
highlighter context. However most of the information exposed in the SearchContext are not needed and a QueryShardContext
would be enough to perform highlighting. This change replaces the SearchContext by the informations that are absolutely
required by highlighter: a QueryShardContext and the SearchContextHighlight. This change allows to reduce the exposure of the
complex SearchContext and remove the needs to clone it in the percolator sub phase.

Relates #47198
Relates #46523
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants