aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Musum <musum@yahooinc.com>2024-03-17 19:31:45 +0100
committerGitHub <noreply@github.com>2024-03-17 19:31:45 +0100
commitb199f8bf2bd09f0a2fcff3dfa85861e24f69d647 (patch)
tree3a72556830f3389218f19a85eb8e6069d4e1497b
parent8e2d974cc20b9b5922f93fc06d93c930bcf485fb (diff)
parentd3284ac16a88f426128e5da5a9ade9473c3f5a8f (diff)
Merge pull request #30667 from vespa-engine/balder/minor-cleanupv8.320.68
Pattern variable
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java6
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java12
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java4
-rw-r--r--container-search/src/main/java/com/yahoo/search/grouping/GroupingValidator.java5
-rw-r--r--container-search/src/main/java/com/yahoo/search/searchers/QueryValidator.java5
5 files changed, 13 insertions, 19 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java b/config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java
index 91622e9fe31..de9e9ad7a4b 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java
@@ -35,15 +35,15 @@ import static com.yahoo.vespa.model.container.PlatformBundles.SEARCH_AND_DOCPROC
* @author gjoranv
* @author Tony Vaagenes
*/
-public class ContainerSearch extends ContainerSubsystem<SearchChains>
- implements
+public class ContainerSearch extends ContainerSubsystem<SearchChains> implements
IndexInfoConfig.Producer,
IlscriptsConfig.Producer,
QrSearchersConfig.Producer,
QueryProfilesConfig.Producer,
SemanticRulesConfig.Producer,
PageTemplatesConfig.Producer,
- SchemaInfoConfig.Producer {
+ SchemaInfoConfig.Producer
+{
public static final String QUERY_PROFILE_REGISTRY_CLASS = CompiledQueryProfileRegistry.class.getName();
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java
index 4d6f454f7e0..a92362bf899 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java
@@ -89,7 +89,8 @@ public class ContentSearchCluster extends TreeConfigProducer<AnyConfigProducer>
public Builder(Map<String, NewDocumentType> documentDefinitions,
Set<NewDocumentType> globallyDistributedDocuments,
- double fractionOfMemoryReserved, ResourceLimits resourceLimits) {
+ double fractionOfMemoryReserved, ResourceLimits resourceLimits)
+ {
this.documentDefinitions = documentDefinitions;
this.globallyDistributedDocuments = globallyDistributedDocuments;
this.fractionOfMemoryReserved = fractionOfMemoryReserved;
@@ -103,12 +104,9 @@ public class ContentSearchCluster extends TreeConfigProducer<AnyConfigProducer>
Boolean flushOnShutdownElem = clusterElem.childAsBoolean("engine.proton.flush-on-shutdown");
Boolean syncTransactionLog = clusterElem.childAsBoolean("engine.proton.sync-transactionlog");
- var search = new ContentSearchCluster(ancestor, clusterName,
- deployState.getProperties().featureFlags(),
- documentDefinitions,
- globallyDistributedDocuments,
- getFlushOnShutdown(flushOnShutdownElem),
- syncTransactionLog,
+ var search = new ContentSearchCluster(ancestor, clusterName, deployState.getProperties().featureFlags(),
+ documentDefinitions, globallyDistributedDocuments,
+ getFlushOnShutdown(flushOnShutdownElem), syncTransactionLog,
fractionOfMemoryReserved);
ModelElement tuning = clusterElem.childByPath("engine.proton.tuning");
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java
index d3e69e64fe6..440e7a92ea1 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java
@@ -362,9 +362,7 @@ public class ContentBuilderTest extends DomBuilderTest {
" <node hostalias=\"mockhost\" distribution-key=\"0\" />" +
" </group>" +
"</content>", new TestProperties().setEnvironmentVariables(List.of("MY_1_ENV=xyz abc", "MY_2_ENV=2")));
- ContentSearchCluster s;
-
- s = b.getSearch();
+ ContentSearchCluster s = b.getSearch();
assertTrue(s.hasIndexedCluster());
assertNotNull(s.getIndexed());
assertEquals(1, b.getStorageCluster().getChildren().size());
diff --git a/container-search/src/main/java/com/yahoo/search/grouping/GroupingValidator.java b/container-search/src/main/java/com/yahoo/search/grouping/GroupingValidator.java
index d61da0ebedf..d4e295fb51f 100644
--- a/container-search/src/main/java/com/yahoo/search/grouping/GroupingValidator.java
+++ b/container-search/src/main/java/com/yahoo/search/grouping/GroupingValidator.java
@@ -55,7 +55,7 @@ public class GroupingValidator extends Searcher {
var searchCluster = qrsConfig.searchcluster(clusterId);
QrSearchersConfig.Searchcluster.Indexingmode.Enum indexingMode = searchCluster.indexingmode();
enabled = (indexingMode != QrSearchersConfig.Searchcluster.Indexingmode.STREAMING);
- clusterName = enabled ? searchCluster.name() : null;
+ clusterName = searchCluster.name();
for (AttributesConfig.Attribute attr : attributesConfig.attribute()) {
attributes.put(attr.name(), attr);
}
@@ -97,8 +97,7 @@ public class GroupingValidator extends Searcher {
@Override
public void visitExpression(GroupingExpression exp) {
- if (exp instanceof AttributeMapLookupValue) {
- AttributeMapLookupValue mapLookup = (AttributeMapLookupValue) exp;
+ if (exp instanceof AttributeMapLookupValue mapLookup) {
verifyHasAttribute(mapLookup.getKeyAttribute());
verifyHasAttribute(mapLookup.getValueAttribute());
if (mapLookup.hasKeySourceAttribute()) {
diff --git a/container-search/src/main/java/com/yahoo/search/searchers/QueryValidator.java b/container-search/src/main/java/com/yahoo/search/searchers/QueryValidator.java
index 033e567d53a..1c95a07cdfd 100644
--- a/container-search/src/main/java/com/yahoo/search/searchers/QueryValidator.java
+++ b/container-search/src/main/java/com/yahoo/search/searchers/QueryValidator.java
@@ -11,7 +11,6 @@ import com.yahoo.search.Query;
import com.yahoo.search.Result;
import com.yahoo.search.Searcher;
import com.yahoo.search.schema.Field;
-import com.yahoo.search.schema.FieldInfo;
import com.yahoo.search.schema.SchemaInfo;
import com.yahoo.search.searchchain.Execution;
import com.yahoo.search.searchchain.PhaseNames;
@@ -55,7 +54,7 @@ public class QueryValidator extends Searcher {
public boolean visit(Item item) {
if (item instanceof HasIndexItem indexItem) {
var field = schema.fieldInfo(indexItem.getIndexName());
- if (! field.isPresent()) return true;
+ if (field.isEmpty()) return true;
if (field.get().type().kind() == Field.Type.Kind.TENSOR)
throw new IllegalArgumentException("Cannot search for terms in '" + indexItem.getIndexName() +
"': It is a tensor field");
@@ -76,7 +75,7 @@ public class QueryValidator extends Searcher {
if (schema.isStreaming()) return true; // prefix is always supported
if (item instanceof PrefixItem prefixItem) {
var field = schema.fieldInfo(prefixItem.getIndexName());
- if (! field.isPresent()) return true;
+ if (field.isEmpty()) return true;
if ( ! field.get().isAttribute())
throw new IllegalArgumentException("'" + prefixItem.getIndexName() + "' is not an attribute field: Prefix matching is not supported");
if (field.get().isIndex()) // index overrides attribute