Пример #1
0
 /**
  * This action aims at optimizing (indexing) the properties that are considered to be
  * optimizable by the system. The optimizable properties are retrieved from the manifests
  * of extensions that are installed on the platform.
  * 
  * It returns a JSON structure:
  * 
  * {
  *    "success": true/false // depending on the success or the failure of the action.
  * }
  */
 public function createPropertyIndex()
 {
     $properties = $this->getOptimizableProperties();
     $result = array('success' => Switcher::createIndex($properties));
     echo json_encode($result);
 }
 public function testCreateIndex()
 {
     $this->hardify();
     Switcher::createIndex(array($this->targetAuthorProperty->getUri()));
     $sm = core_kernel_classes_DbWrapper::singleton()->getSchemaManager();
     $shortName = Utils::getShortName($this->targetWorkClass);
     $indexes = $sm->getTableIndexes('_' . $shortName);
     $this->assertFalse(empty($indexes));
     $indexToFind = 'idx__' . $shortName . '_' . Utils::getShortName($this->targetAuthorProperty);
     $this->assertTrue(array_key_exists($indexToFind, $indexes));
 }