コード例 #1
0
ファイル: BackendTest.php プロジェクト: grharry/vufind
 /**
  * Test getting a connector.
  *
  * @return void
  */
 public function testGetConnector()
 {
     $conn = $this->getConnectorMock();
     $back = new Backend($conn);
     $this->assertEquals($conn, $back->getConnector());
 }
コード例 #2
0
ファイル: Generator.php プロジェクト: grharry/vufind
 /**
  * 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;
 }