use of com.yelp.nrtsearch.server.luceneserver.search.SearchCutoffWrapper in project nrtsearch by Yelp.
the class DocCollectorTest method testQueryOverridesDefaultTimeout.
@Test
public void testQueryOverridesDefaultTimeout() {
IndexState indexState = Mockito.mock(IndexState.class);
when(indexState.getDefaultSearchTimeoutSec()).thenReturn(3.0);
when(indexState.getDefaultSearchTimeoutCheckEvery()).thenReturn(0);
SearchRequest request = SearchRequest.newBuilder().setTopHits(10).setTimeoutSec(2.0).build();
TestDocCollector docCollector = new TestDocCollector(request, indexState);
assertTrue(docCollector.getManager() instanceof TestDocCollector.TestCollectorManager);
assertTrue(docCollector.getWrappedManager() instanceof SearchCutoffWrapper);
SearchCutoffWrapper<?> cutoffWrapper = (SearchCutoffWrapper<?>) docCollector.getWrappedManager();
assertEquals(2.0, cutoffWrapper.getTimeoutSec(), 0.0);
assertEquals(0, cutoffWrapper.getCheckEvery());
}
use of com.yelp.nrtsearch.server.luceneserver.search.SearchCutoffWrapper in project nrtsearch by Yelp.
the class DocCollectorTest method testHasStatsAndTimeoutWrapper.
@Test
public void testHasStatsAndTimeoutWrapper() {
SearchRequest request = SearchRequest.newBuilder().setTopHits(10).setTimeoutSec(5).setProfile(true).build();
TestDocCollector docCollector = new TestDocCollector(request);
assertTrue(docCollector.getManager() instanceof TestDocCollector.TestCollectorManager);
assertTrue(docCollector.getWrappedManager() instanceof SearchStatsWrapper);
assertTrue(((SearchStatsWrapper<?>) docCollector.getWrappedManager()).getWrapped() instanceof SearchCutoffWrapper);
}
use of com.yelp.nrtsearch.server.luceneserver.search.SearchCutoffWrapper 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.SearchCutoffWrapper in project nrtsearch by Yelp.
the class DocCollectorTest method testUsesDefaultTimeoutCheckEvery.
@Test
public void testUsesDefaultTimeoutCheckEvery() {
IndexState indexState = Mockito.mock(IndexState.class);
when(indexState.getDefaultSearchTimeoutSec()).thenReturn(6.0);
when(indexState.getDefaultSearchTimeoutCheckEvery()).thenReturn(10);
SearchRequest request = SearchRequest.newBuilder().setTopHits(10).build();
TestDocCollector docCollector = new TestDocCollector(request, indexState);
assertTrue(docCollector.getManager() instanceof TestDocCollector.TestCollectorManager);
assertTrue(docCollector.getWrappedManager() instanceof SearchCutoffWrapper);
SearchCutoffWrapper<?> cutoffWrapper = (SearchCutoffWrapper<?>) docCollector.getWrappedManager();
assertEquals(6.0, cutoffWrapper.getTimeoutSec(), 0.0);
assertEquals(10, cutoffWrapper.getCheckEvery());
}
use of com.yelp.nrtsearch.server.luceneserver.search.SearchCutoffWrapper in project nrtsearch by Yelp.
the class DocCollectorTest method testHasTimeoutWrapper.
@Test
public void testHasTimeoutWrapper() {
SearchRequest request = SearchRequest.newBuilder().setTopHits(10).setTimeoutSec(5).build();
TestDocCollector docCollector = new TestDocCollector(request);
assertTrue(docCollector.getManager() instanceof TestDocCollector.TestCollectorManager);
assertTrue(docCollector.getWrappedManager() instanceof SearchCutoffWrapper);
}
Aggregations