Search in sources :

Example 1 with ContentSearch

use of com.yahoo.vespa.model.content.ContentSearch in project vespa by vespa-engine.

the class DomContentSearchBuilder method build.

public static ContentSearch build(ModelElement contentXml) {
    ContentSearch.Builder builder = new ContentSearch.Builder();
    ModelElement searchElement = contentXml.getChild("search");
    if (searchElement == null) {
        return builder.build();
    }
    builder.setQueryTimeout(searchElement.childAsDouble("query-timeout"));
    builder.setVisibilityDelay(searchElement.childAsDouble("visibility-delay"));
    return builder.build();
}
Also used : ContentSearch(com.yahoo.vespa.model.content.ContentSearch) ModelElement(com.yahoo.vespa.model.builder.xml.dom.ModelElement)

Example 2 with ContentSearch

use of com.yahoo.vespa.model.content.ContentSearch in project vespa by vespa-engine.

the class DomContentSearchBuilderTest method requireThatContentSearchCanBeBuilt.

@Test
public void requireThatContentSearchCanBeBuilt() throws Exception {
    ContentSearch search = newContentSearch("<content>" + "  <search>" + "    <query-timeout>1.1</query-timeout>" + "    <visibility-delay>2.3</visibility-delay>" + "  </search>" + "</content>");
    assertEquals(1.1, search.getQueryTimeout(), 1E-6);
    assertEquals(2.3, search.getVisibilityDelay(), 1E-6);
}
Also used : ContentSearch(com.yahoo.vespa.model.content.ContentSearch) Test(org.junit.Test)

Example 3 with ContentSearch

use of com.yahoo.vespa.model.content.ContentSearch in project vespa by vespa-engine.

the class DomContentSearchBuilderTest method requireThatDefaultsAreNull.

@Test
public void requireThatDefaultsAreNull() throws Exception {
    ContentSearch search = newContentSearch("<content/>");
    assertNull(search.getVisibilityDelay());
    assertNull(search.getQueryTimeout());
}
Also used : ContentSearch(com.yahoo.vespa.model.content.ContentSearch) Test(org.junit.Test)

Example 4 with ContentSearch

use of com.yahoo.vespa.model.content.ContentSearch in project vespa by vespa-engine.

the class DomContentSearchBuilderTest method requireThatEmptySearchIsSafe.

@Test
public void requireThatEmptySearchIsSafe() throws Exception {
    ContentSearch search = newContentSearch("<content>" + "  <search/>" + "</content>");
    assertNull(search.getVisibilityDelay());
    assertNull(search.getQueryTimeout());
}
Also used : ContentSearch(com.yahoo.vespa.model.content.ContentSearch) Test(org.junit.Test)

Aggregations

ContentSearch (com.yahoo.vespa.model.content.ContentSearch)4 Test (org.junit.Test)3 ModelElement (com.yahoo.vespa.model.builder.xml.dom.ModelElement)1