summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/Search.java5
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/search/AbstractSearchCluster.java12
-rw-r--r--container-search/src/main/java/com/yahoo/search/Query.java36
-rw-r--r--container-search/src/test/java/com/yahoo/search/test/QueryTestCase.java16
-rw-r--r--indexinglanguage/src/main/java/com/yahoo/vespa/indexinglanguage/linguistics/LinguisticsAnnotator.java15
-rw-r--r--jdisc_core/src/main/java/com/yahoo/jdisc/application/AbstractApplication.java2
-rw-r--r--jdisc_core/src/main/java/com/yahoo/jdisc/core/ActiveContainer.java2
-rw-r--r--jdisc_core/src/main/java/com/yahoo/jdisc/core/ApplicationLoader.java2
-rw-r--r--jdisc_core/src/main/java/com/yahoo/jdisc/core/BootstrapLoader.java10
-rw-r--r--jdisc_core/src/main/java/com/yahoo/jdisc/core/Main.java2
-rw-r--r--jdisc_core/src/main/java/com/yahoo/jdisc/core/OsgiLogHandler.java6
-rw-r--r--jdisc_core/src/main/java/com/yahoo/jdisc/core/OsgiLogManager.java2
-rw-r--r--jdisc_core/src/main/java/com/yahoo/jdisc/core/OsgiLogService.java34
-rw-r--r--jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/OsgiLogServiceIntegrationTest.java2
-rw-r--r--linguistics/src/main/java/com/yahoo/language/process/Token.java4
-rw-r--r--vespajlib/src/test/java/com/yahoo/text/Benchmark.java3
16 files changed, 85 insertions, 68 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/Search.java b/config-model/src/main/java/com/yahoo/searchdefinition/Search.java
index f37ab9fb89f..c6b07b25bb4 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/Search.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/Search.java
@@ -165,9 +165,8 @@ public class Search implements Serializable, ImmutableSearch {
public void addRankingConstant(RankingConstant constant) {
constant.validate();
String name = constant.getName();
- if (rankingConstants.get(name) != null) {
- throw new IllegalArgumentException("Ranking constant '"+name+"' defined twice");
- }
+ if (rankingConstants.containsKey(name))
+ throw new IllegalArgumentException("Ranking constant '" + name + "' defined twice");
rankingConstants.put(name, constant);
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/AbstractSearchCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/search/AbstractSearchCluster.java
index fd062dc4ea4..58fc76f1508 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/search/AbstractSearchCluster.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/search/AbstractSearchCluster.java
@@ -49,16 +49,7 @@ public abstract class AbstractSearchCluster extends AbstractConfigProducer
public static final IndexingMode REALTIME = new IndexingMode("REALTIME");
public static final IndexingMode STREAMING = new IndexingMode("STREAMING");
- public static IndexingMode createIndexingMode(String ixm) {
- if ("REALTIME".equalsIgnoreCase(ixm)) {
- return REALTIME;
- } else if ("STREAMING".equalsIgnoreCase(ixm)) {
- return STREAMING;
- }
- return null;
- }
-
- private String name;
+ private final String name;
private IndexingMode(String name) {
this.name = name;
@@ -72,6 +63,7 @@ public abstract class AbstractSearchCluster extends AbstractConfigProducer
}
public static final class SearchDefinitionSpec {
+
private final SearchDefinition searchDefinition;
private final UserConfigRepo userConfigRepo;
diff --git a/container-search/src/main/java/com/yahoo/search/Query.java b/container-search/src/main/java/com/yahoo/search/Query.java
index adf01f161a4..b2349ed6dfc 100644
--- a/container-search/src/main/java/com/yahoo/search/Query.java
+++ b/container-search/src/main/java/com/yahoo/search/Query.java
@@ -12,31 +12,38 @@ import com.yahoo.prelude.query.Highlight;
import com.yahoo.prelude.query.QueryException;
import com.yahoo.prelude.query.textualrepresentation.TextualQueryRepresentation;
import com.yahoo.processing.request.CompoundName;
-import com.yahoo.search.query.*;
-import com.yahoo.search.query.profile.types.FieldType;
-import com.yahoo.search.query.properties.PropertyMap;
+import com.yahoo.search.federation.FederationSearcher;
+import com.yahoo.search.query.Model;
+import com.yahoo.search.query.ParameterParser;
+import com.yahoo.search.query.Presentation;
+import com.yahoo.search.query.Properties;
+import com.yahoo.search.query.QueryTree;
+import com.yahoo.search.query.Ranking;
+import com.yahoo.search.query.SessionId;
+import com.yahoo.search.query.Sorting;
+import com.yahoo.search.query.Sorting.AttributeSorter;
+import com.yahoo.search.query.Sorting.FieldOrder;
+import com.yahoo.search.query.Sorting.Order;
+import com.yahoo.search.query.UniqueRequestId;
+import com.yahoo.search.query.context.QueryContext;
+import com.yahoo.search.query.profile.ModelObjectMap;
+import com.yahoo.search.query.profile.QueryProfileProperties;
+import com.yahoo.search.query.profile.compiled.CompiledQueryProfile;
import com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry;
import com.yahoo.search.query.profile.types.FieldDescription;
+import com.yahoo.search.query.profile.types.FieldType;
import com.yahoo.search.query.profile.types.QueryProfileFieldType;
import com.yahoo.search.query.profile.types.QueryProfileType;
import com.yahoo.search.query.profile.types.QueryProfileTypeRegistry;
import com.yahoo.search.query.properties.DefaultProperties;
+import com.yahoo.search.query.properties.PropertyMap;
import com.yahoo.search.query.properties.QueryProperties;
import com.yahoo.search.query.properties.QueryPropertyAliases;
import com.yahoo.search.query.properties.RequestContextProperties;
-import com.yahoo.yolean.Exceptions;
-import com.yahoo.search.federation.FederationSearcher;
-import com.yahoo.search.query.Sorting.AttributeSorter;
-import com.yahoo.search.query.Sorting.FieldOrder;
-import com.yahoo.search.query.Sorting.Order;
-import com.yahoo.search.query.context.QueryContext;
-import com.yahoo.search.query.profile.ModelObjectMap;
-import com.yahoo.search.query.profile.QueryProfileProperties;
-import com.yahoo.search.query.profile.compiled.CompiledQueryProfile;
import com.yahoo.search.yql.NullItemException;
import com.yahoo.search.yql.VespaSerializer;
import com.yahoo.search.yql.YqlParser;
-
+import com.yahoo.yolean.Exceptions;
import edu.umd.cs.findbugs.annotations.Nullable;
import java.nio.ByteBuffer;
@@ -45,7 +52,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import java.util.concurrent.atomic.AtomicReference;
import java.util.logging.Logger;
/**
@@ -951,8 +957,6 @@ public class Query extends com.yahoo.processing.Request implements Cloneable {
/**
* Return the HTTP request which caused this query. This will never be null
* when running with queries from the network.
- * (Except when running with deprecated code paths, in which case this will
- * return null but getRequest() will not.)
*/
public HttpRequest getHttpRequest() { return httpRequest; }
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 62eacaa0afe..2a36e30b95a 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
@@ -2,9 +2,13 @@
package com.yahoo.search.test;
import com.yahoo.component.chain.Chain;
+import com.yahoo.language.Language;
+import com.yahoo.language.Linguistics;
import com.yahoo.language.detect.Detection;
import com.yahoo.language.detect.Detector;
import com.yahoo.language.detect.Hint;
+import com.yahoo.language.process.StemMode;
+import com.yahoo.language.process.Token;
import com.yahoo.language.simple.SimpleDetector;
import com.yahoo.language.simple.SimpleLinguistics;
import com.yahoo.prelude.Index;
@@ -65,6 +69,18 @@ public class QueryTestCase {
assertNull(q.getModel().getDefaultIndex());
assertEquals("", q.properties().get("aParameter"));
assertNull(q.properties().get("notSetParameter"));
+
+ Query query = q;
+ String body = "a bb. ccc??!";
+ Linguistics linguistics = new SimpleLinguistics();
+
+ AndItem and = new AndItem();
+ for (Token token : linguistics.getTokenizer().tokenize(body, Language.ENGLISH, StemMode.SHORTEST, true)) {
+ if (token.isIndexable())
+ and.addItem(new WordItem(token.getTokenString(), "body"));
+ }
+ query.getModel().getQueryTree().setRoot(and);
+ System.out.println(query);
}
// TODO: YQL work in progress (jon)
diff --git a/indexinglanguage/src/main/java/com/yahoo/vespa/indexinglanguage/linguistics/LinguisticsAnnotator.java b/indexinglanguage/src/main/java/com/yahoo/vespa/indexinglanguage/linguistics/LinguisticsAnnotator.java
index ef94f67d6e6..2b2dcc90e41 100644
--- a/indexinglanguage/src/main/java/com/yahoo/vespa/indexinglanguage/linguistics/LinguisticsAnnotator.java
+++ b/indexinglanguage/src/main/java/com/yahoo/vespa/indexinglanguage/linguistics/LinguisticsAnnotator.java
@@ -1,16 +1,21 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.indexinglanguage.linguistics;
-import java.util.HashMap;
-import java.util.Map;
-
-import com.yahoo.document.annotation.*;
+import com.yahoo.document.annotation.Annotation;
+import com.yahoo.document.annotation.AnnotationTypes;
+import com.yahoo.document.annotation.Span;
+import com.yahoo.document.annotation.SpanList;
+import com.yahoo.document.annotation.SpanTree;
+import com.yahoo.document.annotation.SpanTrees;
import com.yahoo.document.datatypes.StringFieldValue;
import com.yahoo.language.Linguistics;
import com.yahoo.language.process.StemMode;
import com.yahoo.language.process.Token;
import com.yahoo.language.process.Tokenizer;
+import java.util.HashMap;
+import java.util.Map;
+
import static com.yahoo.language.LinguisticsCase.toLowerCase;
/**
@@ -110,7 +115,7 @@ public class LinguisticsAnnotator {
}
return;
}
- if (!token.isIndexable()) {
+ if ( ! token.isIndexable()) {
return;
}
}
diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/application/AbstractApplication.java b/jdisc_core/src/main/java/com/yahoo/jdisc/application/AbstractApplication.java
index e1bcef4c1e0..4075aa711c2 100644
--- a/jdisc_core/src/main/java/com/yahoo/jdisc/application/AbstractApplication.java
+++ b/jdisc_core/src/main/java/com/yahoo/jdisc/application/AbstractApplication.java
@@ -39,7 +39,7 @@ import java.util.concurrent.TimeUnit;
* }
* </pre>
*
- * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a>
+ * @author Simon Thoresen
*/
public abstract class AbstractApplication implements Application {
diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/core/ActiveContainer.java b/jdisc_core/src/main/java/com/yahoo/jdisc/core/ActiveContainer.java
index 2c8d1c80b4f..907d2a050fb 100644
--- a/jdisc_core/src/main/java/com/yahoo/jdisc/core/ActiveContainer.java
+++ b/jdisc_core/src/main/java/com/yahoo/jdisc/core/ActiveContainer.java
@@ -20,7 +20,7 @@ import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
/**
- * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a>
+ * @author Simon Thoresen
*/
public class ActiveContainer extends AbstractResource implements CurrentContainer {
diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/core/ApplicationLoader.java b/jdisc_core/src/main/java/com/yahoo/jdisc/core/ApplicationLoader.java
index 7556186c1a9..10b4c9f6508 100644
--- a/jdisc_core/src/main/java/com/yahoo/jdisc/core/ApplicationLoader.java
+++ b/jdisc_core/src/main/java/com/yahoo/jdisc/core/ApplicationLoader.java
@@ -29,7 +29,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
/**
- * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a>
+ * @author Simon Thoresen
* @author bjorncs
*/
public class ApplicationLoader implements BootstrapLoader, ContainerActivator, CurrentContainer {
diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/core/BootstrapLoader.java b/jdisc_core/src/main/java/com/yahoo/jdisc/core/BootstrapLoader.java
index aa4fc4d1b18..a2e447dddf1 100644
--- a/jdisc_core/src/main/java/com/yahoo/jdisc/core/BootstrapLoader.java
+++ b/jdisc_core/src/main/java/com/yahoo/jdisc/core/BootstrapLoader.java
@@ -2,15 +2,15 @@
package com.yahoo.jdisc.core;
/**
- * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a>
+ * @author Simon Thoresen
*/
public interface BootstrapLoader {
- public void init(String bundleLocation, boolean privileged) throws Exception;
+ void init(String bundleLocation, boolean privileged) throws Exception;
- public void start() throws Exception;
+ void start() throws Exception;
- public void stop() throws Exception;
+ void stop() throws Exception;
- public void destroy();
+ void destroy();
}
diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/core/Main.java b/jdisc_core/src/main/java/com/yahoo/jdisc/core/Main.java
index c3d5460ac38..ce091fa82d0 100644
--- a/jdisc_core/src/main/java/com/yahoo/jdisc/core/Main.java
+++ b/jdisc_core/src/main/java/com/yahoo/jdisc/core/Main.java
@@ -10,7 +10,7 @@ import java.util.Arrays;
import java.util.Collections;
/**
- * @author simon
+ * @author Simon Thoresen
*/
public class Main {
diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/core/OsgiLogHandler.java b/jdisc_core/src/main/java/com/yahoo/jdisc/core/OsgiLogHandler.java
index 17156d5659c..e72df8fc7e1 100644
--- a/jdisc_core/src/main/java/com/yahoo/jdisc/core/OsgiLogHandler.java
+++ b/jdisc_core/src/main/java/com/yahoo/jdisc/core/OsgiLogHandler.java
@@ -6,7 +6,6 @@ import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceReference;
import org.osgi.service.log.LogService;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Handler;
@@ -14,11 +13,11 @@ import java.util.logging.Level;
import java.util.logging.LogRecord;
/**
- * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen Hult</a>
+ * @author Simon Thoresen Hult
*/
class OsgiLogHandler extends Handler {
- private static enum LogRecordProperty {
+ private enum LogRecordProperty {
LEVEL,
LOGGER_NAME,
@@ -32,6 +31,7 @@ class OsgiLogHandler extends Handler {
SOURCE_METHOD_NAME,
THREAD_ID,
THROWN
+
}
private final static Map<String, LogRecordProperty> PROPERTY_MAP = createDictionary(LogRecordProperty.values());
diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/core/OsgiLogManager.java b/jdisc_core/src/main/java/com/yahoo/jdisc/core/OsgiLogManager.java
index 524863b1c91..5b0367c5a55 100644
--- a/jdisc_core/src/main/java/com/yahoo/jdisc/core/OsgiLogManager.java
+++ b/jdisc_core/src/main/java/com/yahoo/jdisc/core/OsgiLogManager.java
@@ -13,7 +13,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
/**
- * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen Hult</a>
+ * @author Simon Thoresen Hult
*/
class OsgiLogManager implements LogService {
diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/core/OsgiLogService.java b/jdisc_core/src/main/java/com/yahoo/jdisc/core/OsgiLogService.java
index 02f8c85b940..f51891cada4 100644
--- a/jdisc_core/src/main/java/com/yahoo/jdisc/core/OsgiLogService.java
+++ b/jdisc_core/src/main/java/com/yahoo/jdisc/core/OsgiLogService.java
@@ -4,7 +4,7 @@ package com.yahoo.jdisc.core;
import org.osgi.framework.*;
/**
- * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen Hult</a>
+ * @author Simon Thoresen Hult
*/
class OsgiLogService {
@@ -38,22 +38,22 @@ class OsgiLogService {
return;
}
switch (event.getType()) {
- case ServiceEvent.REGISTERED:
- try {
- activator.start(ctx);
- } catch (Exception e) {
- throw new RuntimeException("Exception thrown while starting " +
- activator.getClass().getName() + ".", e);
- }
- break;
- case ServiceEvent.UNREGISTERING:
- try {
- activator.stop(ctx);
- } catch (Exception e) {
- throw new RuntimeException("Exception thrown while stopping " +
- activator.getClass().getName() + ".", e);
- }
- break;
+ case ServiceEvent.REGISTERED:
+ try {
+ activator.start(ctx);
+ } catch (Exception e) {
+ throw new RuntimeException("Exception thrown while starting " +
+ activator.getClass().getName() + ".", e);
+ }
+ break;
+ case ServiceEvent.UNREGISTERING:
+ try {
+ activator.stop(ctx);
+ } catch (Exception e) {
+ throw new RuntimeException("Exception thrown while stopping " +
+ activator.getClass().getName() + ".", e);
+ }
+ break;
}
}
}
diff --git a/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/OsgiLogServiceIntegrationTest.java b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/OsgiLogServiceIntegrationTest.java
index 921c10a1821..1f839d0dc0a 100644
--- a/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/OsgiLogServiceIntegrationTest.java
+++ b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/OsgiLogServiceIntegrationTest.java
@@ -21,7 +21,7 @@ import static org.junit.Assert.assertTrue;
/**
- * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen Hult</a>
+ * @author Simon Thoresen Hult
* @author bjorncs
*/
public class OsgiLogServiceIntegrationTest {
diff --git a/linguistics/src/main/java/com/yahoo/language/process/Token.java b/linguistics/src/main/java/com/yahoo/language/process/Token.java
index d730c5dd16b..73c0ac857ab 100644
--- a/linguistics/src/main/java/com/yahoo/language/process/Token.java
+++ b/linguistics/src/main/java/com/yahoo/language/process/Token.java
@@ -2,9 +2,9 @@
package com.yahoo.language.process;
/**
- * Interface providing access to a single token produced by the tokenizer.
+ * A single token produced by the tokenizer.
*
- * @author <a href="mailto:mathiasm@yahoo-inc.com">Mathias Mølster Lidal</a>
+ * @author Mathias Mølster Lidal
*/
public interface Token {
diff --git a/vespajlib/src/test/java/com/yahoo/text/Benchmark.java b/vespajlib/src/test/java/com/yahoo/text/Benchmark.java
index b32927c2f5d..14eed6d80d4 100644
--- a/vespajlib/src/test/java/com/yahoo/text/Benchmark.java
+++ b/vespajlib/src/test/java/com/yahoo/text/Benchmark.java
@@ -14,7 +14,7 @@ import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
/**
- * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen Hult</a>
+ * @author Simon Thoresen Hult
*/
class Benchmark {
@@ -103,4 +103,5 @@ class Benchmark {
return new Benchmark(this);
}
}
+
}