summaryrefslogtreecommitdiff
path: root/core/src/main/java/org/elasticsearch/search/suggest/completion
diff options
context:
space:
mode:
authorSimon Willnauer <simonw@apache.org>2017-02-08 14:40:08 +0100
committerGitHub <noreply@github.com>2017-02-08 14:40:08 +0100
commitecb01c15b9a6645f22f153eb099a377e70e398c8 (patch)
tree6281a85417a51ac6265e44d93ff92322fee4b199 /core/src/main/java/org/elasticsearch/search/suggest/completion
parent2d6d871f5c70b11c23a5b99b5e3a0bf0cff8c6b0 (diff)
Fold InternalSearchHits and friends into their interfaces (#23042)
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.
Diffstat (limited to 'core/src/main/java/org/elasticsearch/search/suggest/completion')
-rw-r--r--core/src/main/java/org/elasticsearch/search/suggest/completion/CompletionSuggestion.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/core/src/main/java/org/elasticsearch/search/suggest/completion/CompletionSuggestion.java b/core/src/main/java/org/elasticsearch/search/suggest/completion/CompletionSuggestion.java
index c86c056522..1d8da83271 100644
--- a/core/src/main/java/org/elasticsearch/search/suggest/completion/CompletionSuggestion.java
+++ b/core/src/main/java/org/elasticsearch/search/suggest/completion/CompletionSuggestion.java
@@ -25,12 +25,10 @@ import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.lucene.Lucene;
import org.elasticsearch.common.text.Text;
import org.elasticsearch.common.xcontent.XContentBuilder;
-import org.elasticsearch.search.internal.InternalSearchHit;
-import org.elasticsearch.search.internal.InternalSearchHits;
+import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.suggest.Suggest;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
@@ -194,7 +192,7 @@ public final class CompletionSuggestion extends Suggest.Suggestion<CompletionSug
public static class Option extends Suggest.Suggestion.Entry.Option {
private Map<String, Set<CharSequence>> contexts;
private ScoreDoc doc;
- private InternalSearchHit hit;
+ private SearchHit hit;
public Option(int docID, Text text, float score, Map<String, Set<CharSequence>> contexts) {
super(text, score);
@@ -221,7 +219,7 @@ public final class CompletionSuggestion extends Suggest.Suggestion<CompletionSug
return doc;
}
- public InternalSearchHit getHit() {
+ public SearchHit getHit() {
return hit;
}
@@ -229,7 +227,7 @@ public final class CompletionSuggestion extends Suggest.Suggestion<CompletionSug
this.doc.shardIndex = shardIndex;
}
- public void setHit(InternalSearchHit hit) {
+ public void setHit(SearchHit hit) {
this.hit = hit;
}
@@ -260,7 +258,7 @@ public final class CompletionSuggestion extends Suggest.Suggestion<CompletionSug
super.readFrom(in);
this.doc = Lucene.readScoreDoc(in);
if (in.readBoolean()) {
- this.hit = InternalSearchHit.readSearchHit(in);
+ this.hit = SearchHit.readSearchHit(in);
}
int contextSize = in.readInt();
this.contexts = new LinkedHashMap<>(contextSize);