Allow your users to process synchronous batch search calls with the Batch Search
service 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 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 code below to try this in your app:
let query1 = TTSearchQueryBuilder.create(withTerm: term) .withCategory(true) .withPosition(TTCoordinate.AMSTERDAM_CENTER_LOCATION()) .withLimit(10) .build() let query2 = TTSearchQueryBuilder.create(withTerm: term) .withCategory(true) .withPosition(TTCoordinate.HAARLEM()) .withLimit(15) .build() let geometry = TTSearchCircle(center: TTCoordinate.HOOFDDORP(), radius: 4000) let geometryQuery = TTGeometrySearchQueryBuilder.create(withTerm: term, searchShapes: [geometry]) .build() let batchQuery = TTBatchQueryBuilder.createSearchQuery(query1) .add(query2) .addGeometryQuery(geometryQuery) .build() batchSearch.batchSearch(with: batchQuery)
TTSearchQuery *query1 = [[[[[TTSearchQueryBuilder createWithTerm:term] withCategory:YES] withPosition:[TTCoordinate AMSTERDAM_CENTER_LOCATION]] withLimit:10] build]; TTSearchQuery *query2 = [[[[[TTSearchQueryBuilder createWithTerm:term] withCategory:YES] withPosition:[TTCoordinate HAARLEM]] withLimit:15] build]; TTSearchCircle *geometry = [TTSearchCircle circleWithCenter:[TTCoordinate HOOFDDORP] radius:4000]; TTGeometrySearchQuery *geometryQuery = [[TTGeometrySearchQueryBuilder createWithTerm:term searchShapes:@[ geometry ]] build]; TTBatchQuery *batchQuery = [[[[TTBatchQueryBuilder createSearchQuery:query1] addSearchQuery:query2] addGeometryQuery:geometryQuery] build]; [self.batchSearch batchSearchWithQuery:batchQuery];
Sample views utilizing data retrieved using Batch Search service:
Search results for different locations