Skip to content

Commit

Permalink
Merge pull request #30667 from vespa-engine/balder/minor-cleanup
Browse files Browse the repository at this point in the history
Pattern variable
  • Loading branch information
hmusum committed Mar 17, 2024
2 parents 8e2d974 + d3284ac commit b199f8b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@
* @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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ public static class Builder extends VespaDomBuilder.DomConfigProducerBuilderBase

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;
Expand All @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,7 @@ void addsEnvironmentVariablesfromFeatureFlag() {
" <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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand All @@ -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
Expand Down

0 comments on commit b199f8b

Please sign in to comment.