blob: 880a90dabe1faa9084797b43f12d24073f057c39 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.content.cluster;
import com.yahoo.config.application.api.DeployLogger;
import com.yahoo.vespa.model.content.DispatchTuning;
import com.yahoo.vespa.model.builder.xml.dom.ModelElement;
/**
* @author Simon Thoresen Hult
*/
public class DomTuningDispatchBuilder {
public static DispatchTuning build(ModelElement contentXml, DeployLogger logger) {
DispatchTuning.Builder builder = new DispatchTuning.Builder();
ModelElement tuningElement = contentXml.child("tuning");
if (tuningElement == null) {
return builder.build();
}
ModelElement dispatchElement = tuningElement.child("dispatch");
if (dispatchElement == null) {
return builder.build();
}
builder.setMaxHitsPerPartition(dispatchElement.childAsInteger("max-hits-per-partition"));
builder.setTopKProbability(dispatchElement.childAsDouble("top-k-probability"));
builder.setDispatchPolicy(dispatchElement.childAsString("dispatch-policy"));
builder.setMinActiveDocsCoverage(dispatchElement.childAsDouble("min-active-docs-coverage"));
return builder.build();
}
}
|