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

Fold InternalSearchHits and friends into their interfaces #23042

Merged
merged 5 commits into from Feb 8, 2017

Conversation

s1monw
Copy link
Contributor

@s1monw s1monw commented Feb 8, 2017

We have a bunch of interfaces that have only a single implementation
for 6 years now. These interfaces are pretty useless from a SW development
perspective and only add unnecessary abstractions. They also require
lots of casting in many places where we expect that there is only one
concrete implementation. This change removes the interfaces, makes
all of the classes final and removes the duplicate foo getFoo accessors
in favor of getFoo from these classes.

We have a bunch of interfaces that have only a single implementation
for 6 years now. These interfaces are pretty useless from a SW development
perspective and only add unnecessary abstractions. They also require
lots of casting in many places where we expect that there is only one
concrete implementation. This change removes the interfaces, makes
all of the classes final and removes the duplicate `foo` `getFoo` accessors
in favor of `getFoo` from these classes.
@s1monw s1monw added :Core/Infra/Transport API Transport client API :Search/Search Search-related issues that do not fall into other categories >breaking-java >enhancement review v5.4.0 v6.0.0-alpha1 labels Feb 8, 2017
Copy link
Contributor

@jpountz jpountz left a comment

Choose a reason for hiding this comment

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

LGTM

for (int i = 0; i < reducedTopDocs.scoreDocs.length; i++) {
ScoreDoc scoreDoc = reducedTopDocs.scoreDocs[i];
int position;
do {
position = tracker[scoreDoc.shardIndex]++;
} while (shardDocs[scoreDoc.shardIndex].scoreDocs[position] != scoreDoc);
hits[i] = (InternalSearchHit) shardHits[scoreDoc.shardIndex].getAt(position);
hits[i] = (SearchHit) shardHits[scoreDoc.shardIndex].getAt(position);
Copy link
Contributor

Choose a reason for hiding this comment

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

is the cast necessary?

@@ -56,7 +55,7 @@ public void accept(SearchRequest searchRequest, SearchResponse searchResponse) {
return ;
}
for (SearchHit hit : searchResponse.getHits()) {
InternalSearchHit internalHit = (InternalSearchHit) hit;
SearchHit internalHit = (SearchHit) hit;
Copy link
Contributor

Choose a reason for hiding this comment

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

unnecessary cast

@@ -133,14 +133,14 @@ private Object randomOfType(SortField.Type type) {

@Override
protected void assertReduced(InternalTopHits reduced, List<InternalTopHits> inputs) {
InternalSearchHits actualHits = (InternalSearchHits) reduced.getHits();
List<Tuple<ScoreDoc, InternalSearchHit>> allHits = new ArrayList<>();
SearchHits actualHits = (SearchHits) reduced.getHits();
Copy link
Contributor

Choose a reason for hiding this comment

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

is the cast necessary?

InternalSearchHits internalHits = (InternalSearchHits) inputs.get(input).getHits();
totalHits += internalHits.totalHits();
maxScore = max(maxScore, internalHits.maxScore());
SearchHits internalHits = (SearchHits) inputs.get(input).getHits();
Copy link
Contributor

Choose a reason for hiding this comment

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

and here?

@s1monw s1monw merged commit ecb01c1 into elastic:master Feb 8, 2017
@s1monw s1monw deleted the trash_more_internal_classes branch February 8, 2017 13:40
@s1monw s1monw added v5.4.0 and removed v5.4.0 labels Feb 9, 2017
s1monw added a commit that referenced this pull request Feb 14, 2017
We have a bunch of interfaces that have only a single implementation
for 6 years now. These interfaces are pretty useless from a SW development
perspective and only add unnecessary abstractions. They also require
lots of casting in many places where we expect that there is only one
concrete implementation. This change removes the interfaces, makes
all of the classes final and removes the duplicate `foo` `getFoo` accessors
in favor of `getFoo` from these classes.

This is a backport of ecb01c1 that deprecates
all methods that are removed in 6.0
SGM3 added a commit to SGM3/liferay-portal that referenced this pull request Jul 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>breaking-java :Core/Infra/Transport API Transport client API >enhancement :Search/Search Search-related issues that do not fall into other categories v5.4.0 v6.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants