Search in sources :

Example 11 with VisitorParameters

use of com.yahoo.documentapi.VisitorParameters in project vespa by vespa-engine.

the class VisitorSearcherTestCase method testQueryParameters.

@Test
public void testQueryParameters() throws Exception {
    VisitSearcher searcher = create();
    VisitorParameters params = searcher.getVisitorParameters(newQuery("visit?visit.selection=id.user=1234&visit.cluster=foobar" + "&visit.dataHandler=othercluster&visit.fieldSet=[header]&visit.fromTimestamp=112&visit.toTimestamp=224" + "&visit.maxBucketsPerVisitor=2&visit.maxPendingMessagesPerVisitor=7&visit.maxPendingVisitors=14" + "&visit.ordering=ASCENDING&priority=NORMAL_1&tracelevel=7&visit.visitInconsistentBuckets&visit.visitRemoves"), null);
    assertEquals("id.user=1234", params.getDocumentSelection());
    assertEquals(7, params.getMaxPending());
    assertEquals(2, params.getMaxBucketsPerVisitor());
    assertEquals(14, ((StaticThrottlePolicy) params.getThrottlePolicy()).getMaxPendingCount());
    assertEquals("[Storage:cluster=foobar;clusterconfigid=storage/cluster.foobar]", params.getRoute().toString());
    assertEquals("othercluster", params.getRemoteDataHandler());
    assertEquals("[header]", params.fieldSet());
    assertEquals(112, params.getFromTimestamp());
    assertEquals(224, params.getToTimestamp());
    assertEquals(VisitorOrdering.ASCENDING, params.getVisitorOrdering());
    assertEquals(DocumentProtocol.Priority.NORMAL_1, params.getPriority());
    assertEquals(7, params.getTraceLevel());
    assertEquals(true, params.visitInconsistentBuckets());
    assertEquals(true, params.visitRemoves());
}
Also used : VisitorParameters(com.yahoo.documentapi.VisitorParameters) Test(org.junit.Test)

Example 12 with VisitorParameters

use of com.yahoo.documentapi.VisitorParameters in project vespa by vespa-engine.

the class OperationHandlerImplTest method visit_concurrency_is_1_by_default.

@Test
public void visit_concurrency_is_1_by_default() throws Exception {
    VisitorParameters params = generatedParametersFromVisitOptions(emptyVisitOptions());
    assertThat(params.getThrottlePolicy(), instanceOf(StaticThrottlePolicy.class));
    assertThat(((StaticThrottlePolicy) params.getThrottlePolicy()).getMaxPendingCount(), is((int) 1));
}
Also used : StaticThrottlePolicy(com.yahoo.messagebus.StaticThrottlePolicy) VisitorParameters(com.yahoo.documentapi.VisitorParameters) Test(org.junit.Test)

Example 13 with VisitorParameters

use of com.yahoo.documentapi.VisitorParameters in project vespa by vespa-engine.

the class OperationHandlerImplTest method wanted_document_count_is_1_unless_specified.

@Test
public void wanted_document_count_is_1_unless_specified() throws Exception {
    VisitorParameters params = generatedParametersFromVisitOptions(emptyVisitOptions());
    assertThat(params.getMaxTotalHits(), is((long) 1));
}
Also used : VisitorParameters(com.yahoo.documentapi.VisitorParameters) Test(org.junit.Test)

Example 14 with VisitorParameters

use of com.yahoo.documentapi.VisitorParameters in project vespa by vespa-engine.

the class OperationHandlerImplTest method too_low_wanted_document_count_is_bounded_to_1.

@Test
public void too_low_wanted_document_count_is_bounded_to_1() throws Exception {
    VisitorParameters params = generatedParametersFromVisitOptions(visitOptionsWithWantedDocumentCount(-1));
    assertThat(params.getMaxTotalHits(), is((long) 1));
    params = generatedParametersFromVisitOptions(visitOptionsWithWantedDocumentCount(Integer.MIN_VALUE));
    assertThat(params.getMaxTotalHits(), is((long) 1));
    params = generatedParametersFromVisitOptions(visitOptionsWithWantedDocumentCount(0));
    assertThat(params.getMaxTotalHits(), is((long) 1));
}
Also used : VisitorParameters(com.yahoo.documentapi.VisitorParameters) Test(org.junit.Test)

Example 15 with VisitorParameters

use of com.yahoo.documentapi.VisitorParameters in project vespa by vespa-engine.

the class OperationHandlerImplTest method visit_concurrency_is_propagated_to_visitor_parameters.

@Test
public void visit_concurrency_is_propagated_to_visitor_parameters() throws Exception {
    VisitorParameters params = generatedParametersFromVisitOptions(optionsBuilder().concurrency(3).build());
    assertThat(params.getThrottlePolicy(), instanceOf(StaticThrottlePolicy.class));
    assertThat(((StaticThrottlePolicy) params.getThrottlePolicy()).getMaxPendingCount(), is((int) 3));
}
Also used : StaticThrottlePolicy(com.yahoo.messagebus.StaticThrottlePolicy) VisitorParameters(com.yahoo.documentapi.VisitorParameters) Test(org.junit.Test)

Aggregations

VisitorParameters (com.yahoo.documentapi.VisitorParameters)17 Test (org.junit.Test)13 StaticThrottlePolicy (com.yahoo.messagebus.StaticThrottlePolicy)3 DocumentAccessException (com.yahoo.documentapi.DocumentAccessException)2 ParseException (com.yahoo.document.select.parser.ParseException)1 ProgressToken (com.yahoo.documentapi.ProgressToken)1 VisitorControlHandler (com.yahoo.documentapi.VisitorControlHandler)1 VisitorSession (com.yahoo.documentapi.VisitorSession)1 Result (com.yahoo.search.Result)1 Map (java.util.Map)1