use of com.yahoo.search.grouping.request.EachOperation in project vespa by vespa-engine.
the class FastSearcherTestCase method testSinglePassGroupingIsNotForcedWithSingleNodeGroups.
@Test
public void testSinglePassGroupingIsNotForcedWithSingleNodeGroups() {
MockDispatcher dispatcher = new MockDispatcher(ImmutableList.of(new SearchCluster.Node("host0", 123, 0), new SearchCluster.Node("host1", 123, 0)));
FastSearcher fastSearcher = new FastSearcher(new MockBackend(), new FS4ResourcePool(1), dispatcher, new SummaryParameters(null), new ClusterParams("testhittype"), new CacheParams(100, 1e64), documentdbInfoConfig);
Query q = new Query("?query=foo");
GroupingRequest request1 = GroupingRequest.newInstance(q);
request1.setRootOperation(new AllOperation());
GroupingRequest request2 = GroupingRequest.newInstance(q);
AllOperation all = new AllOperation();
all.addChild(new EachOperation());
all.addChild(new EachOperation());
request2.setRootOperation(all);
assertForceSinglePassIs(false, q);
fastSearcher.search(q, new Execution(Execution.Context.createContextStub()));
assertForceSinglePassIs(false, q);
}
use of com.yahoo.search.grouping.request.EachOperation in project vespa by vespa-engine.
the class VespaSerializerTestCase method requireThatGroupingContinuationsAreSerialized.
@Test
public void requireThatGroupingContinuationsAreSerialized() {
Query query = new Query();
query.getModel().getQueryTree().setRoot(new WordItem("foo"));
assertEquals("default contains ([{\"implicitTransforms\": false}]\"foo\")", VespaSerializer.serialize(query));
newGroupingRequest(query, new AllOperation().setGroupBy(new AttributeFunction("a")).addChild(new EachOperation().addOutput(new CountAggregator())), Continuation.fromString("BCBCBCBEBG"), Continuation.fromString("BCBKCBACBKCCK"));
assertEquals("default contains ([{\"implicitTransforms\": false}]\"foo\") " + "| [{ 'continuations':['BCBCBCBEBG', 'BCBKCBACBKCCK'] }]" + "all(group(attribute(a)) each(output(count())))", VespaSerializer.serialize(query));
newGroupingRequest(query, new AllOperation().setGroupBy(new AttributeFunction("b")).addChild(new EachOperation().addOutput(new CountAggregator())), Continuation.fromString("BCBBBBBDBF"), Continuation.fromString("BCBJBPCBJCCJ"));
assertEquals("default contains ([{\"implicitTransforms\": false}]\"foo\") " + "| [{ 'continuations':['BCBCBCBEBG', 'BCBKCBACBKCCK'] }]" + "all(group(attribute(a)) each(output(count()))) " + "| [{ 'continuations':['BCBBBBBDBF', 'BCBJBPCBJCCJ'] }]" + "all(group(attribute(b)) each(output(count())))", VespaSerializer.serialize(query));
}
use of com.yahoo.search.grouping.request.EachOperation in project vespa by vespa-engine.
the class FastSearcherTestCase method testSinglePassGroupingIsForcedWithSingleNodeGroups.
@Test
public void testSinglePassGroupingIsForcedWithSingleNodeGroups() {
FastSearcher fastSearcher = new FastSearcher(new MockBackend(), new FS4ResourcePool(1), new MockDispatcher(new SearchCluster.Node("host0", 123, 0)), new SummaryParameters(null), new ClusterParams("testhittype"), new CacheParams(100, 1e64), documentdbInfoConfig);
Query q = new Query("?query=foo");
GroupingRequest request1 = GroupingRequest.newInstance(q);
request1.setRootOperation(new AllOperation());
GroupingRequest request2 = GroupingRequest.newInstance(q);
AllOperation all = new AllOperation();
all.addChild(new EachOperation());
all.addChild(new EachOperation());
request2.setRootOperation(all);
assertForceSinglePassIs(false, q);
fastSearcher.search(q, new Execution(Execution.Context.createContextStub()));
assertForceSinglePassIs(true, q);
}
use of com.yahoo.search.grouping.request.EachOperation in project vespa by vespa-engine.
the class VespaSerializerTestCase method requireThatGroupingRequestsAreSerialized.
@Test
public void requireThatGroupingRequestsAreSerialized() {
Query query = new Query();
query.getModel().getQueryTree().setRoot(new WordItem("foo"));
assertEquals("default contains ([{\"implicitTransforms\": false}]\"foo\")", VespaSerializer.serialize(query));
newGroupingRequest(query, new AllOperation().setGroupBy(new AttributeFunction("a")).addChild(new EachOperation().addOutput(new CountAggregator())));
assertEquals("default contains ([{\"implicitTransforms\": false}]\"foo\") " + "| all(group(attribute(a)) each(output(count())))", VespaSerializer.serialize(query));
newGroupingRequest(query, new AllOperation().setGroupBy(new AttributeFunction("b")).addChild(new EachOperation().addOutput(new CountAggregator())));
assertEquals("default contains ([{\"implicitTransforms\": false}]\"foo\") " + "| all(group(attribute(a)) each(output(count()))) " + "| all(group(attribute(b)) each(output(count())))", VespaSerializer.serialize(query));
}
Aggregations