Search in sources :

Example 81 with QueryProfile

use of com.yahoo.search.query.profile.QueryProfile in project vespa by vespa-engine.

the class CloningTestCase method testThreeLevelsOfCloningMiddleFirstSetOrder1.

public void testThreeLevelsOfCloningMiddleFirstSetOrder1() {
    QueryProfile test = new QueryProfile("test");
    test.set("a", "config-a", (QueryProfileRegistry) null);
    test.freeze();
    Query q1 = new Query(HttpRequest.createTestRequest("?query=q", Method.GET), test.compile(null));
    Query q2 = q1.clone();
    Query q31 = q2.clone();
    Query q32 = q2.clone();
    q2.properties().set("a", "q2-a");
    q32.properties().set("a", "q32-a");
    q31.properties().set("a", "q31-a");
    q1.properties().set("a", "q1-a");
    assertEquals("q1-a", q1.properties().get("a").toString());
    assertEquals("q2-a", q2.properties().get("a").toString());
    assertEquals("q31-a", q31.properties().get("a").toString());
    assertEquals("q32-a", q32.properties().get("a").toString());
    q2.properties().set("a", "q2-a-2");
    assertEquals("q1-a", q1.properties().get("a").toString());
    assertEquals("q2-a-2", q2.properties().get("a").toString());
    assertEquals("q31-a", q31.properties().get("a").toString());
    assertEquals("q32-a", q32.properties().get("a").toString());
}
Also used : QueryProfile(com.yahoo.search.query.profile.QueryProfile) Query(com.yahoo.search.Query)

Example 82 with QueryProfile

use of com.yahoo.search.query.profile.QueryProfile in project vespa by vespa-engine.

the class CloningTestCase method testThreeLevelsOfCloningReverseSetOrder.

public void testThreeLevelsOfCloningReverseSetOrder() {
    QueryProfile test = new QueryProfile("test");
    test.set("a", "config-a", (QueryProfileRegistry) null);
    test.freeze();
    Query q1 = new Query(HttpRequest.createTestRequest("?query=q", Method.GET), test.compile(null));
    Query q2 = q1.clone();
    Query q31 = q2.clone();
    Query q32 = q2.clone();
    q32.properties().set("a", "q32-a");
    q31.properties().set("a", "q31-a");
    q2.properties().set("a", "q2-a");
    q1.properties().set("a", "q1-a");
    assertEquals("q1-a", q1.properties().get("a").toString());
    assertEquals("q2-a", q2.properties().get("a").toString());
    assertEquals("q31-a", q31.properties().get("a").toString());
    assertEquals("q32-a", q32.properties().get("a").toString());
    q2.properties().set("a", "q2-a-2");
    assertEquals("q1-a", q1.properties().get("a").toString());
    assertEquals("q2-a-2", q2.properties().get("a").toString());
    assertEquals("q31-a", q31.properties().get("a").toString());
    assertEquals("q32-a", q32.properties().get("a").toString());
}
Also used : QueryProfile(com.yahoo.search.query.profile.QueryProfile) Query(com.yahoo.search.Query)

Example 83 with QueryProfile

use of com.yahoo.search.query.profile.QueryProfile in project vespa by vespa-engine.

the class QueryProfileGetMicroBenchmark method createQuery.

private Query createQuery() {
    QueryProfile main = new QueryProfile("main");
    main.set("a", "value1", (QueryProfileRegistry) null);
    main.set("b", "value2", useDimensions ? new String[] { "x1" } : null, null);
    main.set("c", "value3", useDimensions ? new String[] { "x1", "y2" } : null, null);
    main.freeze();
    Query query = new Query(HttpRequest.createTestRequest("?query=test&x=1&y=2", Method.GET), main.compile(null));
    setValues(query);
    return query;
}
Also used : QueryProfile(com.yahoo.search.query.profile.QueryProfile) Query(com.yahoo.search.Query)

Example 84 with QueryProfile

use of com.yahoo.search.query.profile.QueryProfile in project vespa by vespa-engine.

the class QueryTestCase method testSetNullProperty.

@Test
public void testSetNullProperty() {
    QueryProfile profile = new QueryProfile("test");
    profile.set("property", "initialValue", (QueryProfileRegistry) null);
    Query query = new Query(httpEncode("?query=test"), profile.compile(null));
    assertEquals("initialValue", query.properties().get("property"));
    query.properties().set("property", null);
    assertNull(query.properties().get("property"));
}
Also used : QueryProfile(com.yahoo.search.query.profile.QueryProfile) Query(com.yahoo.search.Query) Test(org.junit.Test)

Example 85 with QueryProfile

use of com.yahoo.search.query.profile.QueryProfile in project vespa by vespa-engine.

the class QueryTestCase method testTimeoutInRequestOverridesQueryProfile.

@Test
public void testTimeoutInRequestOverridesQueryProfile() {
    QueryProfile profile = new QueryProfile("test");
    profile.set("timeout", 318, (QueryProfileRegistry) null);
    Query q = new Query(QueryTestCase.httpEncode("/search?timeout=500"), profile.compile(null));
    assertEquals(500000L, q.getTimeout());
}
Also used : QueryProfile(com.yahoo.search.query.profile.QueryProfile) Query(com.yahoo.search.Query) Test(org.junit.Test)

Aggregations

QueryProfile (com.yahoo.search.query.profile.QueryProfile)161 CompiledQueryProfile (com.yahoo.search.query.profile.compiled.CompiledQueryProfile)92 Query (com.yahoo.search.Query)63 BackedOverridableQueryProfile (com.yahoo.search.query.profile.BackedOverridableQueryProfile)35 CompiledQueryProfileRegistry (com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry)28 Test (org.junit.Test)26 QueryProfileRegistry (com.yahoo.search.query.profile.QueryProfileRegistry)24 QueryProfileProperties (com.yahoo.search.query.profile.QueryProfileProperties)21 QueryProfileType (com.yahoo.search.query.profile.types.QueryProfileType)12 Properties (com.yahoo.search.query.Properties)8 FieldDescription (com.yahoo.search.query.profile.types.FieldDescription)5 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)5 SubstituteString (com.yahoo.search.query.profile.SubstituteString)4 QueryProfilesConfig (com.yahoo.search.query.profile.config.QueryProfilesConfig)4 Element (org.w3c.dom.Element)4 QueryException (com.yahoo.prelude.query.QueryException)3 Properties (com.yahoo.processing.request.Properties)3 QueryProfileXMLReader (com.yahoo.search.query.profile.config.QueryProfileXMLReader)3 QueryProfiles (com.yahoo.vespa.model.container.search.QueryProfiles)3 ComponentSpecification (com.yahoo.component.ComponentSpecification)2