Search in sources :

Example 1 with LegacyEmulationConfig

use of com.yahoo.container.search.LegacyEmulationConfig in project vespa by vespa-engine.

the class ClusterSearcherTestCase method createSearcher.

private static ClusterSearcher createSearcher(Double maxQueryTimeout, Double maxQueryCacheTimeout) {
    ComponentId id = new ComponentId("test-id");
    QrSearchersConfig qrsCfg = new QrSearchersConfig(new QrSearchersConfig.Builder().searchcluster(new QrSearchersConfig.Searchcluster.Builder().name("test-cluster")));
    ClusterConfig.Builder clusterCfgBld = new ClusterConfig.Builder().clusterName("test-cluster");
    if (maxQueryTimeout != null) {
        clusterCfgBld.maxQueryTimeout(maxQueryTimeout);
    }
    if (maxQueryCacheTimeout != null) {
        clusterCfgBld.maxQueryCacheTimeout(maxQueryCacheTimeout);
    }
    ClusterConfig clusterCfg = new ClusterConfig(clusterCfgBld);
    DocumentdbInfoConfig documentDbCfg = new DocumentdbInfoConfig(new DocumentdbInfoConfig.Builder().documentdb(new DocumentdbInfoConfig.Documentdb.Builder().name("type1")));
    LegacyEmulationConfig emulationCfg = new LegacyEmulationConfig(new LegacyEmulationConfig.Builder());
    QrMonitorConfig monitorCfg = new QrMonitorConfig(new QrMonitorConfig.Builder());
    Statistics statistics = Statistics.nullImplementation;
    Fs4Config fs4Cfg = new Fs4Config(new Fs4Config.Builder());
    FS4ResourcePool fs4ResourcePool = new FS4ResourcePool(fs4Cfg);
    ClusterSearcher searcher = new ClusterSearcher(id, qrsCfg, clusterCfg, documentDbCfg, emulationCfg, monitorCfg, new DispatchConfig(new DispatchConfig.Builder()), createClusterInfoConfig(), statistics, fs4ResourcePool, new VipStatus());
    return searcher;
}
Also used : DispatchConfig(com.yahoo.vespa.config.search.DispatchConfig) QrSearchersConfig(com.yahoo.container.QrSearchersConfig) VipStatus(com.yahoo.container.handler.VipStatus) Fs4Config(com.yahoo.container.search.Fs4Config) Statistics(com.yahoo.statistics.Statistics) FS4ResourcePool(com.yahoo.prelude.fastsearch.FS4ResourcePool) DocumentdbInfoConfig(com.yahoo.prelude.fastsearch.DocumentdbInfoConfig) LegacyEmulationConfig(com.yahoo.container.search.LegacyEmulationConfig) ComponentId(com.yahoo.component.ComponentId) ClusterConfig(com.yahoo.search.config.ClusterConfig)

Example 2 with LegacyEmulationConfig

use of com.yahoo.container.search.LegacyEmulationConfig in project vespa by vespa-engine.

the class SlimeSummaryTestCase method testDecodingEmptyWithoutForcedFill.

@Test
public void testDecodingEmptyWithoutForcedFill() {
    String summary_cf = "file:src/test/java/com/yahoo/prelude/fastsearch/summary.cfg";
    DocsumDefinitionSet set = createDocsumDefinitionSet(summary_cf, new LegacyEmulationConfig(new LegacyEmulationConfig.Builder().forceFillEmptyFields(false)));
    byte[] docsum = makeEmptyDocsum();
    FastHit hit = new FastHit();
    assertNull(set.lazyDecode("default", docsum, hit));
    assertThat(hit.getField("integer_field"), equalTo(null));
    assertThat(hit.getField("short_field"), equalTo(null));
    assertThat(hit.getField("byte_field"), equalTo(null));
    assertThat(hit.getField("float_field"), equalTo(null));
    assertThat(hit.getField("double_field"), equalTo(null));
    assertThat(hit.getField("int64_field"), equalTo(null));
    assertThat(hit.getField("string_field"), equalTo(null));
    assertThat(hit.getField("data_field"), equalTo(null));
    assertThat(hit.getField("data_field"), equalTo(null));
    assertThat(hit.getField("longstring_field"), equalTo(null));
    assertThat(hit.getField("longdata_field"), equalTo(null));
    assertThat(hit.getField("longdata_field"), equalTo(null));
    assertThat(hit.getField("xmlstring_field"), equalTo(null));
    assertThat(hit.getField("xmlstring_field"), equalTo(null));
    assertThat(hit.getField("jsonstring_field"), equalTo(null));
    assertNull(hit.getField("tensor_field1"));
    assertNull(hit.getField("tensor_field2"));
}
Also used : XMLString(com.yahoo.prelude.hitfield.XMLString) JSONString(com.yahoo.prelude.hitfield.JSONString) LegacyEmulationConfig(com.yahoo.container.search.LegacyEmulationConfig) Test(org.junit.Test)

Example 3 with LegacyEmulationConfig

use of com.yahoo.container.search.LegacyEmulationConfig in project vespa by vespa-engine.

the class SlimeSummaryTestCase method testDecodingEmpty.

@Test
public void testDecodingEmpty() {
    String summary_cf = "file:src/test/java/com/yahoo/prelude/fastsearch/summary.cfg";
    LegacyEmulationConfig emul = new LegacyEmulationConfig(new LegacyEmulationConfig.Builder().forceFillEmptyFields(true));
    DocsumDefinitionSet set = createDocsumDefinitionSet(summary_cf, emul);
    byte[] docsum = makeEmptyDocsum();
    FastHit hit = new FastHit();
    assertNull(set.lazyDecode("default", docsum, hit));
    assertThat(hit.getField("integer_field"), equalTo(NanNumber.NaN));
    assertThat(hit.getField("short_field"), equalTo(NanNumber.NaN));
    assertThat(hit.getField("byte_field"), equalTo(NanNumber.NaN));
    assertThat(hit.getField("float_field"), equalTo(NanNumber.NaN));
    assertThat(hit.getField("double_field"), equalTo(NanNumber.NaN));
    assertThat(hit.getField("int64_field"), equalTo(NanNumber.NaN));
    assertThat(hit.getField("string_field"), equalTo(""));
    assertThat(hit.getField("data_field"), instanceOf(RawData.class));
    assertThat(hit.getField("data_field").toString(), equalTo(""));
    assertThat(hit.getField("longstring_field"), equalTo((Object) ""));
    assertThat(hit.getField("longdata_field"), instanceOf(RawData.class));
    assertThat(hit.getField("longdata_field").toString(), equalTo(""));
    assertThat(hit.getField("xmlstring_field"), instanceOf(XMLString.class));
    assertThat(hit.getField("xmlstring_field").toString(), equalTo(""));
    // assertThat(hit.getField("jsonstring_field"), instanceOf(JSONString.class));
    assertThat(hit.getField("jsonstring_field").toString(), equalTo(""));
    // Empty tensors are represented by null because we don't have type information here to create the right empty tensor
    assertNull(hit.getField("tensor_field1"));
    assertNull(hit.getField("tensor_field2"));
}
Also used : RawData(com.yahoo.prelude.hitfield.RawData) XMLString(com.yahoo.prelude.hitfield.XMLString) JSONString(com.yahoo.prelude.hitfield.JSONString) LegacyEmulationConfig(com.yahoo.container.search.LegacyEmulationConfig) XMLString(com.yahoo.prelude.hitfield.XMLString) Test(org.junit.Test)

Aggregations

LegacyEmulationConfig (com.yahoo.container.search.LegacyEmulationConfig)3 JSONString (com.yahoo.prelude.hitfield.JSONString)2 XMLString (com.yahoo.prelude.hitfield.XMLString)2 Test (org.junit.Test)2 ComponentId (com.yahoo.component.ComponentId)1 QrSearchersConfig (com.yahoo.container.QrSearchersConfig)1 VipStatus (com.yahoo.container.handler.VipStatus)1 Fs4Config (com.yahoo.container.search.Fs4Config)1 DocumentdbInfoConfig (com.yahoo.prelude.fastsearch.DocumentdbInfoConfig)1 FS4ResourcePool (com.yahoo.prelude.fastsearch.FS4ResourcePool)1 RawData (com.yahoo.prelude.hitfield.RawData)1 ClusterConfig (com.yahoo.search.config.ClusterConfig)1 Statistics (com.yahoo.statistics.Statistics)1 DispatchConfig (com.yahoo.vespa.config.search.DispatchConfig)1