use of com.yelp.nrtsearch.server.luceneserver.search.TerminateAfterWrapper in project nrtsearch by Yelp.
the class DocCollectorTest method testWithAllWrappers.
@Test
public void testWithAllWrappers() {
SearchRequest request = SearchRequest.newBuilder().setTopHits(10).setTerminateAfter(3).setTimeoutSec(5).setProfile(true).build();
TestDocCollector docCollector = new TestDocCollector(request);
assertTrue(docCollector.getManager() instanceof TestDocCollector.TestCollectorManager);
assertTrue(docCollector.getWrappedManager() instanceof SearchStatsWrapper);
SearchStatsWrapper<?> statsWrapper = (SearchStatsWrapper<?>) docCollector.getWrappedManager();
assertTrue(statsWrapper.getWrapped() instanceof TerminateAfterWrapper);
TerminateAfterWrapper<?> terminateAfterWrapper = (TerminateAfterWrapper<?>) statsWrapper.getWrapped();
assertTrue(terminateAfterWrapper.getWrapped() instanceof SearchCutoffWrapper);
}
use of com.yelp.nrtsearch.server.luceneserver.search.TerminateAfterWrapper in project nrtsearch by Yelp.
the class DocCollectorTest method testHasTerminateAfterWrapper.
@Test
public void testHasTerminateAfterWrapper() {
SearchRequest request = SearchRequest.newBuilder().setTopHits(10).setTerminateAfter(5).build();
TestDocCollector docCollector = new TestDocCollector(request);
assertTrue(docCollector.getManager() instanceof TestDocCollector.TestCollectorManager);
assertTrue(docCollector.getWrappedManager() instanceof TerminateAfterWrapper);
assertEquals(5, ((TerminateAfterWrapper<?>) docCollector.getWrappedManager()).getTerminateAfter());
}
use of com.yelp.nrtsearch.server.luceneserver.search.TerminateAfterWrapper in project nrtsearch by Yelp.
the class DocCollectorTest method testOverrideDefaultTerminateAfter.
@Test
public void testOverrideDefaultTerminateAfter() {
IndexState indexState = Mockito.mock(IndexState.class);
when(indexState.getDefaultTerminateAfter()).thenReturn(100);
SearchRequest request = SearchRequest.newBuilder().setTopHits(10).setTerminateAfter(75).build();
TestDocCollector docCollector = new TestDocCollector(request, indexState);
assertTrue(docCollector.getManager() instanceof TestDocCollector.TestCollectorManager);
assertTrue(docCollector.getWrappedManager() instanceof TerminateAfterWrapper);
assertEquals(75, ((TerminateAfterWrapper<?>) docCollector.getWrappedManager()).getTerminateAfter());
}
use of com.yelp.nrtsearch.server.luceneserver.search.TerminateAfterWrapper in project nrtsearch by Yelp.
the class DocCollectorTest method testUsesDefaultTerminateAfter.
@Test
public void testUsesDefaultTerminateAfter() {
IndexState indexState = Mockito.mock(IndexState.class);
when(indexState.getDefaultTerminateAfter()).thenReturn(100);
SearchRequest request = SearchRequest.newBuilder().setTopHits(10).build();
TestDocCollector docCollector = new TestDocCollector(request, indexState);
assertTrue(docCollector.getManager() instanceof TestDocCollector.TestCollectorManager);
assertTrue(docCollector.getWrappedManager() instanceof TerminateAfterWrapper);
assertEquals(100, ((TerminateAfterWrapper<?>) docCollector.getWrappedManager()).getTerminateAfter());
}
Aggregations