use of com.yahoo.search.grouping.GroupingRequest in project vespa by vespa-engine.
the class GroupingExecutorTestCase method requireThatRequestsAreTransformed.
@Test
public void requireThatRequestsAreTransformed() {
Query query = newQuery();
GroupingRequest req = GroupingRequest.newInstance(query);
req.setRootOperation(GroupingOperation.fromString("all(group(foo) each(output(max(bar))))"));
try {
newExecution(new GroupingExecutor(), new GroupingListThrower()).search(query);
fail();
} catch (GroupingListException e) {
assertNotNull(e.lst);
assertEquals(1, e.lst.size());
Grouping grp = e.lst.get(0);
assertNotNull(grp);
}
}
use of com.yahoo.search.grouping.GroupingRequest in project vespa by vespa-engine.
the class GroupingExecutorTestCase method requireThatPassRequestsSingleLevel.
@Test
public void requireThatPassRequestsSingleLevel() {
Query query = newQuery();
GroupingRequest req = GroupingRequest.newInstance(query);
req.setRootOperation(GroupingOperation.fromString("all(group(foo) each(output(max(bar))))"));
GroupingCollector clt = new GroupingCollector();
newExecution(new GroupingExecutor(), clt).search(query);
assertEquals(2, clt.lst.size());
Grouping grp = clt.lst.get(0);
assertEquals(0, grp.getFirstLevel());
assertEquals(0, grp.getLastLevel());
grp = clt.lst.get(1);
assertEquals(1, grp.getFirstLevel());
assertEquals(1, grp.getLastLevel());
}
use of com.yahoo.search.grouping.GroupingRequest in project vespa by vespa-engine.
the class GroupingExecutorTestCase method execute.
private List<Grouping> execute(String groupingExpression) {
Query query = newQuery();
GroupingRequest req = GroupingRequest.newInstance(query);
req.setRootOperation(GroupingOperation.fromString(groupingExpression));
GroupingCollector collector = new GroupingCollector();
newExecution(new GroupingExecutor(), collector).search(query);
return collector.lst;
}
use of com.yahoo.search.grouping.GroupingRequest in project vespa by vespa-engine.
the class GroupingExecutorTestCase method requireThatEachBelowAllDoesNotBlowUp.
@Test
public void requireThatEachBelowAllDoesNotBlowUp() {
Query query = newQuery();
GroupingRequest req = GroupingRequest.newInstance(query);
req.setRootOperation(GroupingOperation.fromString("all(each(output(summary(bar))))"));
Result res = newExecution(new GroupingExecutor()).search(query);
assertNotNull(res);
assertEquals(1, res.hits().size());
}
use of com.yahoo.search.grouping.GroupingRequest in project vespa by vespa-engine.
the class GroupingExecutorTestCase method requireThatGroupingIsParallel.
@Test
public void requireThatGroupingIsParallel() {
Query query = newQuery();
GroupingRequest req = GroupingRequest.newInstance(query);
req.setRootOperation(GroupingOperation.fromString("all(group(foo) each(output(max(bar))) as(max)" + " each(output(min(bar))) as(min))"));
GroupingCounter cnt = new GroupingCounter();
newExecution(new GroupingExecutor(), cnt).search(query);
assertEquals(2, cnt.passList.size());
assertEquals(2, cnt.passList.get(0).intValue());
assertEquals(2, cnt.passList.get(1).intValue());
}
Aggregations