Пример #1
0
 /**
  * Executes the job.
  *
  * @throws \Aimeos\Controller\Jobs\Exception If an error occurs
  */
 public function run()
 {
     $timestamp = date('Y-m-d H:i:s');
     $context = clone $this->getContext();
     $context->getLocale()->setLanguageId(null);
     $context->getLocale()->setCurrencyId(null);
     $manager = \Aimeos\MShop\Index\Manager\Factory::createManager($context);
     $manager->rebuildIndex();
     $manager->cleanupIndex($timestamp);
 }
Пример #2
0
 /**
  * Rebuilds the index.
  */
 protected function process()
 {
     $iface = '\\Aimeos\\MShop\\Context\\Item\\Iface';
     if (!$this->additional instanceof $iface) {
         throw new \Aimeos\MW\Setup\Exception(sprintf('Additionally provided object is not of type "%1$s"', $iface));
     }
     $this->msg('Rebuilding index for test data', 0);
     $indexManager = \Aimeos\MShop\Index\Manager\Factory::createManager($this->additional);
     $indexManager->rebuildIndex();
     $indexManager->optimize();
     $this->status('done');
 }
Пример #3
0
 public function testSearchByCategoriesPriceText()
 {
     $catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($this->context);
     $search = $catalogManager->createSearch(true);
     $search->setConditions($search->compare('==', 'catalog.label', 'cat-1'));
     $result = $catalogManager->searchItems($search);
     if (($catItem = reset($result)) === false) {
         throw new \RuntimeException('No catalog item found');
     }
     $catIds = array((int) $this->catItem->getId(), (int) $catItem->getId());
     $start = microtime(true);
     $indexManager = \Aimeos\MShop\Index\Manager\Factory::createManager($this->context);
     $search = $indexManager->createSearch(true);
     $search->setSlice(0, $this->slizeSize);
     $expr = array($search->getConditions(), $search->compare('==', 'index.catalog.id', (int) $this->catItem->getId()), $search->compare('>=', $search->createFunction('index.catalogcount', array('default', $catIds)), 2), $search->compare('>', $search->createFunction('index.text.relevance', array('default', 'en', 'plain')), 0), $search->compare('>=', $search->createFunction('index.price.value', array('default', 'EUR', 'default')), 0));
     $search->setConditions($search->combine('&&', $expr));
     $sort = array($search->sort('-', $search->createFunction('sort:index.text.relevance', array('default', 'en', 'plain'))));
     $search->setSortations($sort);
     $total = 0;
     $result = $indexManager->searchItems($search, array('text', 'price', 'media'), $total);
     $stop = microtime(true);
     printf("\n    index search by category count/text/price, sort by relevance (%1\$d/%2\$d): %3\$f msec\n", count($result), $total, ($stop - $start) * 1000);
 }
Пример #4
0
 public function testCreateManagerNotExisting()
 {
     $this->setExpectedException('\\Aimeos\\MShop\\Exception');
     \Aimeos\MShop\Index\Manager\Factory::createManager(\TestHelperMShop::getContext(), 'unknown');
 }
Пример #5
0
 /**
  * Executes the job.
  *
  * @throws \Aimeos\Controller\Jobs\Exception If an error occurs
  */
 public function run()
 {
     \Aimeos\MShop\Index\Manager\Factory::createManager($this->getContext())->optimize();
 }