use of com.yahoo.search.Result in project vespa by vespa-engine.
the class BlendingSearcherTestCase method testNonexistingBackendsCausesErrorOnFirst.
@Test
public void testNonexistingBackendsCausesErrorOnFirst() {
// Feel free to change to include all in the detail message...
BlendingSearcherWrapper searcher = setupFirstAndSecond();
Query query = new Query("/search?query=banana&search=nonesuch,orsuch");
Result result = new Execution(searcher, Execution.Context.createContextStub(new IndexFacts())).search(query);
assertEquals(0, result.getConcreteHitCount());
assertNotNull(result.hits().getError());
ErrorMessage e = result.hits().getError();
assertEquals("Invalid query parameter", e.getMessage());
// TODO: Do not depend on sources order
assertEquals("4: Invalid query parameter: Could not resolve source ref 'nonesuch'. Could not resolve source ref 'orsuch'. Valid source refs are first, second.", e.toString());
}
use of com.yahoo.search.Result in project vespa by vespa-engine.
the class FederationSearcherTest method require_that_hits_can_be_filled_for_multiple_chains_and_queries.
@Test
public void require_that_hits_can_be_filled_for_multiple_chains_and_queries() {
FederationTester tester = new FederationTester();
tester.addSearchChain("chain1", new AddHitSearcher());
tester.addSearchChain("chain2", new ModifyQueryAndAddHitSearcher("modified1"));
tester.addSearchChain("chain3", new ModifyQueryAndAddHitSearcher("modified2"));
Result result = tester.search();
tester.fill(result);
assertEquals(3, result.hits().getConcreteSize());
for (Iterator<Hit> i = result.hits().deepIterator(); i.hasNext(); ) assertFilled(i.next());
}
use of com.yahoo.search.Result in project vespa by vespa-engine.
the class FederationSearcherTest method require_that_optional_search_chains_does_not_delay_federation.
@Test
public void require_that_optional_search_chains_does_not_delay_federation() {
BlockingSearcher blockingSearcher = new BlockingSearcher();
FederationTester tester = new FederationTester();
tester.addSearchChain("chain1", new AddHitSearcher());
tester.addOptionalSearchChain("chain2", blockingSearcher);
Result result = tester.searchAndFill();
assertThat(getNonErrorHits(result).size(), is(1));
assertFilled(getFirstHit(getNonErrorHits(result).get(0)));
assertNotNull(result.hits().getError());
}
use of com.yahoo.search.Result in project vespa by vespa-engine.
the class FederationSearcherTest method require_that_hits_can_be_filled_when_moved.
@Test
public void require_that_hits_can_be_filled_when_moved() {
FederationTester tester = new FederationTester();
tester.addSearchChain("chain1", new AddHitSearcher());
tester.addSearchChain("chain2", new AddHitSearcher());
Result result = tester.search();
Result reorganizedResult = new Result(result.getQuery());
HitGroup hit1 = new HitGroup();
HitGroup nestedHitGroup = new HitGroup();
hit1.add(nestedHitGroup);
reorganizedResult.hits().add(hit1);
HitGroup chain1Group = (HitGroup) result.hits().get(0);
HitGroup chain2Group = (HitGroup) result.hits().get(1);
nestedHitGroup.add(chain1Group.get(0));
reorganizedResult.hits().add(chain2Group.get(0));
reorganizedResult.hits().add(nestedHitGroup);
tester.fill(reorganizedResult);
assertFilled(nestedHitGroup.get(0));
assertFilled(chain2Group.get(0));
}
use of com.yahoo.search.Result in project vespa by vespa-engine.
the class FederationSearcherTest method require_that_hits_are_not_automatically_filled.
@Test
public void require_that_hits_are_not_automatically_filled() {
Result result = federationToSingleAddHitSearcher().search();
assertNotFilled(firstHitInFirstGroup(result));
}
Aggregations