/** * {@inheritdoc} */ public function execute(RiakTransport $adapter) { $schema = null; $response = $adapter->send($this->createGetIndexRequest()); if ($response && $response->name) { $schema = new YokozunaIndex($response->name, $response->schema); $schema->setNVal($response->nVal); } return new FetchIndexResponse($schema); }
/** * @deprecated * * not worth functional testing * Riak will fail to fetch the index for a couple seconds after store */ public function testStoreAndFetchIndex() { $indexName = 'schedule_' . uniqid(); $index = new YokozunaIndex($indexName, '_yz_default'); $index->setNVal(3); $store = StoreIndex::builder()->withIndex($index)->build(); $fetch = FetchIndex::builder()->withIndexName($indexName)->build(); $delete = DeleteIndex::builder()->withIndexName($indexName)->build(); $storeResponse = $this->client->execute($store); $fetchResponse = $this->retryCommand($fetch, 10); $deleteResponse = $this->client->execute($delete); $this->assertInstanceOf('Riak\\Client\\Command\\Search\\Response\\StoreIndexResponse', $storeResponse); $this->assertInstanceOf('Riak\\Client\\Command\\Search\\Response\\FetchIndexResponse', $fetchResponse); $this->assertInstanceOf('Riak\\Client\\Command\\Search\\Response\\DeleteIndexResponse', $deleteResponse); }