Search in sources :

Example 6 with QueryContext

use of com.yahoo.search.query.context.QueryContext in project vespa by vespa-engine.

the class TraceTestCase method testBasicTracing.

public void testBasicTracing() {
    Query query = new Query();
    QueryContext h = query.getContext(true);
    h.trace("first message", 0);
    h.trace("second message", 0);
    assertEquals("trace: [ [ first message second message ] ]", h.toString());
}
Also used : Query(com.yahoo.search.Query) QueryContext(com.yahoo.search.query.context.QueryContext)

Example 7 with QueryContext

use of com.yahoo.search.query.context.QueryContext in project vespa by vespa-engine.

the class PropertiesTestCase method testProperties.

public void testProperties() {
    Query query = new Query();
    QueryContext h = query.getContext(true);
    h.setProperty("a", "a1");
    h.trace("first message", 2);
    h.setProperty("a", "a2");
    h.setProperty("b", "b1");
    query.clone();
    QueryContext h2 = query.clone().getContext(true);
    h2.setProperty("b", "b2");
    h2.trace("second message", 2);
    h2.setProperty("b", "b3");
    h.setProperty("b", "b4");
    QueryContext h3 = query.clone().getContext(true);
    h3.setProperty("b", "b5");
    h3.setProperty("c", "c1");
    h3.trace("third message", 2);
    h2.setProperty("c", "c2");
    h.trace("fourth message", 2);
    h.setProperty("d", "d1");
    h2.trace("fifth message", 2);
    h2.setProperty("c", "c3");
    h.setProperty("c", "c4");
    assertEquals("a2", h.getProperty("a"));
    assertEquals("b5", h.getProperty("b"));
    assertEquals("c4", h.getProperty("c"));
    assertEquals("d1", h.getProperty("d"));
    assertNull(h.getProperty("e"));
}
Also used : Query(com.yahoo.search.Query) QueryContext(com.yahoo.search.query.context.QueryContext)

Aggregations

QueryContext (com.yahoo.search.query.context.QueryContext)7 Query (com.yahoo.search.Query)6 StringWriter (java.io.StringWriter)3 Writer (java.io.Writer)3 Execution (com.yahoo.processing.execution.Execution)1 Result (com.yahoo.search.Result)1 VisitorStatistics (com.yahoo.vdslib.VisitorStatistics)1 IOException (java.io.IOException)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1