Search in sources :

Example 1 with HitList

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

the class GroupingExecutorTestCase method requireThatDefaultSummaryNameFillsHitsWithNull.

@Test
public void requireThatDefaultSummaryNameFillsHitsWithNull() {
    Query query = newQuery();
    GroupingRequest req = GroupingRequest.newInstance(query);
    req.setRootOperation(GroupingOperation.fromString("all(group(foo) each(each(output(summary()))) as(foo))"));
    Grouping pass0 = new Grouping(0);
    pass0.setRoot(new com.yahoo.searchlib.aggregation.Group().addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("foo")).addAggregationResult(new HitsAggregationResult(1, ExpressionConverter.DEFAULT_SUMMARY_NAME))));
    Grouping pass1 = new Grouping(0);
    pass1.setRoot(new com.yahoo.searchlib.aggregation.Group().addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("foo")).addAggregationResult(new HitsAggregationResult(1, ExpressionConverter.DEFAULT_SUMMARY_NAME).addHit(new com.yahoo.searchlib.aggregation.FS4Hit()))));
    Execution exec = newExecution(new GroupingExecutor(), new ResultProvider(Arrays.asList(new GroupingListHit(Arrays.asList(pass0), null), new GroupingListHit(Arrays.asList(pass1), null))));
    Result res = exec.search(query);
    exec.fill(res);
    Hit hit = ((HitList) ((Group) ((GroupList) req.getResultGroup(res).get(0)).get(0)).get(0)).get(0);
    assertTrue(hit instanceof FastHit);
    assertTrue(hit.isFilled(null));
}
Also used : Group(com.yahoo.search.grouping.result.Group) Query(com.yahoo.search.Query) HitList(com.yahoo.search.grouping.result.HitList) Grouping(com.yahoo.searchlib.aggregation.Grouping) GroupingListHit(com.yahoo.prelude.fastsearch.GroupingListHit) Result(com.yahoo.search.Result) HitsAggregationResult(com.yahoo.searchlib.aggregation.HitsAggregationResult) CountAggregationResult(com.yahoo.searchlib.aggregation.CountAggregationResult) MinAggregationResult(com.yahoo.searchlib.aggregation.MinAggregationResult) MaxAggregationResult(com.yahoo.searchlib.aggregation.MaxAggregationResult) HitsAggregationResult(com.yahoo.searchlib.aggregation.HitsAggregationResult) GroupingListHit(com.yahoo.prelude.fastsearch.GroupingListHit) FastHit(com.yahoo.prelude.fastsearch.FastHit) Hit(com.yahoo.search.result.Hit) Execution(com.yahoo.search.searchchain.Execution) FastHit(com.yahoo.prelude.fastsearch.FastHit) GroupList(com.yahoo.search.grouping.result.GroupList) GroupingRequest(com.yahoo.search.grouping.GroupingRequest) StringResultNode(com.yahoo.searchlib.expression.StringResultNode) Test(org.junit.Test)

Example 2 with HitList

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

the class UniqueGroupingSearcherTestCase method makeHitGroup.

private static Group makeHitGroup(String name) {
    Group ein = new Group(new StringId(name), new Relevance(0));
    HitList hits = new HitList(UniqueGroupingSearcher.LABEL_HITS);
    hits.add(new Hit(name));
    ein.add(hits);
    return ein;
}
Also used : Relevance(com.yahoo.search.result.Relevance) RootGroup(com.yahoo.search.grouping.result.RootGroup) Group(com.yahoo.search.grouping.result.Group) Hit(com.yahoo.search.result.Hit) StringId(com.yahoo.search.grouping.result.StringId) HitList(com.yahoo.search.grouping.result.HitList)

Example 3 with HitList

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

the class UniqueGroupingSearcherTestCase method makeSortingHitGroup.

private static Group makeSortingHitGroup(String name) {
    Hit hit = new Hit(name);
    HitList hits = new HitList(UniqueGroupingSearcher.LABEL_HITS);
    hits.add(hit);
    Group dedupGroup = new Group(new StringId(name), new Relevance(0));
    dedupGroup.add(hits);
    GroupList dedupedHits = new GroupList(UniqueGroupingSearcher.LABEL_GROUPS);
    dedupedHits.add(dedupGroup);
    Group ein = new Group(new StringId(name), new Relevance(0));
    ein.add(dedupedHits);
    return ein;
}
Also used : Relevance(com.yahoo.search.result.Relevance) RootGroup(com.yahoo.search.grouping.result.RootGroup) Group(com.yahoo.search.grouping.result.Group) Hit(com.yahoo.search.result.Hit) StringId(com.yahoo.search.grouping.result.StringId) GroupList(com.yahoo.search.grouping.result.GroupList) HitList(com.yahoo.search.grouping.result.HitList)

Aggregations

Group (com.yahoo.search.grouping.result.Group)3 HitList (com.yahoo.search.grouping.result.HitList)3 Hit (com.yahoo.search.result.Hit)3 GroupList (com.yahoo.search.grouping.result.GroupList)2 RootGroup (com.yahoo.search.grouping.result.RootGroup)2 StringId (com.yahoo.search.grouping.result.StringId)2 Relevance (com.yahoo.search.result.Relevance)2 FastHit (com.yahoo.prelude.fastsearch.FastHit)1 GroupingListHit (com.yahoo.prelude.fastsearch.GroupingListHit)1 Query (com.yahoo.search.Query)1 Result (com.yahoo.search.Result)1 GroupingRequest (com.yahoo.search.grouping.GroupingRequest)1 Execution (com.yahoo.search.searchchain.Execution)1 CountAggregationResult (com.yahoo.searchlib.aggregation.CountAggregationResult)1 Grouping (com.yahoo.searchlib.aggregation.Grouping)1 HitsAggregationResult (com.yahoo.searchlib.aggregation.HitsAggregationResult)1 MaxAggregationResult (com.yahoo.searchlib.aggregation.MaxAggregationResult)1 MinAggregationResult (com.yahoo.searchlib.aggregation.MinAggregationResult)1 StringResultNode (com.yahoo.searchlib.expression.StringResultNode)1 Test (org.junit.Test)1