Search in sources :

Example 1 with ValidatePredicateSearcher

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

the class ValidatePredicateSearcherTestCase method testQueryOutOfBounds.

@Test
public void testQueryOutOfBounds() {
    ValidatePredicateSearcher searcher = new ValidatePredicateSearcher();
    String q = "select * from sources * where predicate(predicate_field,0,{\"age\":200L});";
    Result r = doSearch(searcher, q, "predicate-bounds [0..99]");
    assertEquals(ErrorMessage.createIllegalQuery("age=200 outside configured predicate bounds."), r.hits().getError());
}
Also used : ValidatePredicateSearcher(com.yahoo.prelude.searcher.ValidatePredicateSearcher) Result(com.yahoo.search.Result) Test(org.junit.Test)

Example 2 with ValidatePredicateSearcher

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

the class ValidatePredicateSearcherTestCase method testValidQuery.

@Test
public void testValidQuery() {
    ValidatePredicateSearcher searcher = new ValidatePredicateSearcher();
    String q = "select * from sources * where predicate(predicate_field,0,{\"age\":20L});";
    Result r = doSearch(searcher, q, "predicate-bounds [0..99]");
    assertNull(r.hits().getError());
}
Also used : ValidatePredicateSearcher(com.yahoo.prelude.searcher.ValidatePredicateSearcher) Result(com.yahoo.search.Result) Test(org.junit.Test)

Aggregations

ValidatePredicateSearcher (com.yahoo.prelude.searcher.ValidatePredicateSearcher)2 Result (com.yahoo.search.Result)2 Test (org.junit.Test)2