Skip to content

Commit b199f8b

Browse files
author
Harald Musum
authored
Merge pull request #30667 from vespa-engine/balder/minor-cleanup
Pattern variable
2 parents 8e2d974 + d3284ac commit b199f8b

File tree

5 files changed

+13
-19
lines changed

5 files changed

+13
-19
lines changed

config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@
3535
* @author gjoranv
3636
* @author Tony Vaagenes
3737
*/
38-
public class ContainerSearch extends ContainerSubsystem<SearchChains>
39-
implements
38+
public class ContainerSearch extends ContainerSubsystem<SearchChains> implements
4039
IndexInfoConfig.Producer,
4140
IlscriptsConfig.Producer,
4241
QrSearchersConfig.Producer,
4342
QueryProfilesConfig.Producer,
4443
SemanticRulesConfig.Producer,
4544
PageTemplatesConfig.Producer,
46-
SchemaInfoConfig.Producer {
45+
SchemaInfoConfig.Producer
46+
{
4747

4848
public static final String QUERY_PROFILE_REGISTRY_CLASS = CompiledQueryProfileRegistry.class.getName();
4949

config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ public static class Builder extends VespaDomBuilder.DomConfigProducerBuilderBase
8989

9090
public Builder(Map<String, NewDocumentType> documentDefinitions,
9191
Set<NewDocumentType> globallyDistributedDocuments,
92-
double fractionOfMemoryReserved, ResourceLimits resourceLimits) {
92+
double fractionOfMemoryReserved, ResourceLimits resourceLimits)
93+
{
9394
this.documentDefinitions = documentDefinitions;
9495
this.globallyDistributedDocuments = globallyDistributedDocuments;
9596
this.fractionOfMemoryReserved = fractionOfMemoryReserved;
@@ -103,12 +104,9 @@ protected ContentSearchCluster doBuild(DeployState deployState, TreeConfigProduc
103104
Boolean flushOnShutdownElem = clusterElem.childAsBoolean("engine.proton.flush-on-shutdown");
104105
Boolean syncTransactionLog = clusterElem.childAsBoolean("engine.proton.sync-transactionlog");
105106

106-
var search = new ContentSearchCluster(ancestor, clusterName,
107-
deployState.getProperties().featureFlags(),
108-
documentDefinitions,
109-
globallyDistributedDocuments,
110-
getFlushOnShutdown(flushOnShutdownElem),
111-
syncTransactionLog,
107+
var search = new ContentSearchCluster(ancestor, clusterName, deployState.getProperties().featureFlags(),
108+
documentDefinitions, globallyDistributedDocuments,
109+
getFlushOnShutdown(flushOnShutdownElem), syncTransactionLog,
112110
fractionOfMemoryReserved);
113111

114112
ModelElement tuning = clusterElem.childByPath("engine.proton.tuning");

config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,7 @@ void addsEnvironmentVariablesfromFeatureFlag() {
362362
" <node hostalias=\"mockhost\" distribution-key=\"0\" />" +
363363
" </group>" +
364364
"</content>", new TestProperties().setEnvironmentVariables(List.of("MY_1_ENV=xyz abc", "MY_2_ENV=2")));
365-
ContentSearchCluster s;
366-
367-
s = b.getSearch();
365+
ContentSearchCluster s = b.getSearch();
368366
assertTrue(s.hasIndexedCluster());
369367
assertNotNull(s.getIndexed());
370368
assertEquals(1, b.getStorageCluster().getChildren().size());

container-search/src/main/java/com/yahoo/search/grouping/GroupingValidator.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public GroupingValidator(QrSearchersConfig qrsConfig, ClusterConfig clusterConfi
5555
var searchCluster = qrsConfig.searchcluster(clusterId);
5656
QrSearchersConfig.Searchcluster.Indexingmode.Enum indexingMode = searchCluster.indexingmode();
5757
enabled = (indexingMode != QrSearchersConfig.Searchcluster.Indexingmode.STREAMING);
58-
clusterName = enabled ? searchCluster.name() : null;
58+
clusterName = searchCluster.name();
5959
for (AttributesConfig.Attribute attr : attributesConfig.attribute()) {
6060
attributes.put(attr.name(), attr);
6161
}
@@ -97,8 +97,7 @@ private class MyVisitor implements ExpressionVisitor {
9797

9898
@Override
9999
public void visitExpression(GroupingExpression exp) {
100-
if (exp instanceof AttributeMapLookupValue) {
101-
AttributeMapLookupValue mapLookup = (AttributeMapLookupValue) exp;
100+
if (exp instanceof AttributeMapLookupValue mapLookup) {
102101
verifyHasAttribute(mapLookup.getKeyAttribute());
103102
verifyHasAttribute(mapLookup.getValueAttribute());
104103
if (mapLookup.hasKeySourceAttribute()) {

container-search/src/main/java/com/yahoo/search/searchers/QueryValidator.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import com.yahoo.search.Result;
1212
import com.yahoo.search.Searcher;
1313
import com.yahoo.search.schema.Field;
14-
import com.yahoo.search.schema.FieldInfo;
1514
import com.yahoo.search.schema.SchemaInfo;
1615
import com.yahoo.search.searchchain.Execution;
1716
import com.yahoo.search.searchchain.PhaseNames;
@@ -55,7 +54,7 @@ public TermSearchValidator(SchemaInfo.Session schema) {
5554
public boolean visit(Item item) {
5655
if (item instanceof HasIndexItem indexItem) {
5756
var field = schema.fieldInfo(indexItem.getIndexName());
58-
if (! field.isPresent()) return true;
57+
if (field.isEmpty()) return true;
5958
if (field.get().type().kind() == Field.Type.Kind.TENSOR)
6059
throw new IllegalArgumentException("Cannot search for terms in '" + indexItem.getIndexName() +
6160
"': It is a tensor field");
@@ -76,7 +75,7 @@ public boolean visit(Item item) {
7675
if (schema.isStreaming()) return true; // prefix is always supported
7776
if (item instanceof PrefixItem prefixItem) {
7877
var field = schema.fieldInfo(prefixItem.getIndexName());
79-
if (! field.isPresent()) return true;
78+
if (field.isEmpty()) return true;
8079
if ( ! field.get().isAttribute())
8180
throw new IllegalArgumentException("'" + prefixItem.getIndexName() + "' is not an attribute field: Prefix matching is not supported");
8281
if (field.get().isIndex()) // index overrides attribute

0 commit comments

Comments
 (0)