/** * Test getting a connector. * * @return void */ public function testGetConnector() { $conn = $this->getConnectorMock(); $back = new Backend($conn); $this->assertEquals($conn, $back->getConnector()); }
/** * Retrieve a batch of IDs using regular search. * * @param Backend $backend Search backend * @param int $offset Number of terms previously retrieved * * @return array */ protected function getIdsFromBackendUsingSearch(Backend $backend, $offset) { $connector = $backend->getConnector(); $key = $connector->getUniqueKey(); $params = new ParamBag(['q' => '*:*', 'fl' => $key, 'rows' => $this->countPerPage, 'start' => $offset, 'wt' => 'json', 'sort' => $key . ' asc']); $raw = $connector->search($params); $result = json_decode($raw); $ids = []; if (isset($result->response->docs)) { foreach ($result->response->docs as $doc) { $ids[] = $doc->{$key}; } } return $ids; }