Batch search

Allow your users to process synchronous Batch Search calls with the Batch Search service being integrated. When the service receives a Request, it will respond as soon as the batch items are calculated and there will be no possibility to retrieve the results later on.

Supported types of requests

Different types of requests can be mixed in one Batch Request. The information about the limit of queries, request processing time, and other details are described in the Batch Search service documentation. An error in one of the Batch Requests causes the whole batch to fail.

Sample use case: You want to simultaneously search for different categories within different locations.

Use the following code to try this in your app:

1let query1 = TTSearchQueryBuilder.create(withTerm: term)
2 .withCategory(true)
3 .withPosition(TTCoordinate.AMSTERDAM_CENTER_LOCATION())
4 .withLimit(10)
5 .build()
6let query2 = TTSearchQueryBuilder.create(withTerm: term)
7 .withCategory(true)
8 .withPosition(TTCoordinate.HAARLEM())
9 .withLimit(15)
10 .build()
11let geometry = TTSearchCircle(center: TTCoordinate.HOOFDDORP(), radius: 4000)
12let geometryQuery = TTGeometrySearchQueryBuilder.create(withTerm: term, searchShapes: [geometry])
13 .build()
14let batchQuery = TTBatchQueryBuilder.createSearchQuery(query1)
15 .add(query2)
16 .addGeometryQuery(geometryQuery)
17 .build()
18batchSearch.batchSearch(with: batchQuery)
1TTSearchQuery *query1 = [[[[[TTSearchQueryBuilder createWithTerm:term] withCategory:YES] withPosition:[TTCoordinate AMSTERDAM_CENTER_LOCATION]] withLimit:10] build];
2TTSearchQuery *query2 = [[[[[TTSearchQueryBuilder createWithTerm:term] withCategory:YES] withPosition:[TTCoordinate HAARLEM]] withLimit:15] build];
3TTSearchCircle *geometry = [TTSearchCircle circleWithCenter:[TTCoordinate HOOFDDORP] radius:4000];
4TTGeometrySearchQuery *geometryQuery = [[TTGeometrySearchQueryBuilder createWithTerm:term searchShapes:@[ geometry ]] build];
5TTBatchQuery *batchQuery = [[[[TTBatchQueryBuilder createSearchQuery:query1] addSearchQuery:query2] addGeometryQuery:geometryQuery] build];
6[self.batchSearch batchSearchWithQuery:batchQuery];

Sample views utilizing data retrieved using the Batch Search service:

Search results for different locations