aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DomContentSearchBuilder.java
blob: e843412b233ed2d6c7a509bd614c6843a8cdf2d4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright Yahoo. 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.vespa.model.content.ContentSearch;
import com.yahoo.vespa.model.builder.xml.dom.ModelElement;

/**
 * @author Simon Thoresen Hult
 */
public class DomContentSearchBuilder {

    public static ContentSearch build(ModelElement contentXml) {
        ContentSearch.Builder builder = new ContentSearch.Builder();
        ModelElement searchElement = contentXml.child("search");
        if (searchElement == null) {
            return builder.build();
        }
        builder.setQueryTimeout(searchElement.childAsDouble("query-timeout"));
        builder.setVisibilityDelay(searchElement.childAsDouble("visibility-delay"));
        return builder.build();
    }
}