Search in sources :

Example 1 with PosSearcher

use of com.yahoo.prelude.searcher.PosSearcher in project vespa by vespa-engine.

the class PosSearcherTestCase method testNotOverridingOldStyleParameters.

@Test
public void testNotOverridingOldStyleParameters() {
    PosSearcher searcher = new PosSearcher();
    Query q = new Query("?query=test&pos.ll=N10.15;E6.08&location=(2,-1100222,0,300,0,1,0,CalcLatLon)");
    q.setTraceLevel(1);
    doSearch(searcher, q, 0, 10);
    assertEquals("(2,-1100222,0,300,0,1,0,4294967295)", q.getRanking().getLocation().toString());
}
Also used : Query(com.yahoo.search.Query) PosSearcher(com.yahoo.prelude.searcher.PosSearcher) Test(org.junit.Test)

Example 2 with PosSearcher

use of com.yahoo.prelude.searcher.PosSearcher in project vespa by vespa-engine.

the class PosSearcherTestCase method testInvalidInput.

/**
 * Tests input parameters that should report errors.
 */
@Test
public void testInvalidInput() {
    PosSearcher searcher = new PosSearcher();
    Result result;
    Query q = new Query();
    q.properties().set("pos.ll", "NE74.14;E14.48");
    result = doSearch(searcher, q, 0, 10);
    assertEquals("Error in pos parameters: Unable to parse lat/long string 'NE74.14;E14.48': already set direction once, cannot add direction: E", ((ErrorHit) result.hits().get(0)).errors().iterator().next().getDetailedMessage());
    q = new Query();
    q.properties().set("pos.ll", "NE74.14;E14.48");
    q.properties().set("pos.xy", "82400, 72800");
    result = doSearch(searcher, q, 0, 10);
    assertEquals("Error in pos parameters: Cannot handle both lat/long and xy coords at the same time", ((ErrorHit) result.hits().get(0)).errors().iterator().next().getDetailedMessage());
}
Also used : Query(com.yahoo.search.Query) PosSearcher(com.yahoo.prelude.searcher.PosSearcher) ErrorHit(com.yahoo.search.result.ErrorHit) Result(com.yahoo.search.Result) Test(org.junit.Test)

Aggregations

PosSearcher (com.yahoo.prelude.searcher.PosSearcher)2 Query (com.yahoo.search.Query)2 Test (org.junit.Test)2 Result (com.yahoo.search.Result)1 ErrorHit (com.yahoo.search.result.ErrorHit)1