コード例 #1
0
ファイル: Adapter.php プロジェクト: Doability/magento2dev
 /**
  * {@inheritdoc}
  */
 public function query(RequestInterface $request)
 {
     $query = $this->mapper->buildQuery($request);
     if ($request->getName() == 'quick_search_container') {
         $query->limit($this->searchConfig->getResultsLimit());
     }
     if (isset($_GET) && isset($_GET['debug'])) {
         echo '<hr>' . $query . '<hr>';
     }
     $temporaryStorage = $this->temporaryStorageFactory->create();
     $table = $temporaryStorage->storeDocumentsFromSelect($query);
     $this->searchHelper->prepareTemporaryTable($table);
     $documents = $this->getDocuments($table);
     $aggregations = $this->aggregationBuilder->build($request, $table);
     $response = ['documents' => $documents, 'aggregations' => $aggregations];
     return $this->responseFactory->create($response);
 }
コード例 #2
0
ファイル: Adapter.php プロジェクト: Doability/magento2dev
 /**
  * @param RequestInterface $request
  * @return \Magento\Framework\Search\Response\QueryResponse
  */
 public function query(RequestInterface $request)
 {
     try {
         $query = $this->mapper->buildQuery($request);
         $query->limit($this->searchConfig->getResultsLimit());
     } catch (\Exception $e) {
         // fallback engine
         $objectManager = ObjectManager::getInstance();
         return $objectManager->create('Mirasvit\\SearchMysql\\Model\\Adapter')->query($request);
     }
     $temporaryStorage = $this->temporaryStorageFactory->create();
     $table = $temporaryStorage->storeDocumentsFromSelect($query);
     $this->searchHelper->prepareTemporaryTable($table);
     $documents = $this->getDocuments($table);
     $aggregations = $this->aggregationBuilder->build($request, $table);
     $response = ['documents' => $documents, 'aggregations' => $aggregations];
     return $this->responseFactory->create($response);
 }