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 @@ * @author gjoranv * @author Tony Vaagenes */ -public class ContainerSearch extends ContainerSubsystem - implements +public class ContainerSearch extends ContainerSubsystem 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 static class Builder extends VespaDomBuilder.DomConfigProducerBuilderBase public Builder(Map documentDefinitions, Set globallyDistributedDocuments, - double fractionOfMemoryReserved, ResourceLimits resourceLimits) { + double fractionOfMemoryReserved, ResourceLimits resourceLimits) + { this.documentDefinitions = documentDefinitions; this.globallyDistributedDocuments = globallyDistributedDocuments; this.fractionOfMemoryReserved = fractionOfMemoryReserved; @@ -103,12 +104,9 @@ protected ContentSearchCluster doBuild(DeployState deployState, TreeConfigProduc 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 @@ void addsEnvironmentVariablesfromFeatureFlag() { " " + " " + "", 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 GroupingValidator(QrSearchersConfig qrsConfig, ClusterConfig clusterConfi 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 @@ private class MyVisitor implements ExpressionVisitor { @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.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 TermSearchValidator(SchemaInfo.Session schema) { 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 boolean visit(Item item) { 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