PHP Class Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\Collection

Author: Aurelien FOUCRET ([email protected])
Inheritance: extends Magento\Catalog\Model\ResourceModel\Product\Collection
ファイルを表示 Open project: smile-sa/elasticsuite Class Usage Examples

Public Methods

Method Description
__construct ( Magento\Framework\Data\Collection\EntityFactory $entityFactory, Psr\Log\LoggerInterface $logger, Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, Magento\Framework\Event\ManagerInterface $eventManager, Magento\Eav\Model\Config $eavConfig, Magento\Framework\App\ResourceConnection $resource, Magento\Eav\Model\EntityFactory $eavEntityFactory, Magento\Catalog\Model\ResourceModel\Helper $resourceHelper, Magento\Framework\Validator\UniversalFactory $universalFactory, Magento\Store\Model\StoreManagerInterface $storeManager, Magento\Framework\Module\Manager $moduleManager, Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState, Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, Magento\Catalog\Model\ResourceModel\Url $catalogUrl, Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, Magento\Customer\Model\Session $customerSession, Magento\Framework\Stdlib\DateTime $dateTime, Magento\Customer\Api\GroupManagementInterface $groupManagement, Smile\ElasticsuiteCore\Search\Request\Builder $requestBuilder, Magento\Search\Model\SearchEngine $searchEngine, Magento\Framework\DB\Adapter\AdapterInterface $connection = null, string $searchRequestName = 'catalog_view_container' ) Constructor.
addAttributeToSort ( $attribute, $dir = self::SORT_ORDER_ASC ) {@inheritDoc}
addCategoryFilter ( Magento\Catalog\Model\Category $category ) {@inheritDoc}
addFacet ( string $field, string $facetType, array $facetConfig, array $facetFilter = null ) : Collection Append a facet to the collection
addFieldToFilter ( $field, $condition = null ) {@inheritDoc}
addIsInStockFilter ( ) : Collection Filter in stock product.
addQueryFilter ( Smile\ElasticsuiteCore\Search\Request\QueryInterface $queryFilter ) Append a prebuilt (QueryInterface) query filter to the collection.
addSearchFilter ( string $query ) : Collection Add search query filter
addSortFilterParameters ( string $sortName, string $sortField, string $nestedPath = null, array $nestedFilter = null ) : Collection Set param for a sort order.
getFacetedData ( string $field ) : array Return field faceted data from faceted search result.
getProductCountByAttributeSetId ( ) : array Load the product count by attribute set id.
getSize ( ) {@inheritDoc}
isSpellchecked ( ) : boolean Indicates if the collection is spellchecked or not.
setOrder ( $attribute, $dir = self::SORT_ORDER_DESC ) {@inheritDoc}
setVisibility ( $visibility ) {@inheritDoc}

Protected Methods

Method Description
_afterLoad ( )
_renderFilters ( )
_renderFiltersBefore ( )
_renderOrders ( )

Private Methods

Method Description
loadProductCounts ( ) : void Load product count : - collection size - number of products by attribute set
mapFieldName ( string $fieldName ) : string Convert standard field name to ES fieldname.
prepareRequest ( ) : Smile\ElasticsuiteCore\Search\RequestInterface Prepare the search request before it will be executed.
prepareSortOrders ( ) : array() Prepare sort orders for the request builder.

Method Details

__construct() public method

Constructor.
public __construct ( Magento\Framework\Data\Collection\EntityFactory $entityFactory, Psr\Log\LoggerInterface $logger, Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, Magento\Framework\Event\ManagerInterface $eventManager, Magento\Eav\Model\Config $eavConfig, Magento\Framework\App\ResourceConnection $resource, Magento\Eav\Model\EntityFactory $eavEntityFactory, Magento\Catalog\Model\ResourceModel\Helper $resourceHelper, Magento\Framework\Validator\UniversalFactory $universalFactory, Magento\Store\Model\StoreManagerInterface $storeManager, Magento\Framework\Module\Manager $moduleManager, Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState, Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, Magento\Catalog\Model\ResourceModel\Url $catalogUrl, Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, Magento\Customer\Model\Session $customerSession, Magento\Framework\Stdlib\DateTime $dateTime, Magento\Customer\Api\GroupManagementInterface $groupManagement, Smile\ElasticsuiteCore\Search\Request\Builder $requestBuilder, Magento\Search\Model\SearchEngine $searchEngine, Magento\Framework\DB\Adapter\AdapterInterface $connection = null, string $searchRequestName = 'catalog_view_container' )
$entityFactory Magento\Framework\Data\Collection\EntityFactory Collection entity factory
$logger Psr\Log\LoggerInterface Logger.
$fetchStrategy Magento\Framework\Data\Collection\Db\FetchStrategyInterface Db Fetch strategy.
$eventManager Magento\Framework\Event\ManagerInterface Event manager.
$eavConfig Magento\Eav\Model\Config EAV configuration.
$resource Magento\Framework\App\ResourceConnection DB connection.
$eavEntityFactory Magento\Eav\Model\EntityFactory Entity factory.
$resourceHelper Magento\Catalog\Model\ResourceModel\Helper Resource helper.
$universalFactory Magento\Framework\Validator\UniversalFactory Standard factory.
$storeManager Magento\Store\Model\StoreManagerInterface Store manager.
$moduleManager Magento\Framework\Module\Manager Module manager.
$catalogProductFlatState Magento\Catalog\Model\Indexer\Product\Flat\State Flat index state.
$scopeConfig Magento\Framework\App\Config\ScopeConfigInterface Store configuration.
$productOptionFactory Magento\Catalog\Model\Product\OptionFactory Product options factory.
$catalogUrl Magento\Catalog\Model\ResourceModel\Url Catalog URL resource model.
$localeDate Magento\Framework\Stdlib\DateTime\TimezoneInterface Timezone helper.
$customerSession Magento\Customer\Model\Session Customer session.
$dateTime Magento\Framework\Stdlib\DateTime Datetime helper.
$groupManagement Magento\Customer\Api\GroupManagementInterface Customer group manager.
$requestBuilder Smile\ElasticsuiteCore\Search\Request\Builder Search request builder.
$searchEngine Magento\Search\Model\SearchEngine Search engine
$connection Magento\Framework\DB\Adapter\AdapterInterface Db Connection.
$searchRequestName string Search request name.

_afterLoad() protected method

protected _afterLoad ( )

_renderFilters() protected method

protected _renderFilters ( )

_renderFiltersBefore() protected method

protected _renderFiltersBefore ( )

_renderOrders() protected method

protected _renderOrders ( )

addAttributeToSort() public method

{@inheritDoc}
public addAttributeToSort ( $attribute, $dir = self::SORT_ORDER_ASC )

addCategoryFilter() public method

{@inheritDoc}
public addCategoryFilter ( Magento\Catalog\Model\Category $category )
$category Magento\Catalog\Model\Category

addFacet() public method

Append a facet to the collection
public addFacet ( string $field, string $facetType, array $facetConfig, array $facetFilter = null ) : Collection
$field string Facet field.
$facetType string Facet type.
$facetConfig array Facet config params.
$facetFilter array Facet filter.
return Collection

addFieldToFilter() public method

{@inheritDoc}
public addFieldToFilter ( $field, $condition = null )

addIsInStockFilter() public method

Filter in stock product.
public addIsInStockFilter ( ) : Collection
return Collection

addQueryFilter() public method

Append a prebuilt (QueryInterface) query filter to the collection.
public addQueryFilter ( Smile\ElasticsuiteCore\Search\Request\QueryInterface $queryFilter )
$queryFilter Smile\ElasticsuiteCore\Search\Request\QueryInterface Query filter.

addSearchFilter() public method

Add search query filter
public addSearchFilter ( string $query ) : Collection
$query string Search query text.
return Collection

addSortFilterParameters() public method

Set param for a sort order.
public addSortFilterParameters ( string $sortName, string $sortField, string $nestedPath = null, array $nestedFilter = null ) : Collection
$sortName string Sort order name (eg. position, ...).
$sortField string Sort field.
$nestedPath string Optional nested path for the sort field.
$nestedFilter array Optional nested filter for the sort field.
return Collection

getFacetedData() public method

Return field faceted data from faceted search result.
public getFacetedData ( string $field ) : array
$field string Facet field.
return array

getProductCountByAttributeSetId() public method

Load the product count by attribute set id.

getSize() public method

{@inheritDoc}
public getSize ( )

isSpellchecked() public method

Indicates if the collection is spellchecked or not.
public isSpellchecked ( ) : boolean
return boolean

setOrder() public method

{@inheritDoc}
public setOrder ( $attribute, $dir = self::SORT_ORDER_DESC )

setVisibility() public method

{@inheritDoc}
public setVisibility ( $visibility )