use of com.yahoo.vespa.model.content.SearchCoverage in project vespa by vespa-engine.
the class DomSearchCoverageBuilderTest method requireThatDefaultsAreNull.
@Test
public void requireThatDefaultsAreNull() throws Exception {
SearchCoverage coverage = newSearchCoverage("<content/>");
assertNull(coverage.getMinimum());
assertNull(coverage.getMinWaitAfterCoverageFactor());
assertNull(coverage.getMaxWaitAfterCoverageFactor());
}
use of com.yahoo.vespa.model.content.SearchCoverage in project vespa by vespa-engine.
the class DomSearchCoverageBuilderTest method requireThatSearchCoverageCanBeBuilt.
@Test
public void requireThatSearchCoverageCanBeBuilt() throws Exception {
SearchCoverage coverage = newSearchCoverage("<content>" + " <search>" + " <coverage>" + " <minimum>0.11</minimum>" + " <min-wait-after-coverage-factor>0.23</min-wait-after-coverage-factor>" + " <max-wait-after-coverage-factor>0.58</max-wait-after-coverage-factor>" + " </coverage>" + " </search>" + "</content>");
assertEquals(0.11, coverage.getMinimum(), 1E-6);
assertEquals(0.23, coverage.getMinWaitAfterCoverageFactor(), 1E-6);
assertEquals(0.58, coverage.getMaxWaitAfterCoverageFactor(), 1E-6);
}
use of com.yahoo.vespa.model.content.SearchCoverage in project vespa by vespa-engine.
the class Dispatch method getConfig.
@Override
public void getConfig(PartitionsConfig.Builder builder) {
int rowbits = dispatchGroup.getRowBits();
final PartitionsConfig.Dataset.Builder datasetBuilder = new PartitionsConfig.Dataset.Builder().id(0).refcost(1).rowbits(rowbits).numparts(dispatchGroup.getNumPartitions()).mpp(dispatchGroup.getMinNodesPerColumn());
if (dispatchGroup.useFixedRowInDispatch()) {
datasetBuilder.querydistribution(PartitionsConfig.Dataset.Querydistribution.Enum.FIXEDROW);
datasetBuilder.maxnodesdownperfixedrow(dispatchGroup.getMaxNodesDownPerFixedRow());
}
SearchCoverage coverage = dispatchGroup.getSearchCoverage();
if (coverage != null) {
if (coverage.getMinimum() != null) {
// as percentage
datasetBuilder.minimal_searchcoverage(coverage.getMinimum() * 100);
}
if (coverage.getMinWaitAfterCoverageFactor() != null) {
datasetBuilder.higher_coverage_minsearchwait(coverage.getMinWaitAfterCoverageFactor());
}
if (coverage.getMaxWaitAfterCoverageFactor() != null) {
datasetBuilder.higher_coverage_maxsearchwait(coverage.getMaxWaitAfterCoverageFactor());
}
}
Tuning tuning = dispatchGroup.getTuning();
boolean useLocalNode = false;
if (tuning != null && tuning.dispatch != null) {
useLocalNode = tuning.dispatch.useLocalNode;
}
final List<PartitionsConfig.Dataset.Engine.Builder> allEngines = new ArrayList<>();
for (SearchInterface searchNode : dispatchGroup.getSearchersIterable()) {
final PartitionsConfig.Dataset.Engine.Builder engineBuilder = new PartitionsConfig.Dataset.Engine.Builder().name_and_port(searchNode.getDispatcherConnectSpec()).rowid(searchNode.getNodeSpec().groupIndex()).partid(searchNode.getNodeSpec().partitionId());
allEngines.add(engineBuilder);
if (preferLocalRow) {
if (getHostname().equals(searchNode.getHostName())) {
engineBuilder.refcost(1);
} else {
engineBuilder.refcost(Integer.MAX_VALUE);
}
}
if (!useLocalNode || getHostname().equals(searchNode.getHostName())) {
if (useLocalNode) {
engineBuilder.rowid(0);
}
datasetBuilder.engine.add(engineBuilder);
}
}
// Do not create empty engine list for a dataset if no local search nodes found
if (datasetBuilder.engine.isEmpty() && useLocalNode) {
for (PartitionsConfig.Dataset.Engine.Builder engineBuilder : allEngines) {
datasetBuilder.engine.add(engineBuilder);
}
}
builder.dataset.add(datasetBuilder);
if (tuning != null) {
tuning.getConfig(builder);
scaleMaxHitsPerPartitions(builder, tuning);
}
}
use of com.yahoo.vespa.model.content.SearchCoverage in project vespa by vespa-engine.
the class DomSearchCoverageBuilderTest method requireThatEmptyCoverageIsSafe.
@Test
public void requireThatEmptyCoverageIsSafe() throws Exception {
SearchCoverage coverage = newSearchCoverage("<content>" + " <search>" + " <coverage/>" + " </search>" + "</content>");
assertNull(coverage.getMinimum());
assertNull(coverage.getMinWaitAfterCoverageFactor());
assertNull(coverage.getMaxWaitAfterCoverageFactor());
}
use of com.yahoo.vespa.model.content.SearchCoverage in project vespa by vespa-engine.
the class DomSearchCoverageBuilderTest method requireThatEmptySearchIsSafe.
@Test
public void requireThatEmptySearchIsSafe() throws Exception {
SearchCoverage coverage = newSearchCoverage("<content>" + " <search/>" + "</content>");
assertNull(coverage.getMinimum());
assertNull(coverage.getMinWaitAfterCoverageFactor());
assertNull(coverage.getMaxWaitAfterCoverageFactor());
}
Aggregations