예제 #1
0
 public static function setUpBeforeClass()
 {
     $country1 = CM_Model_Location_Country::create('Andorra', 'AD');
     $state1 = CM_Model_Location_State::create($country1, 'Canillo', null, 'AD02');
     $state2 = CM_Model_Location_State::create($country1, 'Encamp', null, 'AD03');
     $state3 = CM_Model_Location_State::create($country1, 'La Massana', null, 'AD04');
     $city = CM_Model_Location_City::create($country1, $state1, 'Canillo', '42.567', '1.6', '146765');
     $cityNext = CM_Model_Location_City::create($country1, $state1, 'El Tarter', '42.583', '1.65', '211022');
     CM_Model_Location_City::create($country1, $state1, 'Meritxell', '42.55', '1.6', '230839');
     CM_Model_Location_City::create($country1, $state1, 'Pas De La Casa', '42.55', '1.733', '177897');
     CM_Model_Location_City::create($country1, $state1, 'Soldeu', '42.583', '1.667', '177181');
     CM_Model_Location_City::create($country1, $state2, 'Encamp', '42.533', '1.583', '58282');
     CM_Model_Location_City::create($country1, $state3, 'Arinsal', '42.567', '1.483', '209956');
     CM_Model_Location_City::create($country1, $state3, 'El Serrat', '42.617', '1.55', '209961');
     $country2 = CM_Model_Location_Country::create('Australia', 'AU');
     $state4 = CM_Model_Location_State::create($country2, 'Queensland', null, 'AU04');
     $state5 = CM_Model_Location_State::create($country2, 'Victoria', null, 'AU07');
     $state6 = CM_Model_Location_State::create($country2, 'Tasmania', null, 'AU06');
     CM_Model_Location_City::create($country2, $state4, 'Abermain', '-27.567', '152.783', '33924');
     CM_Model_Location_City::create($country2, $state5, 'Acheron', '-37.25', '145.7', '195676');
     CM_Model_Location_City::create($country2, $state6, 'Baden', '-42.433', '147.467', '242082');
     CM_Model_Location::createAggregation();
     CMTest_TH::getServiceManager()->getElasticsearch()->setEnabled(true);
     self::$_type = new CM_Elasticsearch_Type_Location();
     self::$_searchIndexCli = new CM_Elasticsearch_Index_Cli();
     self::$_searchIndexCli->create(self::$_type->getIndex()->getName());
     self::$_countryId1 = $country1->getId();
     self::$_countryId2 = $country2->getId();
     self::$_stateId1 = $state1->getId();
     self::$_stateId4 = $state4->getId();
     self::$_cityId = $city->getId();
     self::$_cityIdNext = $cityNext->getId();
 }
예제 #2
0
 public static function setUpBeforeClass()
 {
     $country = CM_Model_Location_Country::create('Andorra', 'AD');
     $state1 = CM_Model_Location_State::create($country, 'Canillo', null, 'AD02');
     $state2 = CM_Model_Location_State::create($country, 'Encamp', null, 'AD03');
     $state3 = CM_Model_Location_State::create($country, 'La Massana', null, 'AD04');
     $city = CM_Model_Location_City::create($country, $state1, 'Canillo', '42.567', '1.6', '146765');
     CM_Model_Location_City::create($country, $state1, 'El Tarter', '42.583', '1.65', '211022');
     CM_Model_Location_City::create($country, $state1, 'Meritxell', '42.55', '1.6', '230839');
     CM_Model_Location_City::create($country, $state1, 'Pas De La Casa', '42.55', '1.733', '177897');
     CM_Model_Location_City::create($country, $state1, 'Soldeu', '42.583', '1.667', '177181');
     CM_Model_Location_City::create($country, $state2, 'Encamp', '42.533', '1.583', '58282');
     CM_Model_Location_City::create($country, $state3, 'Arinsal', '42.567', '1.483', '209956');
     CM_Model_Location_City::create($country, $state3, 'El Serrat', '42.617', '1.55', '209961');
     CM_Model_Location::createAggregation();
     CMTest_TH::getServiceManager()->getElasticsearch()->setEnabled(true);
     self::$_type = new CM_Elasticsearch_Type_Location();
     self::$_searchIndexCli = new CM_Elasticsearch_Index_Cli();
     self::$_searchIndexCli->create(self::$_type->getIndex()->getName());
     self::$_cityId = $city->getId();
 }
예제 #3
0
파일: 31.php 프로젝트: cargomedia/cm
<?php

if (!CM_Db_Db::existsColumn('cm_tmp_location', 'nameFull')) {
    CM_Db_Db::exec('ALTER TABLE `cm_tmp_location` ADD COLUMN `nameFull` varchar(480) DEFAULT NULL AFTER `name`;');
    $searchCli = new CM_Elasticsearch_Index_Cli(null, new CM_OutputStream_Stream_Output());
    $searchCli->create('location');
}
예제 #4
0
 private function _recreateLocationIndex()
 {
     CM_Model_Location::createAggregation();
     $searchIndexCli = new CM_Elasticsearch_Index_Cli();
     $searchIndexCli->create((new CM_Elasticsearch_Type_Location($this->_elasticsearchClient))->getIndexName());
 }
예제 #5
0
파일: MaxMind.php 프로젝트: cargomedia/cm
 protected function _updateSearchIndex()
 {
     CM_Model_Location::createAggregation();
     while (CM_Model_Location::getCreateAggregationInProgress($this->getServiceManager()->getDatabases()->getReadMaintenance())) {
         sleep(1);
     }
     $client = $this->getServiceManager()->getElasticsearch()->getClient();
     $type = new CM_Elasticsearch_Type_Location($client);
     $searchIndexCli = new CM_Elasticsearch_Index_Cli(null, $this->_streamOutput, $this->_streamError);
     $searchIndexCli->create($type->getIndexName());
 }
예제 #6
0
 public function unload(CM_OutputStream_Interface $output)
 {
     $searchCli = new CM_Elasticsearch_Index_Cli(null, null, $output);
     $searchCli->delete();
     $this->_setLoaded(false);
 }
예제 #7
0
 protected function _updateSearchIndex()
 {
     CM_Model_Location::createAggregation();
     $type = new CM_Elasticsearch_Type_Location();
     $searchIndexCli = new CM_Elasticsearch_Index_Cli(null, $this->_streamOutput, $this->_streamError);
     $searchIndexCli->create($type->getIndex()->getName());
 }