aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/result
diff options
context:
space:
mode:
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/result')
-rw-r--r--container-search/src/main/java/com/yahoo/search/result/ChainableComparator.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/result/Coverage.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/result/DeepHitIterator.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/result/DefaultErrorHit.java3
-rw-r--r--container-search/src/main/java/com/yahoo/search/result/ErrorHit.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/result/ErrorMessage.java4
-rw-r--r--container-search/src/main/java/com/yahoo/search/result/FeatureData.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/result/FieldComparator.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/result/Hit.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/result/HitGroup.java14
-rw-r--r--container-search/src/main/java/com/yahoo/search/result/HitGroupsLastComparator.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/result/HitIterator.java6
-rw-r--r--container-search/src/main/java/com/yahoo/search/result/HitOrderer.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/result/HitSortOrderer.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/result/MetaHitsFirstComparator.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/result/NanNumber.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/result/PositionsData.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/result/Relevance.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/result/StructuredData.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/result/package-info.java2
20 files changed, 28 insertions, 31 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/result/ChainableComparator.java b/container-search/src/main/java/com/yahoo/search/result/ChainableComparator.java
index e46a3d6a2b2..0ccbfac7bb0 100644
--- a/container-search/src/main/java/com/yahoo/search/result/ChainableComparator.java
+++ b/container-search/src/main/java/com/yahoo/search/result/ChainableComparator.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.result;
import java.util.Comparator;
diff --git a/container-search/src/main/java/com/yahoo/search/result/Coverage.java b/container-search/src/main/java/com/yahoo/search/result/Coverage.java
index 0f3d5cf77b1..2627b28abb9 100644
--- a/container-search/src/main/java/com/yahoo/search/result/Coverage.java
+++ b/container-search/src/main/java/com/yahoo/search/result/Coverage.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.result;
/**
diff --git a/container-search/src/main/java/com/yahoo/search/result/DeepHitIterator.java b/container-search/src/main/java/com/yahoo/search/result/DeepHitIterator.java
index 5871102f1fb..e130ac49c27 100644
--- a/container-search/src/main/java/com/yahoo/search/result/DeepHitIterator.java
+++ b/container-search/src/main/java/com/yahoo/search/result/DeepHitIterator.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.result;
import java.util.*;
diff --git a/container-search/src/main/java/com/yahoo/search/result/DefaultErrorHit.java b/container-search/src/main/java/com/yahoo/search/result/DefaultErrorHit.java
index 51525eb62ce..fdd5c79adb6 100644
--- a/container-search/src/main/java/com/yahoo/search/result/DefaultErrorHit.java
+++ b/container-search/src/main/java/com/yahoo/search/result/DefaultErrorHit.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.result;
import com.yahoo.collections.ArraySet;
@@ -75,6 +75,7 @@ public class DefaultErrorHit extends Hit implements ErrorHit, Cloneable {
/** Add all errors from another error hit to this */
public void addErrors(ErrorHit errorHit) {
+ if (this == errorHit) return;
for (Iterator<? extends ErrorMessage> i = errorHit.errorIterator(); i.hasNext();) {
addError(i.next());
}
diff --git a/container-search/src/main/java/com/yahoo/search/result/ErrorHit.java b/container-search/src/main/java/com/yahoo/search/result/ErrorHit.java
index b89994d63da..e6cd5e63d26 100644
--- a/container-search/src/main/java/com/yahoo/search/result/ErrorHit.java
+++ b/container-search/src/main/java/com/yahoo/search/result/ErrorHit.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.result;
import java.util.Iterator;
diff --git a/container-search/src/main/java/com/yahoo/search/result/ErrorMessage.java b/container-search/src/main/java/com/yahoo/search/result/ErrorMessage.java
index b7f7150f209..a6f57aa866a 100644
--- a/container-search/src/main/java/com/yahoo/search/result/ErrorMessage.java
+++ b/container-search/src/main/java/com/yahoo/search/result/ErrorMessage.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.result;
import com.yahoo.container.protect.Error;
@@ -114,7 +114,7 @@ public class ErrorMessage extends com.yahoo.processing.request.ErrorMessage {
public static final int timeoutCode = Error.TIMEOUT.code;
/** Creates an error indicating that a request to a backend timed out. */
public static ErrorMessage createTimeout(String detailedMessage) {
- return new ErrorMessage(timeoutCode, "Timed out",detailedMessage);
+ return new ErrorMessage(timeoutCode, "Timed out", detailedMessage);
}
public static final int emptyDocsumsCode = Error.EMPTY_DOCUMENTS.code;
diff --git a/container-search/src/main/java/com/yahoo/search/result/FeatureData.java b/container-search/src/main/java/com/yahoo/search/result/FeatureData.java
index 7e9fa3f748a..0f26ecdcce7 100644
--- a/container-search/src/main/java/com/yahoo/search/result/FeatureData.java
+++ b/container-search/src/main/java/com/yahoo/search/result/FeatureData.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.result;
import com.yahoo.data.access.Inspector;
diff --git a/container-search/src/main/java/com/yahoo/search/result/FieldComparator.java b/container-search/src/main/java/com/yahoo/search/result/FieldComparator.java
index 7f392d43753..5da27632ef6 100644
--- a/container-search/src/main/java/com/yahoo/search/result/FieldComparator.java
+++ b/container-search/src/main/java/com/yahoo/search/result/FieldComparator.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.result;
import com.yahoo.data.access.Inspector;
diff --git a/container-search/src/main/java/com/yahoo/search/result/Hit.java b/container-search/src/main/java/com/yahoo/search/result/Hit.java
index a028bcdd582..d81880cc548 100644
--- a/container-search/src/main/java/com/yahoo/search/result/Hit.java
+++ b/container-search/src/main/java/com/yahoo/search/result/Hit.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.result;
import com.yahoo.collections.ArraySet;
diff --git a/container-search/src/main/java/com/yahoo/search/result/HitGroup.java b/container-search/src/main/java/com/yahoo/search/result/HitGroup.java
index 09a399ed5bb..51c0caf38a9 100644
--- a/container-search/src/main/java/com/yahoo/search/result/HitGroup.java
+++ b/container-search/src/main/java/com/yahoo/search/result/HitGroup.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.result;
import com.google.common.base.Predicate;
@@ -19,7 +19,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
-import java.util.stream.Collectors;
/**
* <p>A group of ordered hits. Since hitGroup is itself a kind of Hit,
@@ -504,9 +503,7 @@ public class HitGroup extends Hit implements DataList<Hit>, Cloneable, Iterable<
int currentIndex = -1;
ListenableArrayList<Hit> newHits = new ListenableArrayList<>(numHits);
- for (Iterator<Hit> i = hits.iterator(); i.hasNext();) {
- Hit hit = i.next();
-
+ for (Hit hit : hits) {
if (hit.isAuxiliary()) {
newHits.add(hit);
} else {
@@ -700,7 +697,6 @@ public class HitGroup extends Hit implements DataList<Hit>, Cloneable, Iterable<
// -------------- State bookkeeping
/** Ensures result invariants. Must be called when a hit is added to this result. */
- @SuppressWarnings("deprecation")
private void handleNewHit(Hit hit) {
if (!hit.isAuxiliary())
concreteHitCount++;
@@ -848,8 +844,8 @@ public class HitGroup extends Hit implements DataList<Hit>, Cloneable, Iterable<
HitGroup hitGroupClone = (HitGroup) super.clone();
hitGroupClone.hits = new ListenableArrayList<>(this.hits.size());
hitGroupClone.unmodifiableHits = Collections.unmodifiableList(hitGroupClone.hits);
- for (Iterator<Hit> i = this.hits.iterator(); i.hasNext();) {
- Hit hitClone = i.next().clone();
+ for (Hit value : this.hits) {
+ Hit hitClone = value.clone();
hitGroupClone.hits.add(hitClone);
}
if (this.errorHit != null) { // Find the cloned error and assign it
@@ -944,7 +940,7 @@ public class HitGroup extends Hit implements DataList<Hit>, Cloneable, Iterable<
}
private Iterable<Hit> fillableHits() {
- Predicate<Hit> isFillable = hit -> hit.isFillable();
+ Predicate<Hit> isFillable = Hit::isFillable;
return Iterables.filter(hits, isFillable);
}
diff --git a/container-search/src/main/java/com/yahoo/search/result/HitGroupsLastComparator.java b/container-search/src/main/java/com/yahoo/search/result/HitGroupsLastComparator.java
index 0bd91c9821e..5d20d8e64c1 100644
--- a/container-search/src/main/java/com/yahoo/search/result/HitGroupsLastComparator.java
+++ b/container-search/src/main/java/com/yahoo/search/result/HitGroupsLastComparator.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.result;
import java.util.Comparator;
diff --git a/container-search/src/main/java/com/yahoo/search/result/HitIterator.java b/container-search/src/main/java/com/yahoo/search/result/HitIterator.java
index f36a5d77d40..3d3eb6030f4 100644
--- a/container-search/src/main/java/com/yahoo/search/result/HitIterator.java
+++ b/container-search/src/main/java/com/yahoo/search/result/HitIterator.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.result;
import java.util.Iterator;
@@ -19,10 +19,10 @@ public class HitIterator implements Iterator<Hit> {
private int index = -1;
/** The list of hits to iterate over */
- private List<Hit> hits;
+ private final List<Hit> hits;
/** The result the hits belong to */
- private HitGroup hitGroup;
+ private final HitGroup hitGroup;
/** Whether the iterator is in a state where remove is OK */
private boolean canRemove = false;
diff --git a/container-search/src/main/java/com/yahoo/search/result/HitOrderer.java b/container-search/src/main/java/com/yahoo/search/result/HitOrderer.java
index 01c6e897ea0..ec3fc64a0c1 100644
--- a/container-search/src/main/java/com/yahoo/search/result/HitOrderer.java
+++ b/container-search/src/main/java/com/yahoo/search/result/HitOrderer.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.result;
import java.util.Comparator;
diff --git a/container-search/src/main/java/com/yahoo/search/result/HitSortOrderer.java b/container-search/src/main/java/com/yahoo/search/result/HitSortOrderer.java
index 4daeabe1161..ee3aad6922c 100644
--- a/container-search/src/main/java/com/yahoo/search/result/HitSortOrderer.java
+++ b/container-search/src/main/java/com/yahoo/search/result/HitSortOrderer.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.result;
import com.yahoo.search.query.Sorting;
diff --git a/container-search/src/main/java/com/yahoo/search/result/MetaHitsFirstComparator.java b/container-search/src/main/java/com/yahoo/search/result/MetaHitsFirstComparator.java
index d294690e315..8ff2786af1c 100644
--- a/container-search/src/main/java/com/yahoo/search/result/MetaHitsFirstComparator.java
+++ b/container-search/src/main/java/com/yahoo/search/result/MetaHitsFirstComparator.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.result;
import java.util.Comparator;
diff --git a/container-search/src/main/java/com/yahoo/search/result/NanNumber.java b/container-search/src/main/java/com/yahoo/search/result/NanNumber.java
index ba71034198c..d57683424ed 100644
--- a/container-search/src/main/java/com/yahoo/search/result/NanNumber.java
+++ b/container-search/src/main/java/com/yahoo/search/result/NanNumber.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.result;
/**
diff --git a/container-search/src/main/java/com/yahoo/search/result/PositionsData.java b/container-search/src/main/java/com/yahoo/search/result/PositionsData.java
index 56705c292b4..14c5680f933 100644
--- a/container-search/src/main/java/com/yahoo/search/result/PositionsData.java
+++ b/container-search/src/main/java/com/yahoo/search/result/PositionsData.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.result;
import com.yahoo.data.access.Inspector;
diff --git a/container-search/src/main/java/com/yahoo/search/result/Relevance.java b/container-search/src/main/java/com/yahoo/search/result/Relevance.java
index 5c3e322e881..5127a3a2dec 100644
--- a/container-search/src/main/java/com/yahoo/search/result/Relevance.java
+++ b/container-search/src/main/java/com/yahoo/search/result/Relevance.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.result;
/**
diff --git a/container-search/src/main/java/com/yahoo/search/result/StructuredData.java b/container-search/src/main/java/com/yahoo/search/result/StructuredData.java
index c14604525c6..5bd4541a5a4 100644
--- a/container-search/src/main/java/com/yahoo/search/result/StructuredData.java
+++ b/container-search/src/main/java/com/yahoo/search/result/StructuredData.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.result;
import com.yahoo.data.access.Inspector;
diff --git a/container-search/src/main/java/com/yahoo/search/result/package-info.java b/container-search/src/main/java/com/yahoo/search/result/package-info.java
index 0ef5fb47b08..971a03d519a 100644
--- a/container-search/src/main/java/com/yahoo/search/result/package-info.java
+++ b/container-search/src/main/java/com/yahoo/search/result/package-info.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
/**
* The content of a Result produced in response to a Query.
*/