summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2019-01-08 11:08:41 +0100
committerJon Bratseth <bratseth@oath.com>2019-01-08 11:08:41 +0100
commitd8fa611af69b73755b2fae6189c22818e6728863 (patch)
treefd3bb7f9267f27b63560499ad19e57d364fb537d
parent89a35afd50c74a738ed160eae03d8f6384af6834 (diff)
Nonfunctional changes only
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/query/WeightedSetItem.java1
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/query/WordAlternativesItem.java9
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/Model.java25
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java12
-rw-r--r--container-search/src/test/java/com/yahoo/search/test/QueryTestCase.java10
5 files changed, 37 insertions, 20 deletions
diff --git a/container-search/src/main/java/com/yahoo/prelude/query/WeightedSetItem.java b/container-search/src/main/java/com/yahoo/prelude/query/WeightedSetItem.java
index 131d4fcc9da..b87de5f019a 100644
--- a/container-search/src/main/java/com/yahoo/prelude/query/WeightedSetItem.java
+++ b/container-search/src/main/java/com/yahoo/prelude/query/WeightedSetItem.java
@@ -49,6 +49,7 @@ public class WeightedSetItem extends SimpleTaggableItem {
* Add weighted token.
* If token is already in the set, the maximum weight is kept.
* NOTE: The weight must be 1 or more; negative values (and zero) are not allowed.
+ *
* @return weight of added token (might be old value, if kept)
*/
public Integer addToken(String token, int weight) {
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 652e1ca60b8..1157d2763e0 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
@@ -15,7 +15,7 @@ import com.yahoo.compress.IntegerCompressor;
* A set words with differing exactness scores to be used for literal boost
* ranking.
*
- * @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a>
+ * @author Steinar Knutsen
*/
public class WordAlternativesItem extends TermItem {
@@ -23,6 +23,7 @@ public class WordAlternativesItem extends TermItem {
private int maxIndex;
public static final class Alternative {
+
public final String word;
public final double exactness;
@@ -38,6 +39,7 @@ public class WordAlternativesItem extends TermItem {
builder.append("Alternative [word=").append(word).append(", exactness=").append(exactness).append("]");
return builder.toString();
}
+
}
public WordAlternativesItem(String indexName, boolean isFromQuery, Substring origin, Collection<Alternative> terms) {
@@ -51,7 +53,7 @@ public class WordAlternativesItem extends TermItem {
}
private static ImmutableList<Alternative> uniqueAlternatives(Collection<Alternative> terms) {
- List<Alternative> uniqueTerms = new ArrayList<Alternative>(terms.size());
+ List<Alternative> uniqueTerms = new ArrayList<>(terms.size());
for (Alternative term : terms) {
int i = Collections.binarySearch(uniqueTerms, term, (t0, t1) -> t0.word.compareTo(t1.word));
if (i >= 0) {
@@ -104,7 +106,7 @@ public class WordAlternativesItem extends TermItem {
@Override
public void setValue(String value) {
- throw new UnsupportedOperationException("semantics for setting to a string would be brittle, use setAlternatives()");
+ throw new UnsupportedOperationException("Semantics for setting to a string would be brittle, use setAlternatives()");
}
@Override
@@ -180,4 +182,5 @@ public class WordAlternativesItem extends TermItem {
newTerms.add(new Alternative(term, exactness));
setAlternatives(newTerms);
}
+
}
diff --git a/container-search/src/main/java/com/yahoo/search/query/Model.java b/container-search/src/main/java/com/yahoo/search/query/Model.java
index 4baa651fa01..fd52618ad85 100644
--- a/container-search/src/main/java/com/yahoo/search/query/Model.java
+++ b/container-search/src/main/java/com/yahoo/search/query/Model.java
@@ -7,7 +7,6 @@ import com.yahoo.language.LocaleFactory;
import com.yahoo.prelude.query.CompositeItem;
import com.yahoo.prelude.query.Item;
import com.yahoo.prelude.query.TaggableItem;
-import com.yahoo.prelude.query.textualrepresentation.TextualQueryRepresentation;
import com.yahoo.processing.request.CompoundName;
import com.yahoo.search.Query;
import com.yahoo.search.query.parser.Parsable;
@@ -18,7 +17,13 @@ import com.yahoo.search.query.profile.types.FieldDescription;
import com.yahoo.search.query.profile.types.QueryProfileType;
import com.yahoo.search.searchchain.Execution;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
import static com.yahoo.text.Lowercase.toLowerCase;
@@ -169,9 +174,9 @@ public class Model implements Cloneable {
public void setLanguage(Language language) { this.language = language; }
/**
- * <p>Explicitly sets the language to be used during parsing. The argument is first normalized by replacing
+ * Explicitly sets the language to be used during parsing. The argument is first normalized by replacing
* underscores with hyphens (to support locale strings being used as RFC 5646 language tags), and then forwarded to
- * {@link #setLocale(String)} so that the Locale information of the tag is preserved.</p>
+ * {@link #setLocale(String)} so that the Locale information of the tag is preserved.
*
* @param language The language string to parse.
* @see #getLanguage()
@@ -182,9 +187,9 @@ public class Model implements Cloneable {
}
/**
- * <p>Returns the explicitly set parsing locale of this query model, or null if none.</p>
+ * Returns the explicitly set parsing locale of this query model, or null if none.
*
- * @return The locale of this.
+ * @return the locale of this
* @see #setLocale(Locale)
*/
public Locale getLocale() {
@@ -195,7 +200,7 @@ public class Model implements Cloneable {
* <p>Explicitly sets the locale to be used during parsing. This method also calls {@link #setLanguage(Language)}
* with the corresponding {@link Language} instance.</p>
*
- * @param locale The locale to set.
+ * @param locale the locale to set
* @see #getLocale()
* @see #setLanguage(Language)
*/
@@ -205,10 +210,10 @@ public class Model implements Cloneable {
}
/**
- * <p>Explicitly sets the locale to be used during parsing. This creates a Locale instance from the given language
- * tag, and passes that to {@link #setLocale(Locale)}.</p>
+ * Explicitly sets the locale to be used during parsing. This creates a Locale instance from the given language
+ * tag, and passes that to {@link #setLocale(Locale)}.
*
- * @param languageTag The language tag to parse.
+ * @param languageTag the language tag to parse
* @see #setLocale(Locale)
*/
public void setLocale(String languageTag) {
diff --git a/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java b/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java
index 55855624691..60427aeb0af 100644
--- a/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java
+++ b/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java
@@ -3,9 +3,12 @@ package com.yahoo.search.query.properties;
import com.yahoo.processing.request.CompoundName;
import com.yahoo.search.Query;
-import com.yahoo.search.grouping.GroupingRequest;
-import com.yahoo.search.grouping.vespa.GroupingExecutor;
-import com.yahoo.search.query.*;
+
+import com.yahoo.search.query.Model;
+import com.yahoo.search.query.Presentation;
+import com.yahoo.search.query.Properties;
+import com.yahoo.search.query.Ranking;
+import com.yahoo.search.query.Select;
import com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry;
import com.yahoo.search.query.profile.types.FieldDescription;
import com.yahoo.search.query.profile.types.QueryProfileType;
@@ -15,11 +18,8 @@ import com.yahoo.search.query.ranking.Matching;
import com.yahoo.search.query.ranking.SoftTimeout;
import com.yahoo.tensor.Tensor;
-import java.util.List;
import java.util.Map;
-
-
/**
* Maps between the query model and text properties.
* This can be done simpler by using reflection but the performance penalty was not worth it,
diff --git a/container-search/src/test/java/com/yahoo/search/test/QueryTestCase.java b/container-search/src/test/java/com/yahoo/search/test/QueryTestCase.java
index ce48d000ce8..ed80c0bf256 100644
--- a/container-search/src/test/java/com/yahoo/search/test/QueryTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/test/QueryTestCase.java
@@ -300,7 +300,7 @@ public class QueryTestCase {
}
@Test
- public void testTimeoutInRequestOverridesQueryProfile() {
+ public void testQueryProfileSubstitution() {
QueryProfile profile = new QueryProfile("myProfile");
profile.set("myField", "Profile: %{queryProfile}", null);
Query q = new Query(QueryTestCase.httpEncode("/search?queryProfile=myProfile"), profile.compile(null));
@@ -308,6 +308,14 @@ public class QueryTestCase {
}
@Test
+ public void testTimeoutInRequestOverridesQueryProfile() {
+ QueryProfile profile = new QueryProfile("test");
+ profile.set("timeout", 318, (QueryProfileRegistry)null);
+ Query q = new Query(QueryTestCase.httpEncode("/search?timeout=500"), profile.compile(null));
+ assertEquals(500000L, q.getTimeout());
+ }
+
+ @Test
public void testNotEqual() {
Query q = new Query("/?query=something+test&nocache");
Query p = new Query("/?query=something+test");