Search in sources :

Example 46 with Query

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

the class SoftTimeoutTestCase method testDefaultsInQuery.

@Test
public void testDefaultsInQuery() {
    Query query = new Query("?query=test");
    assertNull(query.getRanking().getSoftTimeout().getEnable());
    assertNull(query.getRanking().getSoftTimeout().getFactor());
    assertNull(query.getRanking().getSoftTimeout().getTailcost());
}
Also used : Query(com.yahoo.search.Query) Test(org.junit.Test)

Example 47 with Query

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

the class XmlReadingTestCase method testNewsCase2.

@Test
public void testNewsCase2() {
    CompiledQueryProfileRegistry registry = new QueryProfileXMLReader().read("src/test/java/com/yahoo/search/query/profile/config/test/newscase2").compile();
    Query query;
    query = new Query(HttpRequest.createTestRequest("?query=test&custid_1=parent", Method.GET), registry.getComponent("default"));
    assertEquals("0.0", query.properties().get("a.features.b"));
    assertEquals("0.0", query.properties().listProperties().get("a.features.b"));
    query = new Query(HttpRequest.createTestRequest("?query=test&custid_1=parent&custid_2=child", Method.GET), registry.getComponent("default"));
    assertEquals("0.1", query.properties().get("a.features.b"));
    assertEquals("0.1", query.properties().listProperties().get("a.features.b"));
}
Also used : CompiledQueryProfileRegistry(com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry) Query(com.yahoo.search.Query) QueryProfileXMLReader(com.yahoo.search.query.profile.config.QueryProfileXMLReader) Test(org.junit.Test)

Example 48 with Query

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

the class XmlReadingTestCase method testNewsCase3.

@Test
public void testNewsCase3() {
    CompiledQueryProfileRegistry registry = new QueryProfileXMLReader().read("src/test/java/com/yahoo/search/query/profile/config/test/newscase3").compile();
    Query query;
    query = new Query(HttpRequest.createTestRequest("?query=test&custid_1=parent", Method.GET), registry.getComponent("default"));
    assertEquals("0.0", query.properties().get("a.features"));
    query = new Query(HttpRequest.createTestRequest("?query=test&custid_1=parent&custid_2=child", Method.GET), registry.getComponent("default"));
    assertEquals("0.1", query.properties().get("a.features"));
}
Also used : CompiledQueryProfileRegistry(com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry) Query(com.yahoo.search.Query) QueryProfileXMLReader(com.yahoo.search.query.profile.config.QueryProfileXMLReader) Test(org.junit.Test)

Example 49 with Query

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

the class XmlReadingTestCase method testBasicsWithProfile.

@Test
public void testBasicsWithProfile() {
    QueryProfile p = new QueryProfile("default");
    p.set("a", "foo", null);
    Query q = new Query(HttpRequest.createTestRequest("?query=test", Method.GET), p.compile(null));
    assertEquals("test", q.properties().get("query"));
    assertEquals("test", q.properties().get("QueRY"));
    assertEquals("test", q.properties().get("model.queryString"));
    assertEquals("test", q.getModel().getQueryString());
}
Also used : CompiledQueryProfile(com.yahoo.search.query.profile.compiled.CompiledQueryProfile) QueryProfile(com.yahoo.search.query.profile.QueryProfile) Query(com.yahoo.search.Query) Test(org.junit.Test)

Example 50 with Query

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

the class XmlReadingTestCase method testNewsCase1.

@Test
public void testNewsCase1() {
    CompiledQueryProfileRegistry registry = new QueryProfileXMLReader().read("src/test/java/com/yahoo/search/query/profile/config/test/newscase1").compile();
    Query query;
    query = new Query(HttpRequest.createTestRequest("?query=test&custid_1=parent", Method.GET), registry.getComponent("default"));
    assertEquals("0.0", query.properties().get("ranking.features.b"));
    assertEquals("0.0", query.properties().listProperties().get("ranking.features.b"));
    query = new Query(HttpRequest.createTestRequest("?query=test&custid_1=parent&custid_2=child", Method.GET), registry.getComponent("default"));
    assertEquals("0.1", query.properties().get("ranking.features.b"));
    assertEquals("0.1", query.properties().listProperties().get("ranking.features.b"));
}
Also used : CompiledQueryProfileRegistry(com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry) Query(com.yahoo.search.Query) QueryProfileXMLReader(com.yahoo.search.query.profile.config.QueryProfileXMLReader) Test(org.junit.Test)

Aggregations

Query (com.yahoo.search.Query)689 Test (org.junit.Test)415 Result (com.yahoo.search.Result)229 Execution (com.yahoo.search.searchchain.Execution)184 Searcher (com.yahoo.search.Searcher)82 QueryProfile (com.yahoo.search.query.profile.QueryProfile)63 Hit (com.yahoo.search.result.Hit)52 Chain (com.yahoo.component.chain.Chain)47 IndexFacts (com.yahoo.prelude.IndexFacts)44 CompiledQueryProfileRegistry (com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry)37 AndItem (com.yahoo.prelude.query.AndItem)33 WordItem (com.yahoo.prelude.query.WordItem)33 FastHit (com.yahoo.prelude.fastsearch.FastHit)31 CompiledQueryProfile (com.yahoo.search.query.profile.compiled.CompiledQueryProfile)27 HitGroup (com.yahoo.search.result.HitGroup)24 Item (com.yahoo.prelude.query.Item)21 HashMap (java.util.HashMap)20 CacheKey (com.yahoo.prelude.fastsearch.CacheKey)18 GroupingRequest (com.yahoo.search.grouping.GroupingRequest)18 ArrayList (java.util.ArrayList)18