diff options
Diffstat (limited to 'container-search/src/main/java/com/yahoo/prelude')
4 files changed, 8 insertions, 10 deletions
diff --git a/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastHit.java b/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastHit.java index b5e5ed9ed8f..7d4e2e8ef0a 100644 --- a/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastHit.java +++ b/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastHit.java @@ -13,7 +13,6 @@ import com.yahoo.data.access.Inspector; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -62,7 +61,7 @@ public class FastHit extends Hit { * that most fields passes through the container with no processing most * of the time. */ - private List<SummaryData> summaries = Collections.emptyList(); + private List<SummaryData> summaries = List.of(); /** Removed field values, which should therefore not be returned if present in summary data */ private Set<String> removedFields = null; @@ -275,7 +274,8 @@ public class FastHit extends Hit { /** Removes all fields of this */ @Override public void clearFields() { - summaries.clear(); + if (!summaries.isEmpty()) + summaries.clear(); if (removedFields != null) removedFields = null; super.clearFields(); @@ -481,7 +481,7 @@ public class FastHit extends Hit { private Set<String> createSet() { if (this.fieldSet != null) return this.fieldSet; - if ( ! hit.hasFields() && hit.summaries.isEmpty()) return Collections.emptySet(); // shortcut + if ( ! hit.hasFields() && hit.summaries.isEmpty()) return Set.of(); // shortcut Set<String> fields = new HashSet<>(); if (hit.hasFields()) diff --git a/container-search/src/main/java/com/yahoo/prelude/query/parser/CustomParser.java b/container-search/src/main/java/com/yahoo/prelude/query/parser/CustomParser.java index 44c0cb45732..520879be928 100644 --- a/container-search/src/main/java/com/yahoo/prelude/query/parser/CustomParser.java +++ b/container-search/src/main/java/com/yahoo/prelude/query/parser/CustomParser.java @@ -6,7 +6,6 @@ import com.yahoo.prelude.IndexFacts; import com.yahoo.prelude.query.Item; import com.yahoo.search.query.parser.Parser; -import java.util.Collections; import java.util.Set; /** @@ -23,7 +22,7 @@ public interface CustomParser extends Parser { Set<String> toSearch, IndexFacts indexFacts, String defaultIndexName) { if (indexFacts == null) indexFacts = new IndexFacts(); - return parse(queryToParse, filterToParse, parsingLanguage, indexFacts.newSession(toSearch, Collections.emptySet()), defaultIndexName); + return parse(queryToParse, filterToParse, parsingLanguage, indexFacts.newSession(toSearch, Set.of()), defaultIndexName); } Item parse(String queryToParse, String filterToParse, Language parsingLanguage, diff --git a/container-search/src/main/java/com/yahoo/prelude/query/parser/Tokenizer.java b/container-search/src/main/java/com/yahoo/prelude/query/parser/Tokenizer.java index 1c0d3ea2ee9..5a42efaaea0 100644 --- a/container-search/src/main/java/com/yahoo/prelude/query/parser/Tokenizer.java +++ b/container-search/src/main/java/com/yahoo/prelude/query/parser/Tokenizer.java @@ -8,8 +8,8 @@ import com.yahoo.prelude.Index; import com.yahoo.prelude.IndexFacts; import com.yahoo.prelude.query.Substring; -import java.util.Collections; import java.util.List; +import java.util.Set; import static com.yahoo.prelude.query.parser.Token.Kind.*; @@ -63,7 +63,7 @@ public final class Tokenizer { * @return a read-only list of tokens. This list can only be used by this thread */ public List<Token> tokenize(String string) { - return tokenize(string, new IndexFacts().newSession(Collections.emptySet(), Collections.emptySet())); + return tokenize(string, new IndexFacts().newSession(Set.of(), Set.of())); } /** diff --git a/container-search/src/main/java/com/yahoo/prelude/semantics/SemanticSearcher.java b/container-search/src/main/java/com/yahoo/prelude/semantics/SemanticSearcher.java index ef453492a5d..e2e0ea90632 100644 --- a/container-search/src/main/java/com/yahoo/prelude/semantics/SemanticSearcher.java +++ b/container-search/src/main/java/com/yahoo/prelude/semantics/SemanticSearcher.java @@ -14,7 +14,6 @@ import com.yahoo.search.result.ErrorMessage; import com.yahoo.search.searchchain.Execution; import com.yahoo.search.searchchain.PhaseNames; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -46,7 +45,7 @@ public class SemanticSearcher extends Searcher { } public SemanticSearcher(RuleBase ... ruleBases) { - this(Arrays.asList(ruleBases)); + this(List.of(ruleBases)); } @Inject |