コード例 #1
0
ファイル: Collection.php プロジェクト: smile-sa/elasticsuite
 /**
  * @SuppressWarnings(PHPMD.CamelCaseMethodName)
  *
  * {@inheritdoc}
  */
 protected function _renderFiltersBefore()
 {
     $searchRequest = $this->prepareRequest();
     $this->queryResponse = $this->searchEngine->search($searchRequest);
     // Update the item count.
     $this->_totalRecords = $this->queryResponse->count();
     // Filter search results. The pagination has to be resetted since it is managed by the engine itself.
     $docIds = array_map(function (\Magento\Framework\Api\Search\Document $doc) {
         return (int) $doc->getId();
     }, $this->queryResponse->getIterator()->getArrayCopy());
     if (empty($docIds)) {
         $docIds[] = 0;
     }
     $this->getSelect()->where('e.entity_id IN (?)', ['in' => $docIds]);
     $this->_pageSize = false;
     $this->isSpellchecked = $searchRequest->isSpellchecked();
     parent::_renderFiltersBefore();
 }