Search in sources :

Example 21 with Hit

use of com.yahoo.search.result.Hit 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());
}
Also used : ErrorHit(com.yahoo.search.result.ErrorHit) Hit(com.yahoo.search.result.Hit) Result(com.yahoo.search.Result) Test(org.junit.Test)

Example 22 with Hit

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

the class SetHitCountsSearcher method createLoggingHit.

private Hit createLoggingHit() {
    Hit hit = new Hit("SetHitCountSearcher");
    hit.setMeta(true);
    hit.types().add("logging");
    return hit;
}
Also used : Hit(com.yahoo.search.result.Hit)

Example 23 with Hit

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

the class GroupingRequestTestCase method requireThatResultIsFound.

@Test
public void requireThatResultIsFound() {
    Query query = new Query();
    GroupingRequest req = GroupingRequest.newInstance(query);
    Result res = new Result(query);
    res.hits().add(new Hit("foo"));
    RootGroup bar = newRootGroup(0);
    req.setResultGroup(bar);
    res.hits().add(bar);
    res.hits().add(new Hit("baz"));
    Group grp = req.getResultGroup(res);
    assertNotNull(grp);
    assertSame(bar, grp);
}
Also used : RootGroup(com.yahoo.search.grouping.result.RootGroup) Group(com.yahoo.search.grouping.result.Group) Hit(com.yahoo.search.result.Hit) Query(com.yahoo.search.Query) RootGroup(com.yahoo.search.grouping.result.RootGroup) Result(com.yahoo.search.Result) Test(org.junit.Test)

Example 24 with Hit

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

the class GroupingRequestTestCase method requireThatNonGroupResultIsNull.

@Test
public void requireThatNonGroupResultIsNull() {
    Query query = new Query();
    GroupingRequest req = GroupingRequest.newInstance(query);
    Result res = new Result(query);
    RootGroup grp = newRootGroup(0);
    req.setResultGroup(grp);
    res.hits().add(new Hit(grp.getId().toString()));
    assertNull(req.getResultGroup(res));
}
Also used : Hit(com.yahoo.search.result.Hit) Query(com.yahoo.search.Query) RootGroup(com.yahoo.search.grouping.result.RootGroup) Result(com.yahoo.search.Result) Test(org.junit.Test)

Example 25 with Hit

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

the class GroupTestCase method requireThatListsAreAccessibleByLabel.

@Test
public void requireThatListsAreAccessibleByLabel() {
    Group grp = new Group(new LongId(69L), new Relevance(1));
    grp.add(new Hit("hit"));
    grp.add(new HitList("hitList"));
    grp.add(new GroupList("groupList"));
    assertNotNull(grp.getGroupList("groupList"));
    assertNull(grp.getGroupList("unknownGroupList"));
    assertNull(grp.getGroupList("hitList"));
    assertNotNull(grp.getHitList("hitList"));
    assertNull(grp.getHitList("unknownHitList"));
    assertNull(grp.getHitList("groupList"));
}
Also used : Relevance(com.yahoo.search.result.Relevance) Hit(com.yahoo.search.result.Hit) Test(org.junit.Test)

Aggregations

Hit (com.yahoo.search.result.Hit)127 Result (com.yahoo.search.Result)72 Query (com.yahoo.search.Query)52 FastHit (com.yahoo.prelude.fastsearch.FastHit)42 Test (org.junit.Test)41 Execution (com.yahoo.search.searchchain.Execution)25 HitGroup (com.yahoo.search.result.HitGroup)21 Searcher (com.yahoo.search.Searcher)17 JSONString (com.yahoo.prelude.hitfield.JSONString)13 GroupingListHit (com.yahoo.prelude.fastsearch.GroupingListHit)12 ErrorHit (com.yahoo.search.result.ErrorHit)10 Relevance (com.yahoo.search.result.Relevance)10 HashMap (java.util.HashMap)9 DocumentSourceSearcher (com.yahoo.prelude.searcher.DocumentSourceSearcher)8 Group (com.yahoo.search.grouping.result.Group)8 ComponentId (com.yahoo.component.ComponentId)7 Chain (com.yahoo.component.chain.Chain)7 FS4Hit (com.yahoo.searchlib.aggregation.FS4Hit)6 VdsHit (com.yahoo.searchlib.aggregation.VdsHit)6 GroupList (com.yahoo.search.grouping.result.GroupList)5