mirror of
https://github.com/bdnugget/magento2.git
synced 2026-11-07 09:17:35 +00:00
- removed @since 2.0.0 as it is a base release - updated version in @since and @deprecated tag taking into account all patch releases
58 lines
1.1 KiB
PHP
58 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
* Copyright © Magento, Inc. All rights reserved.
|
|
* See COPYING.txt for license details.
|
|
*/
|
|
namespace Magento\Search\Model;
|
|
|
|
use Magento\Framework\Search\AdapterInterface;
|
|
use Magento\Framework\Search\RequestInterface;
|
|
use Magento\Framework\Search\SearchEngineInterface;
|
|
|
|
/**
|
|
* Search Engine
|
|
*/
|
|
class SearchEngine implements SearchEngineInterface
|
|
{
|
|
/**
|
|
* @var AdapterInterface
|
|
*/
|
|
private $adapter = null;
|
|
|
|
/**
|
|
* Adapter factory
|
|
*
|
|
* @var AdapterFactory
|
|
*/
|
|
private $adapterFactory;
|
|
|
|
/**
|
|
* @param AdapterFactory $adapterFactory
|
|
*/
|
|
public function __construct(AdapterFactory $adapterFactory)
|
|
{
|
|
$this->adapterFactory = $adapterFactory;
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function search(RequestInterface $request)
|
|
{
|
|
return $this->getConnection()->query($request);
|
|
}
|
|
|
|
/**
|
|
* Get adapter
|
|
*
|
|
* @return AdapterInterface
|
|
*/
|
|
protected function getConnection()
|
|
{
|
|
if ($this->adapter === null) {
|
|
$this->adapter = $this->adapterFactory->create();
|
|
}
|
|
return $this->adapter;
|
|
}
|
|
}
|