aboutsummaryrefslogtreecommitdiffstats
path: root/container-search
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2020-06-18 09:10:48 +0200
committerGitHub <noreply@github.com>2020-06-18 09:10:48 +0200
commitc95cd618e0903ce0e5101ecb3593821bb399a9f9 (patch)
tree667aadb9fc67ab9d8f220ef298ccc82186c13ac2 /container-search
parentb0bc165e64dbcbb9e8e357f92f46f8bf1c84dbb8 (diff)
parented30906d441364b95b99f52355d218a085246fa6 (diff)
Merge pull request #13619 from vespa-engine/bratseth/spare-capacity-maintainer
Bratseth/spare capacity maintainer
Diffstat (limited to 'container-search')
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/query/Item.java2
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/query/WordAlternativesItem.java21
2 files changed, 8 insertions, 15 deletions
diff --git a/container-search/src/main/java/com/yahoo/prelude/query/Item.java b/container-search/src/main/java/com/yahoo/prelude/query/Item.java
index ea65bc7d7d2..475a80f7ae0 100644
--- a/container-search/src/main/java/com/yahoo/prelude/query/Item.java
+++ b/container-search/src/main/java/com/yahoo/prelude/query/Item.java
@@ -32,7 +32,7 @@ public abstract class Item implements Cloneable {
/**
* The definitions in Item.ItemType must match the ones in
- * searchlib/src/searchlib/parsequery/parse.h
+ * searchlib/src/vespa/searchlib/parsequery/parse.h
*/
public static enum ItemType {
OR(0),
diff --git a/container-search/src/main/java/com/yahoo/prelude/query/WordAlternativesItem.java b/container-search/src/main/java/com/yahoo/prelude/query/WordAlternativesItem.java
index 97c68ee3da8..2c017410109 100644
--- a/container-search/src/main/java/com/yahoo/prelude/query/WordAlternativesItem.java
+++ b/container-search/src/main/java/com/yahoo/prelude/query/WordAlternativesItem.java
@@ -12,8 +12,7 @@ import com.google.common.collect.ImmutableList;
import com.yahoo.compress.IntegerCompressor;
/**
- * A set words with differing exactness scores to be used for literal boost
- * ranking.
+ * A set of words with differing exactness scores to be used for literal boost ranking.
*
* @author Steinar Knutsen
*/
@@ -145,17 +144,14 @@ public class WordAlternativesItem extends TermItem {
}
/**
- * Return an immutable snapshot of the contained terms. This list will not
- * reflect later changes to the item.
+ * Return an immutable snapshot of the contained terms. This list will not reflect later changes to the item.
*
- * @return an immutable list of word alternatives and their respective
- * scores
+ * @return an immutable list of word alternatives and their respective scores
*/
public List<Alternative> getAlternatives() {
return alternatives;
}
-
@Override
public void encodeThis(ByteBuffer target) {
super.encodeThis(target);
@@ -172,17 +168,14 @@ public class WordAlternativesItem extends TermItem {
* equal or higher exactness score. If the term string is present with a
* lower exactness score, the new, higher score will take precedence.
*
- * @param term
- * one of several string interpretations of the input word
- * @param exactness
- * how close the term string matches what the user input
+ * @param term one of several string interpretations of the input word
+ * @param exactness how close the term string matches what the user input
*/
public void addTerm(String term, double exactness) {
// do note, Item is Cloneable, and overwriting the reference is what
// saves us from overriding the method
- if (alternatives.stream().anyMatch((a) -> a.word.equals(term) && a.exactness >= exactness )) {
- return;
- }
+ if (alternatives.stream().anyMatch((a) -> a.word.equals(term) && a.exactness >= exactness )) return;
+
List<Alternative> newTerms = new ArrayList<>(alternatives.size() + 1);
newTerms.addAll(alternatives);
newTerms.add(new Alternative(term, exactness));