repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
Smile-SA/elasticsuite
src/module-elasticsuite-tracker/Plugin/QuotePlugin.php
QuotePlugin.afterAddProduct
public function afterAddProduct( Quote $subject, $result ) { try { if ($result instanceof \Magento\Quote\Model\Quote\Item) { /** @var \Magento\Quote\Model\Quote\Item $result */ $product = $result->getProduct(); if ($product !== null...
php
public function afterAddProduct( Quote $subject, $result ) { try { if ($result instanceof \Magento\Quote\Model\Quote\Item) { /** @var \Magento\Quote\Model\Quote\Item $result */ $product = $result->getProduct(); if ($product !== null...
[ "public", "function", "afterAddProduct", "(", "Quote", "$", "subject", ",", "$", "result", ")", "{", "try", "{", "if", "(", "$", "result", "instanceof", "\\", "Magento", "\\", "Quote", "\\", "Model", "\\", "Quote", "\\", "Item", ")", "{", "/** @var \\Mag...
Log add to cart events into the event queue. @SuppressWarnings(PHPMD.UnusedFormalParameter) @param Quote $subject Quote. @param \Magento\Quote\Model\Quote\Item $result Quote Item. @return \Magento\Quote\Model\Quote\Item|string
[ "Log", "add", "to", "cart", "events", "into", "the", "event", "queue", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-tracker/Plugin/QuotePlugin.php#L80-L97
Smile-SA/elasticsuite
src/module-elasticsuite-tracker/Plugin/QuotePlugin.php
QuotePlugin.logEvent
private function logEvent(int $productId, int $storeId): void { $pageData = []; $pageData['store_id'] = $storeId; $pageData['cart']['product_id'] = $productId; $eventData = ['page' => $pageData, 'session' => $this->getSessionData()]; $this->service->addEvent($even...
php
private function logEvent(int $productId, int $storeId): void { $pageData = []; $pageData['store_id'] = $storeId; $pageData['cart']['product_id'] = $productId; $eventData = ['page' => $pageData, 'session' => $this->getSessionData()]; $this->service->addEvent($even...
[ "private", "function", "logEvent", "(", "int", "$", "productId", ",", "int", "$", "storeId", ")", ":", "void", "{", "$", "pageData", "=", "[", "]", ";", "$", "pageData", "[", "'store_id'", "]", "=", "$", "storeId", ";", "$", "pageData", "[", "'cart'"...
Log the event. @param int $productId Product Id @param int $storeId Store Id @return void
[ "Log", "the", "event", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-tracker/Plugin/QuotePlugin.php#L108-L117
Smile-SA/elasticsuite
src/module-elasticsuite-tracker/Plugin/QuotePlugin.php
QuotePlugin.getSessionData
private function getSessionData() { $cookieConfig = $this->trackerHelper->getCookieConfig(); $sessionData = [ 'uid' => $this->readCookieValue($cookieConfig['visit_cookie_name']), 'vid' => $this->readCookieValue($cookieConfig['visitor_cookie_name']), ]; retur...
php
private function getSessionData() { $cookieConfig = $this->trackerHelper->getCookieConfig(); $sessionData = [ 'uid' => $this->readCookieValue($cookieConfig['visit_cookie_name']), 'vid' => $this->readCookieValue($cookieConfig['visitor_cookie_name']), ]; retur...
[ "private", "function", "getSessionData", "(", ")", "{", "$", "cookieConfig", "=", "$", "this", "->", "trackerHelper", "->", "getCookieConfig", "(", ")", ";", "$", "sessionData", "=", "[", "'uid'", "=>", "$", "this", "->", "readCookieValue", "(", "$", "cook...
Read session data. @return string[]
[ "Read", "session", "data", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-tracker/Plugin/QuotePlugin.php#L124-L134
Smile-SA/elasticsuite
src/module-elasticsuite-catalog-optimizer/Model/ResourceModel/Optimizer/Config/Attributes/Collection.php
Collection._initSelect
protected function _initSelect() { parent::_initSelect(); $this->addFieldToFilter( ['is_searchable', 'is_filterable', 'is_filterable_in_search', 'is_used_for_promo_rules', 'used_for_sort_by'], [true, [1, 2], true, true, true] ); $conditions = [ $...
php
protected function _initSelect() { parent::_initSelect(); $this->addFieldToFilter( ['is_searchable', 'is_filterable', 'is_filterable_in_search', 'is_used_for_promo_rules', 'used_for_sort_by'], [true, [1, 2], true, true, true] ); $conditions = [ $...
[ "protected", "function", "_initSelect", "(", ")", "{", "parent", "::", "_initSelect", "(", ")", ";", "$", "this", "->", "addFieldToFilter", "(", "[", "'is_searchable'", ",", "'is_filterable'", ",", "'is_filterable_in_search'", ",", "'is_used_for_promo_rules'", ",", ...
@SuppressWarnings(PHPMD.CamelCaseMethodName) {@inheritdoc}
[ "@SuppressWarnings", "(", "PHPMD", ".", "CamelCaseMethodName", ")" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog-optimizer/Model/ResourceModel/Optimizer/Config/Attributes/Collection.php#L79-L97
Smile-SA/elasticsuite
src/module-elasticsuite-thesaurus/Block/Adminhtml/Thesaurus/Renderer/Synonyms.php
Synonyms._construct
protected function _construct() { $this->addColumn('term_id', ['label' => '']); $this->addColumn( 'values', ['label' => __('Synonym terms')] ); $this->_addAfter = false; $this->_addButtonLabel = __('Add Synonym'); parent::_construct(); }
php
protected function _construct() { $this->addColumn('term_id', ['label' => '']); $this->addColumn( 'values', ['label' => __('Synonym terms')] ); $this->_addAfter = false; $this->_addButtonLabel = __('Add Synonym'); parent::_construct(); }
[ "protected", "function", "_construct", "(", ")", "{", "$", "this", "->", "addColumn", "(", "'term_id'", ",", "[", "'label'", "=>", "''", "]", ")", ";", "$", "this", "->", "addColumn", "(", "'values'", ",", "[", "'label'", "=>", "__", "(", "'Synonym ter...
Initialise form fields @SuppressWarnings(PHPMD.CamelCaseMethodName)
[ "Initialise", "form", "fields" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-thesaurus/Block/Adminhtml/Thesaurus/Renderer/Synonyms.php#L35-L47
Smile-SA/elasticsuite
src/module-elasticsuite-core/Index/DataSourceResolver.php
DataSourceResolver.getDataSources
public function getDataSources(string $indexName) { $sources = []; if (isset($this->datasources[$indexName]) && isset($this->datasources[$indexName])) { foreach ($this->datasources[$indexName] as $name => $datasource) { if (!$datasource instanceof \Smile\ElasticsuiteCore...
php
public function getDataSources(string $indexName) { $sources = []; if (isset($this->datasources[$indexName]) && isset($this->datasources[$indexName])) { foreach ($this->datasources[$indexName] as $name => $datasource) { if (!$datasource instanceof \Smile\ElasticsuiteCore...
[ "public", "function", "getDataSources", "(", "string", "$", "indexName", ")", "{", "$", "sources", "=", "[", "]", ";", "if", "(", "isset", "(", "$", "this", "->", "datasources", "[", "$", "indexName", "]", ")", "&&", "isset", "(", "$", "this", "->", ...
Get Data sources of a given index. @param string $indexName The index name. @return \Smile\ElasticsuiteCore\Api\Index\DatasourceInterface[]
[ "Get", "Data", "sources", "of", "a", "given", "index", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-core/Index/DataSourceResolver.php#L61-L77
Smile-SA/elasticsuite
src/module-elasticsuite-thesaurus/Block/Adminhtml/Thesaurus/Edit/Form.php
Form._prepareForm
protected function _prepareForm() { $model = $this->getModel(); /** @var \Magento\Framework\Data\Form $form */ $form = $this->_formFactory->create( ['data' => ['id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post']] ); $fieldset = $form->...
php
protected function _prepareForm() { $model = $this->getModel(); /** @var \Magento\Framework\Data\Form $form */ $form = $this->_formFactory->create( ['data' => ['id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post']] ); $fieldset = $form->...
[ "protected", "function", "_prepareForm", "(", ")", "{", "$", "model", "=", "$", "this", "->", "getModel", "(", ")", ";", "/** @var \\Magento\\Framework\\Data\\Form $form */", "$", "form", "=", "$", "this", "->", "_formFactory", "->", "create", "(", "[", "'data...
Prepare form fields. @SuppressWarnings(PHPMD.CamelCaseMethodName) @return Form
[ "Prepare", "form", "fields", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-thesaurus/Block/Adminhtml/Thesaurus/Edit/Form.php#L89-L117
Smile-SA/elasticsuite
src/module-elasticsuite-thesaurus/Block/Adminhtml/Thesaurus/Edit/Form.php
Form.initBaseFields
private function initBaseFields($fieldset) { $fieldset->addField( 'name', 'text', [ 'name' => 'name', 'label' => __('Thesaurus Name'), 'title' => __('Thesaurus Name'), 'required' => true, ...
php
private function initBaseFields($fieldset) { $fieldset->addField( 'name', 'text', [ 'name' => 'name', 'label' => __('Thesaurus Name'), 'title' => __('Thesaurus Name'), 'required' => true, ...
[ "private", "function", "initBaseFields", "(", "$", "fieldset", ")", "{", "$", "fieldset", "->", "addField", "(", "'name'", ",", "'text'", ",", "[", "'name'", "=>", "'name'", ",", "'label'", "=>", "__", "(", "'Thesaurus Name'", ")", ",", "'title'", "=>", ...
Init base fields : - thesaurus name - store id @param \Magento\Framework\Data\Form\Element\Fieldset $fieldset The fieldset @throws \Magento\Framework\Exception\LocalizedException @return \Smile\ElasticsuiteThesaurus\Block\Adminhtml\Thesaurus\Edit\Form
[ "Init", "base", "fields", ":", "-", "thesaurus", "name", "-", "store", "id" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-thesaurus/Block/Adminhtml/Thesaurus/Edit/Form.php#L130-L174
Smile-SA/elasticsuite
src/module-elasticsuite-thesaurus/Block/Adminhtml/Thesaurus/Edit/Form.php
Form.initTypeFields
private function initTypeFields($fieldset, $model) { if ($model->getType() === ThesaurusInterface::TYPE_EXPANSION) { $this->addExpansionFields($fieldset, $model); } elseif ($model->getType() === ThesaurusInterface::TYPE_SYNONYM) { $this->addSynonymFields($fieldset, $model); ...
php
private function initTypeFields($fieldset, $model) { if ($model->getType() === ThesaurusInterface::TYPE_EXPANSION) { $this->addExpansionFields($fieldset, $model); } elseif ($model->getType() === ThesaurusInterface::TYPE_SYNONYM) { $this->addSynonymFields($fieldset, $model); ...
[ "private", "function", "initTypeFields", "(", "$", "fieldset", ",", "$", "model", ")", "{", "if", "(", "$", "model", "->", "getType", "(", ")", "===", "ThesaurusInterface", "::", "TYPE_EXPANSION", ")", "{", "$", "this", "->", "addExpansionFields", "(", "$"...
Init type fields : fields are different according to thesaurus type @param \Magento\Framework\Data\Form\Element\Fieldset $fieldset The fieldset @param \Smile\ElasticsuiteThesaurus\Model\Thesaurus|null $model Current Thesaurus @return \Smile\ElasticsuiteThesaurus\Block\Adminhtml\Thesaurus\Edit\Form
[ "Init", "type", "fields", ":", "fields", "are", "different", "according", "to", "thesaurus", "type" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-thesaurus/Block/Adminhtml/Thesaurus/Edit/Form.php#L184-L193
Smile-SA/elasticsuite
src/module-elasticsuite-thesaurus/Block/Adminhtml/Thesaurus/Edit/Form.php
Form.addExpansionFields
private function addExpansionFields($fieldset, $model) { $form = $fieldset->getForm(); /* @var $bagRenderer \Smile\ElasticsuiteThesaurus\Block\Adminhtml\Thesaurus\Renderer\Expansions */ $bagRenderer = $this->getLayout()->createBlock( 'Smile\ElasticsuiteThesaurus\Block\Adminhtml\...
php
private function addExpansionFields($fieldset, $model) { $form = $fieldset->getForm(); /* @var $bagRenderer \Smile\ElasticsuiteThesaurus\Block\Adminhtml\Thesaurus\Renderer\Expansions */ $bagRenderer = $this->getLayout()->createBlock( 'Smile\ElasticsuiteThesaurus\Block\Adminhtml\...
[ "private", "function", "addExpansionFields", "(", "$", "fieldset", ",", "$", "model", ")", "{", "$", "form", "=", "$", "fieldset", "->", "getForm", "(", ")", ";", "/* @var $bagRenderer \\Smile\\ElasticsuiteThesaurus\\Block\\Adminhtml\\Thesaurus\\Renderer\\Expansions */", ...
Adding expansion-related fields @param \Magento\Framework\Data\Form\Element\Fieldset $fieldset The fieldset @param \Smile\ElasticsuiteThesaurus\Model\Thesaurus|null $model Current Thesaurus @return \Smile\ElasticsuiteThesaurus\Block\Adminhtml\Thesaurus\Edit\Form
[ "Adding", "expansion", "-", "related", "fields" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-thesaurus/Block/Adminhtml/Thesaurus/Edit/Form.php#L203-L222
Smile-SA/elasticsuite
src/module-elasticsuite-tracker/Model/ResourceModel/SessionIndex.php
SessionIndex.getSessionData
public function getSessionData($storeId, $sessionIds) { $data = []; $searchRequest = $this->getSearchRequest($storeId, $sessionIds); $searchResponse = $this->searchEngine->search($searchRequest); foreach ($searchResponse->getAggregations()->getBucket('session_id')->getValues() as $...
php
public function getSessionData($storeId, $sessionIds) { $data = []; $searchRequest = $this->getSearchRequest($storeId, $sessionIds); $searchResponse = $this->searchEngine->search($searchRequest); foreach ($searchResponse->getAggregations()->getBucket('session_id')->getValues() as $...
[ "public", "function", "getSessionData", "(", "$", "storeId", ",", "$", "sessionIds", ")", "{", "$", "data", "=", "[", "]", ";", "$", "searchRequest", "=", "$", "this", "->", "getSearchRequest", "(", "$", "storeId", ",", "$", "sessionIds", ")", ";", "$"...
Retrieve session data to be indexed. @param int $storeId Store id. @param string[] $sessionIds Session ids. @return array
[ "Retrieve", "session", "data", "to", "be", "indexed", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-tracker/Model/ResourceModel/SessionIndex.php#L63-L78
Smile-SA/elasticsuite
src/module-elasticsuite-tracker/Model/ResourceModel/SessionIndex.php
SessionIndex.getSearchRequest
private function getSearchRequest($storeId, $sessionIds) { $queryFilters = ['session.uid' => $sessionIds]; return $this->searchRequestBuilder->create($storeId, self::SEARCH_REQUEST_CONTAINER, 0, 0, null, [], [], $queryFilters); }
php
private function getSearchRequest($storeId, $sessionIds) { $queryFilters = ['session.uid' => $sessionIds]; return $this->searchRequestBuilder->create($storeId, self::SEARCH_REQUEST_CONTAINER, 0, 0, null, [], [], $queryFilters); }
[ "private", "function", "getSearchRequest", "(", "$", "storeId", ",", "$", "sessionIds", ")", "{", "$", "queryFilters", "=", "[", "'session.uid'", "=>", "$", "sessionIds", "]", ";", "return", "$", "this", "->", "searchRequestBuilder", "->", "create", "(", "$"...
Build search request used to collect aggregated session data. @param int $storeId Current store Id. @param string[] $sessionIds Session ids. @return \Smile\ElasticsuiteCore\Search\RequestInterface
[ "Build", "search", "request", "used", "to", "collect", "aggregated", "session", "data", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-tracker/Model/ResourceModel/SessionIndex.php#L88-L93
Smile-SA/elasticsuite
src/module-elasticsuite-tracker/Model/ResourceModel/SessionIndex.php
SessionIndex.processSessionData
private function processSessionData(\Smile\ElasticsuiteCore\Search\Adapter\Elasticsuite\Response\Aggregation\Value $value) { $data = ['session_id' => $value->getValue()]; foreach ($value->getAggregations()->getBuckets() as $bucket) { $bucketName = $bucket->getName(); $buck...
php
private function processSessionData(\Smile\ElasticsuiteCore\Search\Adapter\Elasticsuite\Response\Aggregation\Value $value) { $data = ['session_id' => $value->getValue()]; foreach ($value->getAggregations()->getBuckets() as $bucket) { $bucketName = $bucket->getName(); $buck...
[ "private", "function", "processSessionData", "(", "\\", "Smile", "\\", "ElasticsuiteCore", "\\", "Search", "\\", "Adapter", "\\", "Elasticsuite", "\\", "Response", "\\", "Aggregation", "\\", "Value", "$", "value", ")", "{", "$", "data", "=", "[", "'session_id'...
Prepare session data from search aggregation response. @param \Smile\ElasticsuiteCore\Search\Adapter\Elasticsuite\Response\Aggregation\Value $value Aggregation value. @return array
[ "Prepare", "session", "data", "from", "search", "aggregation", "response", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-tracker/Model/ResourceModel/SessionIndex.php#L102-L122
Smile-SA/elasticsuite
src/module-elasticsuite-catalog/Model/Autocomplete/Product/Attribute/ItemFactory.php
ItemFactory.create
public function create(array $data) { $data['title'] = $data['value']; $data['url'] = $this->getUrl($data); unset($data['value']); return parent::create($data); }
php
public function create(array $data) { $data['title'] = $data['value']; $data['url'] = $this->getUrl($data); unset($data['value']); return parent::create($data); }
[ "public", "function", "create", "(", "array", "$", "data", ")", "{", "$", "data", "[", "'title'", "]", "=", "$", "data", "[", "'value'", "]", ";", "$", "data", "[", "'url'", "]", "=", "$", "this", "->", "getUrl", "(", "$", "data", ")", ";", "un...
{@inheritDoc}
[ "{" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog/Model/Autocomplete/Product/Attribute/ItemFactory.php#L49-L56
Smile-SA/elasticsuite
src/module-elasticsuite-catalog/Model/Autocomplete/Product/Attribute/ItemFactory.php
ItemFactory.getUrl
private function getUrl(array $data) { $urlParams = ['q' => $data['value'], $data['attribute_code'] => $data['value']]; return $this->urlBuilder->getUrl('catalogsearch/result', ['_query' => $urlParams]); }
php
private function getUrl(array $data) { $urlParams = ['q' => $data['value'], $data['attribute_code'] => $data['value']]; return $this->urlBuilder->getUrl('catalogsearch/result', ['_query' => $urlParams]); }
[ "private", "function", "getUrl", "(", "array", "$", "data", ")", "{", "$", "urlParams", "=", "[", "'q'", "=>", "$", "data", "[", "'value'", "]", ",", "$", "data", "[", "'attribute_code'", "]", "=>", "$", "data", "[", "'value'", "]", "]", ";", "retu...
Returns autocompelete result URL. @param array $data Autocomplete data. @return string
[ "Returns", "autocompelete", "result", "URL", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog/Model/Autocomplete/Product/Attribute/ItemFactory.php#L65-L70
Smile-SA/elasticsuite
src/module-elasticsuite-catalog/Plugin/Catalog/Eav/AttributePlugin.php
AttributePlugin.afterSave
public function afterSave( \Magento\Catalog\Api\Data\ProductAttributeInterface $subject, \Magento\Catalog\Api\Data\ProductAttributeInterface $result ) { $cleanCache = false; if ($subject->dataHasChangedFor('search_weight')) { $cleanCache = true; } if ($c...
php
public function afterSave( \Magento\Catalog\Api\Data\ProductAttributeInterface $subject, \Magento\Catalog\Api\Data\ProductAttributeInterface $result ) { $cleanCache = false; if ($subject->dataHasChangedFor('search_weight')) { $cleanCache = true; } if ($c...
[ "public", "function", "afterSave", "(", "\\", "Magento", "\\", "Catalog", "\\", "Api", "\\", "Data", "\\", "ProductAttributeInterface", "$", "subject", ",", "\\", "Magento", "\\", "Catalog", "\\", "Api", "\\", "Data", "\\", "ProductAttributeInterface", "$", "r...
Invalidate indices config after attribute is modified. @param \Magento\Catalog\Api\Data\ProductAttributeInterface $subject The attribute being saved @param \Magento\Catalog\Api\Data\ProductAttributeInterface $result The attribute being saved @return \Magento\Catalog\Api\Data\ProductAttributeInterface
[ "Invalidate", "indices", "config", "after", "attribute", "is", "modified", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog/Plugin/Catalog/Eav/AttributePlugin.php#L48-L63
Smile-SA/elasticsuite
src/module-elasticsuite-virtual-category/Plugin/Catalog/Category/ReindexOnChange.php
ReindexOnChange.aroundReindex
public function aroundReindex(\Magento\Catalog\Model\Category $category, \Closure $proceed) { $proceed(); // Reindex only if attached product list has changed. // This prevent reindexing if the category is just created and set to virtual. if ($category->dataHasChangedFor('is_virtual...
php
public function aroundReindex(\Magento\Catalog\Model\Category $category, \Closure $proceed) { $proceed(); // Reindex only if attached product list has changed. // This prevent reindexing if the category is just created and set to virtual. if ($category->dataHasChangedFor('is_virtual...
[ "public", "function", "aroundReindex", "(", "\\", "Magento", "\\", "Catalog", "\\", "Model", "\\", "Category", "$", "category", ",", "\\", "Closure", "$", "proceed", ")", "{", "$", "proceed", "(", ")", ";", "// Reindex only if attached product list has changed.", ...
Enforce reindexing of path ids if the category has just been set to 'is_virtual_category' = true. @param \Magento\Catalog\Model\Category $category The category @param \Closure $proceed The Category::reindex() method
[ "Enforce", "reindexing", "of", "path", "ids", "if", "the", "category", "has", "just", "been", "set", "to", "is_virtual_category", "=", "true", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-virtual-category/Plugin/Catalog/Category/ReindexOnChange.php#L46-L60
Smile-SA/elasticsuite
src/module-elasticsuite-virtual-category/Plugin/Catalog/Category/ReindexOnChange.php
ReindexOnChange.getIndexer
private function getIndexer() { return $this->indexerRegistry->get(\Magento\Catalog\Model\Indexer\Category\Product::INDEXER_ID); }
php
private function getIndexer() { return $this->indexerRegistry->get(\Magento\Catalog\Model\Indexer\Category\Product::INDEXER_ID); }
[ "private", "function", "getIndexer", "(", ")", "{", "return", "$", "this", "->", "indexerRegistry", "->", "get", "(", "\\", "Magento", "\\", "Catalog", "\\", "Model", "\\", "Indexer", "\\", "Category", "\\", "Product", "::", "INDEXER_ID", ")", ";", "}" ]
Retrieve Category/Product indexer. @return \Magento\Framework\Indexer\IndexerInterface
[ "Retrieve", "Category", "/", "Product", "indexer", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-virtual-category/Plugin/Catalog/Category/ReindexOnChange.php#L67-L70
Smile-SA/elasticsuite
src/module-elasticsuite-catalog-optimizer/Controller/Adminhtml/Optimizer/Save.php
Save.execute
public function execute() { /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ $resultRedirect = $this->resultRedirectFactory->create(); $data = $this->getRequest()->getPostValue(); $redirectBack = $this->getRequest()->getParam('back', false); if ($data...
php
public function execute() { /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ $resultRedirect = $this->resultRedirectFactory->create(); $data = $this->getRequest()->getPostValue(); $redirectBack = $this->getRequest()->getParam('back', false); if ($data...
[ "public", "function", "execute", "(", ")", "{", "/** @var \\Magento\\Backend\\Model\\View\\Result\\Redirect $resultRedirect */", "$", "resultRedirect", "=", "$", "this", "->", "resultRedirectFactory", "->", "create", "(", ")", ";", "$", "data", "=", "$", "this", "->",...
{@inheritdoc}
[ "{" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog-optimizer/Controller/Adminhtml/Optimizer/Save.php#L32-L94
Smile-SA/elasticsuite
src/module-elasticsuite-catalog-optimizer/Setup/UpgradeSchema.php
UpgradeSchema.upgrade
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); if (version_compare($context->getVersion(), "1.1.0") < 0) { $this->optimizerSetup->createOptimizerLimitationTable($setup); $this->optimizerSetup->updateOptimizerSearc...
php
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); if (version_compare($context->getVersion(), "1.1.0") < 0) { $this->optimizerSetup->createOptimizerLimitationTable($setup); $this->optimizerSetup->updateOptimizerSearc...
[ "public", "function", "upgrade", "(", "SchemaSetupInterface", "$", "setup", ",", "ModuleContextInterface", "$", "context", ")", "{", "$", "setup", "->", "startSetup", "(", ")", ";", "if", "(", "version_compare", "(", "$", "context", "->", "getVersion", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog-optimizer/Setup/UpgradeSchema.php#L47-L55
Smile-SA/elasticsuite
src/module-elasticsuite-core/Search/Adapter/Elasticsuite/Request/Query/Builder/MultiMatch.php
MultiMatch.buildQuery
public function buildQuery(QueryInterface $query) { if ($query->getType() !== QueryInterface::TYPE_MULTIMATCH) { throw new \InvalidArgumentException("Query builder : invalid query type {$query->getType()}"); } $fields = []; foreach ($query->getFields() as $field => $wei...
php
public function buildQuery(QueryInterface $query) { if ($query->getType() !== QueryInterface::TYPE_MULTIMATCH) { throw new \InvalidArgumentException("Query builder : invalid query type {$query->getType()}"); } $fields = []; foreach ($query->getFields() as $field => $wei...
[ "public", "function", "buildQuery", "(", "QueryInterface", "$", "query", ")", "{", "if", "(", "$", "query", "->", "getType", "(", ")", "!==", "QueryInterface", "::", "TYPE_MULTIMATCH", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "\"Query b...
{@inheritDoc}
[ "{" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-core/Search/Adapter/Elasticsuite/Request/Query/Builder/MultiMatch.php#L32-L68
Smile-SA/elasticsuite
src/module-elasticsuite-catalog-optimizer/Model/Optimizer.php
Optimizer.getConfig
public function getConfig($key = null) { if (is_string($this->getData(self::CONFIG))) { $this->setData(self::CONFIG, $this->serializer->unserialize($this->getData(self::CONFIG))); } $result = $this->getData(self::CONFIG); if ($key !== null) { $result = isset...
php
public function getConfig($key = null) { if (is_string($this->getData(self::CONFIG))) { $this->setData(self::CONFIG, $this->serializer->unserialize($this->getData(self::CONFIG))); } $result = $this->getData(self::CONFIG); if ($key !== null) { $result = isset...
[ "public", "function", "getConfig", "(", "$", "key", "=", "null", ")", "{", "if", "(", "is_string", "(", "$", "this", "->", "getData", "(", "self", "::", "CONFIG", ")", ")", ")", "{", "$", "this", "->", "setData", "(", "self", "::", "CONFIG", ",", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog-optimizer/Model/Optimizer.php#L137-L150
Smile-SA/elasticsuite
src/module-elasticsuite-catalog-optimizer/Model/Optimizer.php
Optimizer.getRuleCondition
public function getRuleCondition() { if (!is_object($this->getData(self::RULE_CONDITION))) { $ruleData = $this->getData(self::RULE_CONDITION); $rule = $this->ruleFactory->create(); if (is_string($ruleData)) { $ruleData = $this->serializer->unserialize...
php
public function getRuleCondition() { if (!is_object($this->getData(self::RULE_CONDITION))) { $ruleData = $this->getData(self::RULE_CONDITION); $rule = $this->ruleFactory->create(); if (is_string($ruleData)) { $ruleData = $this->serializer->unserialize...
[ "public", "function", "getRuleCondition", "(", ")", "{", "if", "(", "!", "is_object", "(", "$", "this", "->", "getData", "(", "self", "::", "RULE_CONDITION", ")", ")", ")", "{", "$", "ruleData", "=", "$", "this", "->", "getData", "(", "self", "::", "...
{@inheritDoc}
[ "{" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog-optimizer/Model/Optimizer.php#L188-L205
Smile-SA/elasticsuite
src/module-elasticsuite-catalog-optimizer/Model/Optimizer.php
Optimizer.validateData
public function validateData(\Magento\Framework\DataObject $dataObject) { $result = []; $fromDate = $toDate = null; if ($dataObject->hasFromDate() && $dataObject->hasToDate()) { $fromDate = $dataObject->getFromDate(); $toDate = $dataObject->getToDate(); } ...
php
public function validateData(\Magento\Framework\DataObject $dataObject) { $result = []; $fromDate = $toDate = null; if ($dataObject->hasFromDate() && $dataObject->hasToDate()) { $fromDate = $dataObject->getFromDate(); $toDate = $dataObject->getToDate(); } ...
[ "public", "function", "validateData", "(", "\\", "Magento", "\\", "Framework", "\\", "DataObject", "$", "dataObject", ")", "{", "$", "result", "=", "[", "]", ";", "$", "fromDate", "=", "$", "toDate", "=", "null", ";", "if", "(", "$", "dataObject", "->"...
Validate optimizer data @param \Magento\Framework\DataObject $dataObject The Optimizer @return bool|string[] - return true if validation passed successfully. Array with errors description otherwise
[ "Validate", "optimizer", "data" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog-optimizer/Model/Optimizer.php#L296-L316
Smile-SA/elasticsuite
src/module-elasticsuite-catalog-optimizer/Model/Optimizer.php
Optimizer.getIdentities
public function getIdentities() { $limitationIdentities = $this->limitationIdentitiesFactory->create(['optimizer' => $this]); $identities = array_merge($this->getCacheTags(), $limitationIdentities->get()); return $identities; }
php
public function getIdentities() { $limitationIdentities = $this->limitationIdentitiesFactory->create(['optimizer' => $this]); $identities = array_merge($this->getCacheTags(), $limitationIdentities->get()); return $identities; }
[ "public", "function", "getIdentities", "(", ")", "{", "$", "limitationIdentities", "=", "$", "this", "->", "limitationIdentitiesFactory", "->", "create", "(", "[", "'optimizer'", "=>", "$", "this", "]", ")", ";", "$", "identities", "=", "array_merge", "(", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog-optimizer/Model/Optimizer.php#L321-L327
Smile-SA/elasticsuite
src/module-elasticsuite-catalog-optimizer/Model/Optimizer.php
Optimizer.parseDateFields
private function parseDateFields() { if ('' === $this->getFromDate()) { $this->unsFromDate(); } if ('' === $this->getToDate()) { $this->unsToDate(); } foreach ([self::FROM_DATE, self::TO_DATE] as $dateField) { if ($this->hasData($dateFiel...
php
private function parseDateFields() { if ('' === $this->getFromDate()) { $this->unsFromDate(); } if ('' === $this->getToDate()) { $this->unsToDate(); } foreach ([self::FROM_DATE, self::TO_DATE] as $dateField) { if ($this->hasData($dateFiel...
[ "private", "function", "parseDateFields", "(", ")", "{", "if", "(", "''", "===", "$", "this", "->", "getFromDate", "(", ")", ")", "{", "$", "this", "->", "unsFromDate", "(", ")", ";", "}", "if", "(", "''", "===", "$", "this", "->", "getToDate", "("...
Parse date related fields @throws \Exception @return void
[ "Parse", "date", "related", "fields" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog-optimizer/Model/Optimizer.php#L346-L361
Smile-SA/elasticsuite
src/module-elasticsuite-thesaurus/Setup/UpgradeSchema.php
UpgradeSchema.upgrade
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); if (version_compare($context->getVersion(), '0.0.2', '<')) { $this->thesaurusSetup->createThesaurusTable($setup); $this->thesaurusSetup->createThesaurusStoreTable($s...
php
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); if (version_compare($context->getVersion(), '0.0.2', '<')) { $this->thesaurusSetup->createThesaurusTable($setup); $this->thesaurusSetup->createThesaurusStoreTable($s...
[ "public", "function", "upgrade", "(", "SchemaSetupInterface", "$", "setup", ",", "ModuleContextInterface", "$", "context", ")", "{", "$", "setup", "->", "startSetup", "(", ")", ";", "if", "(", "version_compare", "(", "$", "context", "->", "getVersion", "(", ...
Installs DB schema for a module @SuppressWarnings(PHPMD.UnusedFormalParameter) @param SchemaSetupInterface $setup Setup @param ModuleContextInterface $context Context @return void
[ "Installs", "DB", "schema", "for", "a", "module" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-thesaurus/Setup/UpgradeSchema.php#L54-L70
Smile-SA/elasticsuite
src/module-elasticsuite-virtual-category/Block/Adminhtml/Catalog/Category/VirtualRule.php
VirtualRule.getForm
private function getForm() { $form = $this->formFactory->create(); $form->setHtmlId('virtual_rule'); $virtualRuleField = $form->addField( 'virtual_rule', 'text', ['name' => 'virtual_rule', 'label' => __('Virtual rule'), 'container_id' => 'virtual_rule'...
php
private function getForm() { $form = $this->formFactory->create(); $form->setHtmlId('virtual_rule'); $virtualRuleField = $form->addField( 'virtual_rule', 'text', ['name' => 'virtual_rule', 'label' => __('Virtual rule'), 'container_id' => 'virtual_rule'...
[ "private", "function", "getForm", "(", ")", "{", "$", "form", "=", "$", "this", "->", "formFactory", "->", "create", "(", ")", ";", "$", "form", "->", "setHtmlId", "(", "'virtual_rule'", ")", ";", "$", "virtualRuleField", "=", "$", "form", "->", "addFi...
Create the form containing the virtual rule field. @return \Magento\Framework\Data\Form
[ "Create", "the", "form", "containing", "the", "virtual", "rule", "field", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-virtual-category/Block/Adminhtml/Catalog/Category/VirtualRule.php#L90-L112
Smile-SA/elasticsuite
src/module-elasticsuite-virtual-category/Block/Adminhtml/Catalog/Category/VirtualRule.php
VirtualRule.getVirtualRule
private function getVirtualRule(\Magento\Catalog\Api\Data\CategoryInterface $category) { if (!is_object($category->getVirtualRule())) { $category = clone $category; // No side effect on category which is in registry. $this->readHandler->execute($category); } return $...
php
private function getVirtualRule(\Magento\Catalog\Api\Data\CategoryInterface $category) { if (!is_object($category->getVirtualRule())) { $category = clone $category; // No side effect on category which is in registry. $this->readHandler->execute($category); } return $...
[ "private", "function", "getVirtualRule", "(", "\\", "Magento", "\\", "Catalog", "\\", "Api", "\\", "Data", "\\", "CategoryInterface", "$", "category", ")", "{", "if", "(", "!", "is_object", "(", "$", "category", "->", "getVirtualRule", "(", ")", ")", ")", ...
Load virtual rule of a category. Can occurs when data is set directly as array to the category (Eg. when the category edit form is submitted with error and populated from session data). @param CategoryInterface $category Category @return \Smile\ElasticsuiteVirtualCategory\Api\Data\VirtualRuleInterface
[ "Load", "virtual", "rule", "of", "a", "category", ".", "Can", "occurs", "when", "data", "is", "set", "directly", "as", "array", "to", "the", "category", "(", "Eg", ".", "when", "the", "category", "edit", "form", "is", "submitted", "with", "error", "and",...
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-virtual-category/Block/Adminhtml/Catalog/Category/VirtualRule.php#L122-L130
Smile-SA/elasticsuite
src/module-elasticsuite-core/Search/Adapter/Elasticsuite/Request/Aggregation/PipelineBuilder/BucketSelector.php
BucketSelector.buildPipeline
public function buildPipeline(PipelineInterface $pipeline) { if ($pipeline->getType() !== PipelineInterface::TYPE_BUCKET_SELECTOR) { throw new \InvalidArgumentException("Query builder : invalid aggregation type {$pipeline->getType()}."); } $aggParams = [ 'buckets_pat...
php
public function buildPipeline(PipelineInterface $pipeline) { if ($pipeline->getType() !== PipelineInterface::TYPE_BUCKET_SELECTOR) { throw new \InvalidArgumentException("Query builder : invalid aggregation type {$pipeline->getType()}."); } $aggParams = [ 'buckets_pat...
[ "public", "function", "buildPipeline", "(", "PipelineInterface", "$", "pipeline", ")", "{", "if", "(", "$", "pipeline", "->", "getType", "(", ")", "!==", "PipelineInterface", "::", "TYPE_BUCKET_SELECTOR", ")", "{", "throw", "new", "\\", "InvalidArgumentException",...
Build the pipeline aggregation. @param PipelineInterface $pipeline Bucket selector pipeline. @return array
[ "Build", "the", "pipeline", "aggregation", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-core/Search/Adapter/Elasticsuite/Request/Aggregation/PipelineBuilder/BucketSelector.php#L35-L48
Smile-SA/elasticsuite
src/module-elasticsuite-analytics/Model/Search/Usage/Kpi/AggregationProvider.php
AggregationProvider.getAggregation
public function getAggregation() { $aggParams = [ 'name' => 'data', 'queries' => $this->getQueries(), 'metrics' => $this->getMetrics(), ]; return $this->aggregationFactory->create(BucketInterface::TYPE_QUERY_GROUP, $aggParams); }
php
public function getAggregation() { $aggParams = [ 'name' => 'data', 'queries' => $this->getQueries(), 'metrics' => $this->getMetrics(), ]; return $this->aggregationFactory->create(BucketInterface::TYPE_QUERY_GROUP, $aggParams); }
[ "public", "function", "getAggregation", "(", ")", "{", "$", "aggParams", "=", "[", "'name'", "=>", "'data'", ",", "'queries'", "=>", "$", "this", "->", "getQueries", "(", ")", ",", "'metrics'", "=>", "$", "this", "->", "getMetrics", "(", ")", ",", "]",...
{@inheritdoc}
[ "{" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-analytics/Model/Search/Usage/Kpi/AggregationProvider.php#L63-L72
Smile-SA/elasticsuite
src/module-elasticsuite-analytics/Model/Search/Usage/Kpi/AggregationProvider.php
AggregationProvider.getMetrics
private function getMetrics() { $metrics = [ $this->metricFactory->create( ['name' => 'unique_sessions', 'field' => 'session.uid', 'type' => MetricInterface::TYPE_CARDINALITY] ), $this->metricFactory->create( ['name' => 'unique_visitors', '...
php
private function getMetrics() { $metrics = [ $this->metricFactory->create( ['name' => 'unique_sessions', 'field' => 'session.uid', 'type' => MetricInterface::TYPE_CARDINALITY] ), $this->metricFactory->create( ['name' => 'unique_visitors', '...
[ "private", "function", "getMetrics", "(", ")", "{", "$", "metrics", "=", "[", "$", "this", "->", "metricFactory", "->", "create", "(", "[", "'name'", "=>", "'unique_sessions'", ",", "'field'", "=>", "'session.uid'", ",", "'type'", "=>", "MetricInterface", ":...
Return metrics aggregations to apply to the main bucket aggregation @return array
[ "Return", "metrics", "aggregations", "to", "apply", "to", "the", "main", "bucket", "aggregation" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-analytics/Model/Search/Usage/Kpi/AggregationProvider.php#L79-L94
Smile-SA/elasticsuite
src/module-elasticsuite-analytics/Model/Search/Usage/Kpi/AggregationProvider.php
AggregationProvider.getQueries
private function getQueries() { $queries = [ 'all' => $this->queryFactory->create( QueryInterface::TYPE_BOOL, [] ), 'searches' => $this->queryFactory->create( QueryInterface::TYPE_TERM, [ ...
php
private function getQueries() { $queries = [ 'all' => $this->queryFactory->create( QueryInterface::TYPE_BOOL, [] ), 'searches' => $this->queryFactory->create( QueryInterface::TYPE_TERM, [ ...
[ "private", "function", "getQueries", "(", ")", "{", "$", "queries", "=", "[", "'all'", "=>", "$", "this", "->", "queryFactory", "->", "create", "(", "QueryInterface", "::", "TYPE_BOOL", ",", "[", "]", ")", ",", "'searches'", "=>", "$", "this", "->", "q...
Return the queries of the query group aggregation. @return array
[ "Return", "the", "queries", "of", "the", "query", "group", "aggregation", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-analytics/Model/Search/Usage/Kpi/AggregationProvider.php#L101-L118
Smile-SA/elasticsuite
src/module-elasticsuite-virtual-category/Model/Layer/Filter/Category.php
Category.applyCategoryFilterToCollection
protected function applyCategoryFilterToCollection(\Magento\Catalog\Api\Data\CategoryInterface $category) { $query = $this->getFilterQuery(); if ($query !== null) { $this->getLayer()->getProductCollection()->addQueryFilter($query); } return $this; }
php
protected function applyCategoryFilterToCollection(\Magento\Catalog\Api\Data\CategoryInterface $category) { $query = $this->getFilterQuery(); if ($query !== null) { $this->getLayer()->getProductCollection()->addQueryFilter($query); } return $this; }
[ "protected", "function", "applyCategoryFilterToCollection", "(", "\\", "Magento", "\\", "Catalog", "\\", "Api", "\\", "Data", "\\", "CategoryInterface", "$", "category", ")", "{", "$", "query", "=", "$", "this", "->", "getFilterQuery", "(", ")", ";", "if", "...
{@inheritDoc}
[ "{" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-virtual-category/Model/Layer/Filter/Category.php#L89-L98
Smile-SA/elasticsuite
src/module-elasticsuite-catalog/Search/Request/Product/Aggregation/Provider/FilterableAttributes/Search/AttributeList.php
AttributeList.getList
public function getList() { /** @var $collection \Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection */ $collection = $this->collectionFactory->create(); $collection->setItemObjectClass(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class) ->setOrder('position'...
php
public function getList() { /** @var $collection \Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection */ $collection = $this->collectionFactory->create(); $collection->setItemObjectClass(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class) ->setOrder('position'...
[ "public", "function", "getList", "(", ")", "{", "/** @var $collection \\Magento\\Catalog\\Model\\ResourceModel\\Product\\Attribute\\Collection */", "$", "collection", "=", "$", "this", "->", "collectionFactory", "->", "create", "(", ")", ";", "$", "collection", "->", "set...
{@inheritdoc}
[ "{" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog/Search/Request/Product/Aggregation/Provider/FilterableAttributes/Search/AttributeList.php#L46-L62
Smile-SA/elasticsuite
src/module-elasticsuite-catalog/Model/ResourceModel/Category/Fulltext/Collection.php
Collection.prepareSortOrders
private function prepareSortOrders() { $sortOrders = []; foreach ($this->_orders as $attribute => $direction) { $sortParams = ['direction' => $direction]; $sortField = $attribute; $sortOrders[$sortField] = $sortParams; } return $sortOrders; }
php
private function prepareSortOrders() { $sortOrders = []; foreach ($this->_orders as $attribute => $direction) { $sortParams = ['direction' => $direction]; $sortField = $attribute; $sortOrders[$sortField] = $sortParams; } return $sortOrders; }
[ "private", "function", "prepareSortOrders", "(", ")", "{", "$", "sortOrders", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "_orders", "as", "$", "attribute", "=>", "$", "direction", ")", "{", "$", "sortParams", "=", "[", "'direction'", "=>", ...
Prepare sort orders for the request builder. @return array()
[ "Prepare", "sort", "orders", "for", "the", "request", "builder", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog/Model/ResourceModel/Category/Fulltext/Collection.php#L342-L353
Smile-SA/elasticsuite
src/module-elasticsuite-catalog/Model/ResourceModel/Category/Fulltext/Collection.php
Collection.loadItemCounts
private function loadItemCounts() { $storeId = $this->getStoreId(); $requestName = $this->searchRequestName; $searchRequest = $this->requestBuilder->create( $storeId, $requestName, 0, 0, $this->query, [], ...
php
private function loadItemCounts() { $storeId = $this->getStoreId(); $requestName = $this->searchRequestName; $searchRequest = $this->requestBuilder->create( $storeId, $requestName, 0, 0, $this->query, [], ...
[ "private", "function", "loadItemCounts", "(", ")", "{", "$", "storeId", "=", "$", "this", "->", "getStoreId", "(", ")", ";", "$", "requestName", "=", "$", "this", "->", "searchRequestName", ";", "$", "searchRequest", "=", "$", "this", "->", "requestBuilder...
Load items count : - collection size @return void
[ "Load", "items", "count", ":", "-", "collection", "size" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog/Model/ResourceModel/Category/Fulltext/Collection.php#L361-L380
Smile-SA/elasticsuite
src/module-elasticsuite-tracker/Model/IndexResolver.php
IndexResolver.getIndex
public function getIndex($indexIdentifier, $storeId, $date) { $indexName = $indexIdentifier; try { $indexAlias = $this->indexManager->getIndexAlias($indexIdentifier, $storeId); $indexName = $this->indexManager->getIndexName($indexIdentifier, $storeId, $date); i...
php
public function getIndex($indexIdentifier, $storeId, $date) { $indexName = $indexIdentifier; try { $indexAlias = $this->indexManager->getIndexAlias($indexIdentifier, $storeId); $indexName = $this->indexManager->getIndexName($indexIdentifier, $storeId, $date); i...
[ "public", "function", "getIndex", "(", "$", "indexIdentifier", ",", "$", "storeId", ",", "$", "date", ")", "{", "$", "indexName", "=", "$", "indexIdentifier", ";", "try", "{", "$", "indexAlias", "=", "$", "this", "->", "indexManager", "->", "getIndexAlias"...
Get index by identifier, store and date. @param string $indexIdentifier Index identifier. @param int $storeId Store id. @param string $date Date. @return \Smile\ElasticsuiteCore\Api\Index\IndexInterface
[ "Get", "index", "by", "identifier", "store", "and", "date", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-tracker/Model/IndexResolver.php#L68-L87
Smile-SA/elasticsuite
src/module-elasticsuite-core/Search/Adapter/Elasticsuite/Request/Query/Builder/Filtered.php
Filtered.buildQuery
public function buildQuery(QueryInterface $query) { if ($query->getType() !== QueryInterface::TYPE_FILTER) { throw new \InvalidArgumentException("Query builder : invalid query type {$query->getType()}"); } $searchQuery = []; if ($query->getFilter()) { $searc...
php
public function buildQuery(QueryInterface $query) { if ($query->getType() !== QueryInterface::TYPE_FILTER) { throw new \InvalidArgumentException("Query builder : invalid query type {$query->getType()}"); } $searchQuery = []; if ($query->getFilter()) { $searc...
[ "public", "function", "buildQuery", "(", "QueryInterface", "$", "query", ")", "{", "if", "(", "$", "query", "->", "getType", "(", ")", "!==", "QueryInterface", "::", "TYPE_FILTER", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "\"Query build...
{@inheritDoc}
[ "{" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-core/Search/Adapter/Elasticsuite/Request/Query/Builder/Filtered.php#L32-L61
Smile-SA/elasticsuite
src/module-elasticsuite-catalog/Helper/Autocomplete.php
Autocomplete.getAttributeAutocompleteField
public function getAttributeAutocompleteField(\Magento\Catalog\Api\Data\ProductAttributeInterface $attribute) { return $this->attributeHelper->getFilterField($attribute); }
php
public function getAttributeAutocompleteField(\Magento\Catalog\Api\Data\ProductAttributeInterface $attribute) { return $this->attributeHelper->getFilterField($attribute); }
[ "public", "function", "getAttributeAutocompleteField", "(", "\\", "Magento", "\\", "Catalog", "\\", "Api", "\\", "Data", "\\", "ProductAttributeInterface", "$", "attribute", ")", "{", "return", "$", "this", "->", "attributeHelper", "->", "getFilterField", "(", "$"...
ES field used in attribute autocomplete. @param \Magento\Catalog\Api\Data\ProductAttributeInterface $attribute Attribute. @return string
[ "ES", "field", "used", "in", "attribute", "autocomplete", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog/Helper/Autocomplete.php#L54-L57
Smile-SA/elasticsuite
src/module-elasticsuite-virtual-category/Block/Adminhtml/Catalog/Category/Checkboxes/Tree.php
Tree.getRoot
public function getRoot($parentNodeCategory = null, $recursionLevel = 3) { if ($parentNodeCategory === null) { if ($this->getCurrentCategoryId()) { $this->getRootByIds([$this->getCurrentCategoryId()]); } } return parent::getRoot($parentNodeCategory, $...
php
public function getRoot($parentNodeCategory = null, $recursionLevel = 3) { if ($parentNodeCategory === null) { if ($this->getCurrentCategoryId()) { $this->getRootByIds([$this->getCurrentCategoryId()]); } } return parent::getRoot($parentNodeCategory, $...
[ "public", "function", "getRoot", "(", "$", "parentNodeCategory", "=", "null", ",", "$", "recursionLevel", "=", "3", ")", "{", "if", "(", "$", "parentNodeCategory", "===", "null", ")", "{", "if", "(", "$", "this", "->", "getCurrentCategoryId", "(", ")", "...
{@inheritdoc} Overridden to load only Root of the current category if needed.
[ "{", "@inheritdoc", "}" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-virtual-category/Block/Adminhtml/Catalog/Category/Checkboxes/Tree.php#L32-L41
Smile-SA/elasticsuite
src/module-elasticsuite-virtual-category/Block/Adminhtml/Catalog/Category/Checkboxes/Tree.php
Tree.getCategoryCollection
public function getCategoryCollection() { $collection = parent::getCategoryCollection(); // Previous call to $this->getRootByIds() will exclude all other category trees but keep their root. // Now we exclude all root categories except root associated to the current one. if ($this->g...
php
public function getCategoryCollection() { $collection = parent::getCategoryCollection(); // Previous call to $this->getRootByIds() will exclude all other category trees but keep their root. // Now we exclude all root categories except root associated to the current one. if ($this->g...
[ "public", "function", "getCategoryCollection", "(", ")", "{", "$", "collection", "=", "parent", "::", "getCategoryCollection", "(", ")", ";", "// Previous call to $this->getRootByIds() will exclude all other category trees but keep their root.", "// Now we exclude all root categories...
{@inheritdoc} Overridden to exclude other trees than the current category.
[ "{", "@inheritdoc", "}" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-virtual-category/Block/Adminhtml/Catalog/Category/Checkboxes/Tree.php#L48-L67
Smile-SA/elasticsuite
src/module-elasticsuite-catalog-optimizer/Model/Optimizer/Preview/Item.php
Item.getData
public function getData() { $productItemData = [ 'id' => (int) $this->document->getId(), 'name' => $this->getDocumentSource('name'), 'price' => $this->getProductPrice(), 'image' => $this->getProductImage(), 'score' ...
php
public function getData() { $productItemData = [ 'id' => (int) $this->document->getId(), 'name' => $this->getDocumentSource('name'), 'price' => $this->getProductPrice(), 'image' => $this->getProductImage(), 'score' ...
[ "public", "function", "getData", "(", ")", "{", "$", "productItemData", "=", "[", "'id'", "=>", "(", "int", ")", "$", "this", "->", "document", "->", "getId", "(", ")", ",", "'name'", "=>", "$", "this", "->", "getDocumentSource", "(", "'name'", ")", ...
Item data. @return array
[ "Item", "data", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog-optimizer/Model/Optimizer/Preview/Item.php#L67-L79
Smile-SA/elasticsuite
src/module-elasticsuite-catalog-optimizer/Model/Optimizer/Preview/Item.php
Item.getDocumentSource
private function getDocumentSource($field = null) { $docSource = $this->document->getSource() ? : []; $result = $docSource; if (null !== $field) { $result = null; if (isset($docSource[$field])) { $result = is_array($docSource[$field]) ? current($do...
php
private function getDocumentSource($field = null) { $docSource = $this->document->getSource() ? : []; $result = $docSource; if (null !== $field) { $result = null; if (isset($docSource[$field])) { $result = is_array($docSource[$field]) ? current($do...
[ "private", "function", "getDocumentSource", "(", "$", "field", "=", "null", ")", "{", "$", "docSource", "=", "$", "this", "->", "document", "->", "getSource", "(", ")", "?", ":", "[", "]", ";", "$", "result", "=", "$", "docSource", ";", "if", "(", ...
Return the ES source document for the current product. @param string $field The document field to retrieve. @return array
[ "Return", "the", "ES", "source", "document", "for", "the", "current", "product", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog-optimizer/Model/Optimizer/Preview/Item.php#L88-L101
Smile-SA/elasticsuite
src/module-elasticsuite-catalog-optimizer/Model/Optimizer/Preview/Item.php
Item.getProductImage
private function getProductImage() { $image = $this->getDocumentSource('image'); if ($image) { $this->product->setSmallImage($image); } $this->imageHelper->init($this->product, 'smile_elasticsuiteoptimizer_preview'); return $this->imageHelper->getUrl(); }
php
private function getProductImage() { $image = $this->getDocumentSource('image'); if ($image) { $this->product->setSmallImage($image); } $this->imageHelper->init($this->product, 'smile_elasticsuiteoptimizer_preview'); return $this->imageHelper->getUrl(); }
[ "private", "function", "getProductImage", "(", ")", "{", "$", "image", "=", "$", "this", "->", "getDocumentSource", "(", "'image'", ")", ";", "if", "(", "$", "image", ")", "{", "$", "this", "->", "product", "->", "setSmallImage", "(", "$", "image", ")"...
Retrieve product small image @return string
[ "Retrieve", "product", "small", "image" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog-optimizer/Model/Optimizer/Preview/Item.php#L118-L128
Smile-SA/elasticsuite
src/module-elasticsuite-core/Search/Request/Query/Filter/QueryBuilder.php
QueryBuilder.create
public function create(ContainerConfigurationInterface $containerConfig, array $filters, $currentPath = null) { $queries = []; $mapping = $containerConfig->getMapping(); foreach ($filters as $fieldName => $condition) { if ($condition instanceof QueryInterface) { ...
php
public function create(ContainerConfigurationInterface $containerConfig, array $filters, $currentPath = null) { $queries = []; $mapping = $containerConfig->getMapping(); foreach ($filters as $fieldName => $condition) { if ($condition instanceof QueryInterface) { ...
[ "public", "function", "create", "(", "ContainerConfigurationInterface", "$", "containerConfig", ",", "array", "$", "filters", ",", "$", "currentPath", "=", "null", ")", "{", "$", "queries", "=", "[", "]", ";", "$", "mapping", "=", "$", "containerConfig", "->...
Prepare filter condition from an array as used into addFieldToFilter. @SuppressWarnings(PHPMD.ElseExpression) @param ContainerConfigurationInterface $containerConfig Search request container configuration. @param array $filters Filters to be built. @param string|null ...
[ "Prepare", "filter", "condition", "from", "an", "array", "as", "used", "into", "addFieldToFilter", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-core/Search/Request/Query/Filter/QueryBuilder.php#L87-L109
Smile-SA/elasticsuite
src/module-elasticsuite-core/Search/Request/Query/Filter/QueryBuilder.php
QueryBuilder.prepareFieldCondition
private function prepareFieldCondition(FieldInterface $field, $condition, $currentPath) { $queryType = QueryInterface::TYPE_TERMS; $condition = $this->prepareCondition($condition); if (count(array_intersect($this->rangeConditions, array_keys($condition))) >= 1) { $queryType = Qu...
php
private function prepareFieldCondition(FieldInterface $field, $condition, $currentPath) { $queryType = QueryInterface::TYPE_TERMS; $condition = $this->prepareCondition($condition); if (count(array_intersect($this->rangeConditions, array_keys($condition))) >= 1) { $queryType = Qu...
[ "private", "function", "prepareFieldCondition", "(", "FieldInterface", "$", "field", ",", "$", "condition", ",", "$", "currentPath", ")", "{", "$", "queryType", "=", "QueryInterface", "::", "TYPE_TERMS", ";", "$", "condition", "=", "$", "this", "->", "prepareC...
Transform the condition into a search request query object. @param FieldInterface $field Filter field. @param array|string $condition Filter condition. @param string|null $currentPath Current nested path or null. @return QueryInterface
[ "Transform", "the", "condition", "into", "a", "search", "request", "query", "object", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-core/Search/Request/Query/Filter/QueryBuilder.php#L120-L157
Smile-SA/elasticsuite
src/module-elasticsuite-core/Search/Request/Query/Filter/QueryBuilder.php
QueryBuilder.isNestedField
private function isNestedField(FieldInterface $field, $currentPath) { $isNested = $field->isNested(); if ($currentPath !== null) { if ($field->isNested() && ($field->getNestedPath() !== $currentPath)) { throw new \LogicException("Can not filter nested field {$field->getN...
php
private function isNestedField(FieldInterface $field, $currentPath) { $isNested = $field->isNested(); if ($currentPath !== null) { if ($field->isNested() && ($field->getNestedPath() !== $currentPath)) { throw new \LogicException("Can not filter nested field {$field->getN...
[ "private", "function", "isNestedField", "(", "FieldInterface", "$", "field", ",", "$", "currentPath", ")", "{", "$", "isNested", "=", "$", "field", "->", "isNested", "(", ")", ";", "if", "(", "$", "currentPath", "!==", "null", ")", "{", "if", "(", "$",...
@param FieldInterface $field Filter field. @param string|null $currentPath Current nested path or null. @return bool @throws \LogicException
[ "@param", "FieldInterface", "$field", "Filter", "field", ".", "@param", "string|null", "$currentPath", "Current", "nested", "path", "or", "null", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-core/Search/Request/Query/Filter/QueryBuilder.php#L166-L182
Smile-SA/elasticsuite
src/module-elasticsuite-core/Search/Request/Query/Filter/QueryBuilder.php
QueryBuilder.prepareCondition
private function prepareCondition($condition) { if (!is_array($condition)) { $condition = ['in' => [$condition]]; } $conditionKeys = array_keys($condition); if (is_integer(current($conditionKeys))) { $condition = ['in' => $condition]; } fore...
php
private function prepareCondition($condition) { if (!is_array($condition)) { $condition = ['in' => [$condition]]; } $conditionKeys = array_keys($condition); if (is_integer(current($conditionKeys))) { $condition = ['in' => $condition]; } fore...
[ "private", "function", "prepareCondition", "(", "$", "condition", ")", "{", "if", "(", "!", "is_array", "(", "$", "condition", ")", ")", "{", "$", "condition", "=", "[", "'in'", "=>", "[", "$", "condition", "]", "]", ";", "}", "$", "conditionKeys", "...
Ensure the condition is supported and try to tranform it into a supported type. @param array|integer|string $condition Parsed condition. @return array
[ "Ensure", "the", "condition", "is", "supported", "and", "try", "to", "tranform", "it", "into", "a", "supported", "type", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-core/Search/Request/Query/Filter/QueryBuilder.php#L191-L219
Smile-SA/elasticsuite
src/module-elasticsuite-catalog-optimizer/Controller/Adminhtml/Optimizer/Edit.php
Edit.execute
public function execute() { /** @var \Magento\Backend\Model\View\Result\Page $resultPage */ $resultPage = $this->resultPageFactory->create(); $optimizerId = (int) $this->getRequest()->getParam('id'); $optimizer = null; try { $optimizer = $this->optimizerReposito...
php
public function execute() { /** @var \Magento\Backend\Model\View\Result\Page $resultPage */ $resultPage = $this->resultPageFactory->create(); $optimizerId = (int) $this->getRequest()->getParam('id'); $optimizer = null; try { $optimizer = $this->optimizerReposito...
[ "public", "function", "execute", "(", ")", "{", "/** @var \\Magento\\Backend\\Model\\View\\Result\\Page $resultPage */", "$", "resultPage", "=", "$", "this", "->", "resultPageFactory", "->", "create", "(", ")", ";", "$", "optimizerId", "=", "(", "int", ")", "$", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog-optimizer/Controller/Adminhtml/Optimizer/Edit.php#L32-L55
Smile-SA/elasticsuite
src/module-elasticsuite-catalog-rule/Model/Rule/Condition/Product/QueryBuilder.php
QueryBuilder.getSearchQuery
public function getSearchQuery(ProductCondition $productCondition) { $query = null; $query = $this->getSpecialAttributesSearchQuery($productCondition); if ($query === null && !empty($productCondition->getValue())) { $this->prepareFieldValue($productCondition); $quer...
php
public function getSearchQuery(ProductCondition $productCondition) { $query = null; $query = $this->getSpecialAttributesSearchQuery($productCondition); if ($query === null && !empty($productCondition->getValue())) { $this->prepareFieldValue($productCondition); $quer...
[ "public", "function", "getSearchQuery", "(", "ProductCondition", "$", "productCondition", ")", "{", "$", "query", "=", "null", ";", "$", "query", "=", "$", "this", "->", "getSpecialAttributesSearchQuery", "(", "$", "productCondition", ")", ";", "if", "(", "$",...
Build the query for a condition. @param ProductCondition $productCondition Product condition. @return \Smile\ElasticsuiteCore\Search\Request\QueryInterface
[ "Build", "the", "query", "for", "a", "condition", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog-rule/Model/Rule/Condition/Product/QueryBuilder.php#L77-L123
Smile-SA/elasticsuite
src/module-elasticsuite-catalog-rule/Model/Rule/Condition/Product/QueryBuilder.php
QueryBuilder.getSpecialAttributesSearchQuery
private function getSpecialAttributesSearchQuery(ProductCondition $productCondition) { $query = null; if ($productCondition->getAttribute() === 'sku') { $queryParams = []; $fieldName = $this->getSearchFieldName($productCondition); // SKU values can be an array...
php
private function getSpecialAttributesSearchQuery(ProductCondition $productCondition) { $query = null; if ($productCondition->getAttribute() === 'sku') { $queryParams = []; $fieldName = $this->getSearchFieldName($productCondition); // SKU values can be an array...
[ "private", "function", "getSpecialAttributesSearchQuery", "(", "ProductCondition", "$", "productCondition", ")", "{", "$", "query", "=", "null", ";", "if", "(", "$", "productCondition", "->", "getAttribute", "(", ")", "===", "'sku'", ")", "{", "$", "queryParams"...
Create a query for special attribute. @param ProductCondition $productCondition Product condition. @return NULL|\Smile\ElasticsuiteCore\Search\Request\QueryInterface
[ "Create", "a", "query", "for", "special", "attribute", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog-rule/Model/Rule/Condition/Product/QueryBuilder.php#L132-L160
Smile-SA/elasticsuite
src/module-elasticsuite-catalog-rule/Model/Rule/Condition/Product/QueryBuilder.php
QueryBuilder.getMatchQueryParams
private function getMatchQueryParams(ProductCondition $productCondition) { $fieldName = $this->getSearchFieldName($productCondition); $queryText = $productCondition->getValue(); $minimumShouldMatch = "100%"; return ['field' => $fieldName, 'queryText' => $queryText,...
php
private function getMatchQueryParams(ProductCondition $productCondition) { $fieldName = $this->getSearchFieldName($productCondition); $queryText = $productCondition->getValue(); $minimumShouldMatch = "100%"; return ['field' => $fieldName, 'queryText' => $queryText,...
[ "private", "function", "getMatchQueryParams", "(", "ProductCondition", "$", "productCondition", ")", "{", "$", "fieldName", "=", "$", "this", "->", "getSearchFieldName", "(", "$", "productCondition", ")", ";", "$", "queryText", "=", "$", "productCondition", "->", ...
Retrieve params for a match query from condition. @param ProductCondition $productCondition Product condition. @return array
[ "Retrieve", "params", "for", "a", "match", "query", "from", "condition", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog-rule/Model/Rule/Condition/Product/QueryBuilder.php#L169-L176
Smile-SA/elasticsuite
src/module-elasticsuite-catalog-rule/Model/Rule/Condition/Product/QueryBuilder.php
QueryBuilder.getRangeQueryParams
private function getRangeQueryParams(ProductCondition $productCondition) { $fieldName = $this->getSearchFieldName($productCondition); $operator = $productCondition->getOperator(); $value = $productCondition->getValue(); switch ($operator) { case '>': ...
php
private function getRangeQueryParams(ProductCondition $productCondition) { $fieldName = $this->getSearchFieldName($productCondition); $operator = $productCondition->getOperator(); $value = $productCondition->getValue(); switch ($operator) { case '>': ...
[ "private", "function", "getRangeQueryParams", "(", "ProductCondition", "$", "productCondition", ")", "{", "$", "fieldName", "=", "$", "this", "->", "getSearchFieldName", "(", "$", "productCondition", ")", ";", "$", "operator", "=", "$", "productCondition", "->", ...
Retrieve params for a range query from condition. @param ProductCondition $productCondition Product condition. @return array
[ "Retrieve", "params", "for", "a", "range", "query", "from", "condition", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog-rule/Model/Rule/Condition/Product/QueryBuilder.php#L185-L207
Smile-SA/elasticsuite
src/module-elasticsuite-catalog-rule/Model/Rule/Condition/Product/QueryBuilder.php
QueryBuilder.getTermsQueryParams
private function getTermsQueryParams(ProductCondition $productCondition) { $field = $this->getSearchField($productCondition); $fieldName = $this->getSearchFieldName($productCondition); $values = $productCondition->getValue(); if (!is_array($values) && in_array($productConditi...
php
private function getTermsQueryParams(ProductCondition $productCondition) { $field = $this->getSearchField($productCondition); $fieldName = $this->getSearchFieldName($productCondition); $values = $productCondition->getValue(); if (!is_array($values) && in_array($productConditi...
[ "private", "function", "getTermsQueryParams", "(", "ProductCondition", "$", "productCondition", ")", "{", "$", "field", "=", "$", "this", "->", "getSearchField", "(", "$", "productCondition", ")", ";", "$", "fieldName", "=", "$", "this", "->", "getSearchFieldNam...
Retrieve params for a terms query from condition. @param ProductCondition $productCondition Product condition. @return array
[ "Retrieve", "params", "for", "a", "terms", "query", "from", "condition", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog-rule/Model/Rule/Condition/Product/QueryBuilder.php#L216-L231
Smile-SA/elasticsuite
src/module-elasticsuite-catalog-rule/Model/Rule/Condition/Product/QueryBuilder.php
QueryBuilder.getSearchField
private function getSearchField(ProductCondition $productCondition) { $field = $this->attributeList->getField($productCondition->getAttribute()); return $field; }
php
private function getSearchField(ProductCondition $productCondition) { $field = $this->attributeList->getField($productCondition->getAttribute()); return $field; }
[ "private", "function", "getSearchField", "(", "ProductCondition", "$", "productCondition", ")", "{", "$", "field", "=", "$", "this", "->", "attributeList", "->", "getField", "(", "$", "productCondition", "->", "getAttribute", "(", ")", ")", ";", "return", "$",...
Retrieve ES mapping field for the current condition. @param ProductCondition $productCondition Product condition. @return \Smile\ElasticsuiteCore\Api\Index\Mapping\FieldInterface
[ "Retrieve", "ES", "mapping", "field", "for", "the", "current", "condition", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog-rule/Model/Rule/Condition/Product/QueryBuilder.php#L265-L270
Smile-SA/elasticsuite
src/module-elasticsuite-catalog-rule/Model/Rule/Condition/Product/QueryBuilder.php
QueryBuilder.getSearchFieldName
private function getSearchFieldName(ProductCondition $productCondition) { $attributeName = $productCondition->getAttribute(); $field = $this->attributeList->getField($attributeName); $analyzer = FieldInterface::ANALYZER_UNTOUCHED; if ($productCondition->getInputType() === "strin...
php
private function getSearchFieldName(ProductCondition $productCondition) { $attributeName = $productCondition->getAttribute(); $field = $this->attributeList->getField($attributeName); $analyzer = FieldInterface::ANALYZER_UNTOUCHED; if ($productCondition->getInputType() === "strin...
[ "private", "function", "getSearchFieldName", "(", "ProductCondition", "$", "productCondition", ")", "{", "$", "attributeName", "=", "$", "productCondition", "->", "getAttribute", "(", ")", ";", "$", "field", "=", "$", "this", "->", "attributeList", "->", "getFie...
Retrieve ES mapping field name used for the current condition (including analyzer). @param ProductCondition $productCondition Product condition. @return string
[ "Retrieve", "ES", "mapping", "field", "name", "used", "for", "the", "current", "condition", "(", "including", "analyzer", ")", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog-rule/Model/Rule/Condition/Product/QueryBuilder.php#L279-L291
Smile-SA/elasticsuite
src/module-elasticsuite-catalog-rule/Model/Rule/Condition/Product/QueryBuilder.php
QueryBuilder.prepareFieldValue
private function prepareFieldValue(ProductCondition $productCondition) { $value = $productCondition->getValue(); if (is_array($value)) { $value = array_filter($value); } $productCondition->setValue($value); return $this; }
php
private function prepareFieldValue(ProductCondition $productCondition) { $value = $productCondition->getValue(); if (is_array($value)) { $value = array_filter($value); } $productCondition->setValue($value); return $this; }
[ "private", "function", "prepareFieldValue", "(", "ProductCondition", "$", "productCondition", ")", "{", "$", "value", "=", "$", "productCondition", "->", "getValue", "(", ")", ";", "if", "(", "is_array", "(", "$", "value", ")", ")", "{", "$", "value", "=",...
Update the condition value to ignore empty array items. @param ProductCondition $productCondition Product condition. @return $this
[ "Update", "the", "condition", "value", "to", "ignore", "empty", "array", "items", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog-rule/Model/Rule/Condition/Product/QueryBuilder.php#L300-L311
Smile-SA/elasticsuite
src/module-elasticsuite-core/Search/Request/RelevanceConfig/App/Config/ScopeCodeResolver.php
ScopeCodeResolver.resolve
public function resolve($scopeType, $scopeCode) { if (isset($this->resolvedScopeCodes[$scopeType][$scopeCode])) { return $this->resolvedScopeCodes[$scopeType][$scopeCode]; } $resolverScopeCode = $scopeCode; if (($scopeCode === null || is_numeric($scopeCode)) ...
php
public function resolve($scopeType, $scopeCode) { if (isset($this->resolvedScopeCodes[$scopeType][$scopeCode])) { return $this->resolvedScopeCodes[$scopeType][$scopeCode]; } $resolverScopeCode = $scopeCode; if (($scopeCode === null || is_numeric($scopeCode)) ...
[ "public", "function", "resolve", "(", "$", "scopeType", ",", "$", "scopeCode", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "resolvedScopeCodes", "[", "$", "scopeType", "]", "[", "$", "scopeCode", "]", ")", ")", "{", "return", "$", "this", "...
Resolve scope code @param string $scopeType Scope Type @param string|null $scopeCode Scope code @return string
[ "Resolve", "scope", "code" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-core/Search/Request/RelevanceConfig/App/Config/ScopeCodeResolver.php#L55-L77
Smile-SA/elasticsuite
src/module-elasticsuite-thesaurus/Model/Index.php
Index.getQueryRewrites
public function getQueryRewrites(ContainerConfigurationInterface $containerConfig, $queryText) { $cacheKey = $this->getCacheKey($containerConfig, $queryText); $cacheTags = $this->getCacheTags($containerConfig); $queryRewrites = $this->cacheHelper->loadCache($cacheKey); if ($queryR...
php
public function getQueryRewrites(ContainerConfigurationInterface $containerConfig, $queryText) { $cacheKey = $this->getCacheKey($containerConfig, $queryText); $cacheTags = $this->getCacheTags($containerConfig); $queryRewrites = $this->cacheHelper->loadCache($cacheKey); if ($queryR...
[ "public", "function", "getQueryRewrites", "(", "ContainerConfigurationInterface", "$", "containerConfig", ",", "$", "queryText", ")", "{", "$", "cacheKey", "=", "$", "this", "->", "getCacheKey", "(", "$", "containerConfig", ",", "$", "queryText", ")", ";", "$", ...
Provides weigthed rewrites for the query. @param ContainerConfigurationInterface $containerConfig Search request container config. @param string $queryText Fulltext query. @return array
[ "Provides", "weigthed", "rewrites", "for", "the", "query", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-thesaurus/Model/Index.php#L97-L110
Smile-SA/elasticsuite
src/module-elasticsuite-thesaurus/Model/Index.php
Index.computeQueryRewrites
private function computeQueryRewrites(ContainerConfigurationInterface $containerConfig, $queryText) { $config = $this->getConfig($containerConfig); $storeId = $containerConfig->getStoreId(); $rewrites = []; $maxRewrites = $config->getMaxRewrites(); if ($config->isSynonymS...
php
private function computeQueryRewrites(ContainerConfigurationInterface $containerConfig, $queryText) { $config = $this->getConfig($containerConfig); $storeId = $containerConfig->getStoreId(); $rewrites = []; $maxRewrites = $config->getMaxRewrites(); if ($config->isSynonymS...
[ "private", "function", "computeQueryRewrites", "(", "ContainerConfigurationInterface", "$", "containerConfig", ",", "$", "queryText", ")", "{", "$", "config", "=", "$", "this", "->", "getConfig", "(", "$", "containerConfig", ")", ";", "$", "storeId", "=", "$", ...
Compute weigthed rewrites for the query. @param ContainerConfigurationInterface $containerConfig Search request container config. @param string $queryText Fulltext query. @return array
[ "Compute", "weigthed", "rewrites", "for", "the", "query", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-thesaurus/Model/Index.php#L120-L145
Smile-SA/elasticsuite
src/module-elasticsuite-thesaurus/Model/Index.php
Index.getCacheKey
private function getCacheKey(ContainerConfigurationInterface $containerConfig, $queryText) { $tags = $this->getCacheTags($containerConfig); return implode('|', array_merge($tags, [$queryText])); }
php
private function getCacheKey(ContainerConfigurationInterface $containerConfig, $queryText) { $tags = $this->getCacheTags($containerConfig); return implode('|', array_merge($tags, [$queryText])); }
[ "private", "function", "getCacheKey", "(", "ContainerConfigurationInterface", "$", "containerConfig", ",", "$", "queryText", ")", "{", "$", "tags", "=", "$", "this", "->", "getCacheTags", "(", "$", "containerConfig", ")", ";", "return", "implode", "(", "'|'", ...
Returns the cache key of the query. @param ContainerConfigurationInterface $containerConfig Search container configuration. @param string $queryText Fulltext query. @return string
[ "Returns", "the", "cache", "key", "of", "the", "query", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-thesaurus/Model/Index.php#L155-L160
Smile-SA/elasticsuite
src/module-elasticsuite-thesaurus/Model/Index.php
Index.getConfig
private function getConfig(ContainerConfigurationInterface $containerConfig) { $storeId = $containerConfig->getStoreId(); $containerName = $containerConfig->getName(); return $this->thesaurusConfigFactory->create($storeId, $containerName); }
php
private function getConfig(ContainerConfigurationInterface $containerConfig) { $storeId = $containerConfig->getStoreId(); $containerName = $containerConfig->getName(); return $this->thesaurusConfigFactory->create($storeId, $containerName); }
[ "private", "function", "getConfig", "(", "ContainerConfigurationInterface", "$", "containerConfig", ")", "{", "$", "storeId", "=", "$", "containerConfig", "->", "getStoreId", "(", ")", ";", "$", "containerName", "=", "$", "containerConfig", "->", "getName", "(", ...
Load the thesaurus config for the current container. @param ContainerConfigurationInterface $containerConfig Search request container config. @return ThesaurusConfig
[ "Load", "the", "thesaurus", "config", "for", "the", "current", "container", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-thesaurus/Model/Index.php#L195-L201
Smile-SA/elasticsuite
src/module-elasticsuite-thesaurus/Model/Index.php
Index.getSynonymRewrites
private function getSynonymRewrites($storeId, $queryText, $type, $maxRewrites) { $indexName = $this->getIndexAlias($storeId); try { $analysis = $this->client->analyze( ['index' => $indexName, 'body' => ['text' => $queryText, 'analyzer' => $type]] ); }...
php
private function getSynonymRewrites($storeId, $queryText, $type, $maxRewrites) { $indexName = $this->getIndexAlias($storeId); try { $analysis = $this->client->analyze( ['index' => $indexName, 'body' => ['text' => $queryText, 'analyzer' => $type]] ); }...
[ "private", "function", "getSynonymRewrites", "(", "$", "storeId", ",", "$", "queryText", ",", "$", "type", ",", "$", "maxRewrites", ")", "{", "$", "indexName", "=", "$", "this", "->", "getIndexAlias", "(", "$", "storeId", ")", ";", "try", "{", "$", "an...
Generates all possible synonym rewrites for a store and text query. @param integer $storeId Store id. @param string $queryText Text query. @param string $type Substitution type (synonym or expansion). @param integer $maxRewrites Max number of allowed rewrites. @return array
[ "Generates", "all", "possible", "synonym", "rewrites", "for", "a", "store", "and", "text", "query", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-thesaurus/Model/Index.php#L213-L236
Smile-SA/elasticsuite
src/module-elasticsuite-thesaurus/Model/Index.php
Index.combineSynonyms
private function combineSynonyms($queryText, $synonymByPositions, $maxRewrites, $substitutions = 0, $offset = 0) { $combinations = []; if (!empty($synonymByPositions) && $substitutions < $maxRewrites) { $currentPositionSynonyms = current($synonymByPositions); $remainingSynon...
php
private function combineSynonyms($queryText, $synonymByPositions, $maxRewrites, $substitutions = 0, $offset = 0) { $combinations = []; if (!empty($synonymByPositions) && $substitutions < $maxRewrites) { $currentPositionSynonyms = current($synonymByPositions); $remainingSynon...
[ "private", "function", "combineSynonyms", "(", "$", "queryText", ",", "$", "synonymByPositions", ",", "$", "maxRewrites", ",", "$", "substitutions", "=", "0", ",", "$", "offset", "=", "0", ")", "{", "$", "combinations", "=", "[", "]", ";", "if", "(", "...
Combine analysis result to provides all possible synonyms substitution comination. @param string $queryText Original query text @param array $synonymByPositions Synonyms array by positions. @param integer $maxRewrites Max number of allowed rewrites. @param int $substitutions Number of subst...
[ "Combine", "analysis", "result", "to", "provides", "all", "possible", "synonyms", "substitution", "comination", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-thesaurus/Model/Index.php#L249-L281
Smile-SA/elasticsuite
src/module-elasticsuite-thesaurus/Model/Index.php
Index.getWeightedRewrites
private function getWeightedRewrites($queryRewrites, $divider, $baseWeight = 1) { $mapper = function ($substitutions) use ($baseWeight, $divider) { return $baseWeight / ($substitutions * $divider); }; return array_map($mapper, $queryRewrites); }
php
private function getWeightedRewrites($queryRewrites, $divider, $baseWeight = 1) { $mapper = function ($substitutions) use ($baseWeight, $divider) { return $baseWeight / ($substitutions * $divider); }; return array_map($mapper, $queryRewrites); }
[ "private", "function", "getWeightedRewrites", "(", "$", "queryRewrites", ",", "$", "divider", ",", "$", "baseWeight", "=", "1", ")", "{", "$", "mapper", "=", "function", "(", "$", "substitutions", ")", "use", "(", "$", "baseWeight", ",", "$", "divider", ...
Convert number of substitution into search queries boost. @param array $queryRewrites Array of query rewrites. @param int $divider Score divider. @param int $baseWeight Original score. @return array
[ "Convert", "number", "of", "substitution", "into", "search", "queries", "boost", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-thesaurus/Model/Index.php#L292-L299
Smile-SA/elasticsuite
src/module-elasticsuite-thesaurus/Model/Index.php
Index.mbSubstrReplace
private function mbSubstrReplace($string, $replacement, $start, $length = null) { preg_match_all('/./us', $string, $stringChars); preg_match_all('/./us', $replacement, $replacementChars); $length = is_int($length) ? $length : mb_strlen($string); array_splice($stringChars[0], $start, ...
php
private function mbSubstrReplace($string, $replacement, $start, $length = null) { preg_match_all('/./us', $string, $stringChars); preg_match_all('/./us', $replacement, $replacementChars); $length = is_int($length) ? $length : mb_strlen($string); array_splice($stringChars[0], $start, ...
[ "private", "function", "mbSubstrReplace", "(", "$", "string", ",", "$", "replacement", ",", "$", "start", ",", "$", "length", "=", "null", ")", "{", "preg_match_all", "(", "'/./us'", ",", "$", "string", ",", "$", "stringChars", ")", ";", "preg_match_all", ...
Partial implementation of a multi-byte aware version of substr_replace. Required because the tokens offsets used as for parameters start and length are expressed as a number of (UTF-8) characters, independently of the number of bytes. Does not accept arrays as first and second parameters. Source: https://github.com/flu...
[ "Partial", "implementation", "of", "a", "multi", "-", "byte", "aware", "version", "of", "substr_replace", ".", "Required", "because", "the", "tokens", "offsets", "used", "as", "for", "parameters", "start", "and", "length", "are", "expressed", "as", "a", "numbe...
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-thesaurus/Model/Index.php#L316-L324
Smile-SA/elasticsuite
src/module-elasticsuite-core/Index/IndexOperation.php
IndexOperation.isAvailable
public function isAvailable() { try { $isAvailable = $this->client->ping(); } catch (\Exception $e) { $isAvailable = false; } return $isAvailable; }
php
public function isAvailable() { try { $isAvailable = $this->client->ping(); } catch (\Exception $e) { $isAvailable = false; } return $isAvailable; }
[ "public", "function", "isAvailable", "(", ")", "{", "try", "{", "$", "isAvailable", "=", "$", "this", "->", "client", "->", "ping", "(", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "$", "isAvailable", "=", "false", ";", "}",...
{@inheritDoc}
[ "{" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-core/Index/IndexOperation.php#L82-L91
Smile-SA/elasticsuite
src/module-elasticsuite-core/Index/IndexOperation.php
IndexOperation.indexExists
public function indexExists($indexIdentifier, $store) { $exists = true; if (!isset($this->indicesByIdentifier[$indexIdentifier])) { $indexName = $this->indexSettings->getIndexAliasFromIdentifier($indexIdentifier, $store); $exists = $this->client->indexExists($indexName); ...
php
public function indexExists($indexIdentifier, $store) { $exists = true; if (!isset($this->indicesByIdentifier[$indexIdentifier])) { $indexName = $this->indexSettings->getIndexAliasFromIdentifier($indexIdentifier, $store); $exists = $this->client->indexExists($indexName); ...
[ "public", "function", "indexExists", "(", "$", "indexIdentifier", ",", "$", "store", ")", "{", "$", "exists", "=", "true", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "indicesByIdentifier", "[", "$", "indexIdentifier", "]", ")", ")", "{", "$"...
{@inheritDoc}
[ "{" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-core/Index/IndexOperation.php#L96-L106
Smile-SA/elasticsuite
src/module-elasticsuite-core/Index/IndexOperation.php
IndexOperation.getIndexByName
public function getIndexByName($indexIdentifier, $store) { $indexAlias = $this->indexSettings->getIndexAliasFromIdentifier($indexIdentifier, $store); if (!isset($this->indicesByIdentifier[$indexAlias])) { if (!$this->indexExists($indexIdentifier, $store)) { throw new \Lo...
php
public function getIndexByName($indexIdentifier, $store) { $indexAlias = $this->indexSettings->getIndexAliasFromIdentifier($indexIdentifier, $store); if (!isset($this->indicesByIdentifier[$indexAlias])) { if (!$this->indexExists($indexIdentifier, $store)) { throw new \Lo...
[ "public", "function", "getIndexByName", "(", "$", "indexIdentifier", ",", "$", "store", ")", "{", "$", "indexAlias", "=", "$", "this", "->", "indexSettings", "->", "getIndexAliasFromIdentifier", "(", "$", "indexIdentifier", ",", "$", "store", ")", ";", "if", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-core/Index/IndexOperation.php#L111-L125
Smile-SA/elasticsuite
src/module-elasticsuite-core/Index/IndexOperation.php
IndexOperation.createIndex
public function createIndex($indexIdentifier, $store) { $index = $this->initIndex($indexIdentifier, $store, false); $indexSettings = ['settings' => $this->indexSettings->getCreateIndexSettings()]; $indexSettings['settings']['analysis'] = $this->indexSettings->getAnalysisSettings($sto...
php
public function createIndex($indexIdentifier, $store) { $index = $this->initIndex($indexIdentifier, $store, false); $indexSettings = ['settings' => $this->indexSettings->getCreateIndexSettings()]; $indexSettings['settings']['analysis'] = $this->indexSettings->getAnalysisSettings($sto...
[ "public", "function", "createIndex", "(", "$", "indexIdentifier", ",", "$", "store", ")", "{", "$", "index", "=", "$", "this", "->", "initIndex", "(", "$", "indexIdentifier", ",", "$", "store", ",", "false", ")", ";", "$", "indexSettings", "=", "[", "'...
{@inheritDoc}
[ "{" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-core/Index/IndexOperation.php#L130-L144
Smile-SA/elasticsuite
src/module-elasticsuite-core/Index/IndexOperation.php
IndexOperation.installIndex
public function installIndex(\Smile\ElasticsuiteCore\Api\Index\IndexInterface $index, $store) { if ($index->needInstall()) { $indexIdentifier = $index->getIdentifier(); $indexName = $index->getName(); $indexAlias = $this->indexSettings->getIndexAliasFromIdentif...
php
public function installIndex(\Smile\ElasticsuiteCore\Api\Index\IndexInterface $index, $store) { if ($index->needInstall()) { $indexIdentifier = $index->getIdentifier(); $indexName = $index->getName(); $indexAlias = $this->indexSettings->getIndexAliasFromIdentif...
[ "public", "function", "installIndex", "(", "\\", "Smile", "\\", "ElasticsuiteCore", "\\", "Api", "\\", "Index", "\\", "IndexInterface", "$", "index", ",", "$", "store", ")", "{", "if", "(", "$", "index", "->", "needInstall", "(", ")", ")", "{", "$", "i...
{@inheritDoc}
[ "{" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-core/Index/IndexOperation.php#L149-L163
Smile-SA/elasticsuite
src/module-elasticsuite-core/Index/IndexOperation.php
IndexOperation.executeBulk
public function executeBulk(\Smile\ElasticsuiteCore\Api\Index\Bulk\BulkRequestInterface $bulk) { if ($bulk->isEmpty()) { throw new \LogicException('Can not execute empty bulk.'); } $bulkParams = ['body' => $bulk->getOperations()]; $rawBulkResponse = $this->client->bulk(...
php
public function executeBulk(\Smile\ElasticsuiteCore\Api\Index\Bulk\BulkRequestInterface $bulk) { if ($bulk->isEmpty()) { throw new \LogicException('Can not execute empty bulk.'); } $bulkParams = ['body' => $bulk->getOperations()]; $rawBulkResponse = $this->client->bulk(...
[ "public", "function", "executeBulk", "(", "\\", "Smile", "\\", "ElasticsuiteCore", "\\", "Api", "\\", "Index", "\\", "Bulk", "\\", "BulkRequestInterface", "$", "bulk", ")", "{", "if", "(", "$", "bulk", "->", "isEmpty", "(", ")", ")", "{", "throw", "new",...
{@inheritDoc}
[ "{" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-core/Index/IndexOperation.php#L176-L220
Smile-SA/elasticsuite
src/module-elasticsuite-core/Index/IndexOperation.php
IndexOperation.refreshIndex
public function refreshIndex(\Smile\ElasticsuiteCore\Api\Index\IndexInterface $index) { try { $this->client->refreshIndex($index->getName()); } catch (\Exception $e) { $this->logger->error($e->getMessage()); } return $this; }
php
public function refreshIndex(\Smile\ElasticsuiteCore\Api\Index\IndexInterface $index) { try { $this->client->refreshIndex($index->getName()); } catch (\Exception $e) { $this->logger->error($e->getMessage()); } return $this; }
[ "public", "function", "refreshIndex", "(", "\\", "Smile", "\\", "ElasticsuiteCore", "\\", "Api", "\\", "Index", "\\", "IndexInterface", "$", "index", ")", "{", "try", "{", "$", "this", "->", "client", "->", "refreshIndex", "(", "$", "index", "->", "getName...
{@inheritDoc}
[ "{" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-core/Index/IndexOperation.php#L225-L234
Smile-SA/elasticsuite
src/module-elasticsuite-core/Index/IndexOperation.php
IndexOperation.proceedIndexInstall
public function proceedIndexInstall($indexName, $indexAlias) { $aliasActions = [['add' => ['index' => $indexName, 'alias' => $indexAlias]]]; $deletedIndices = []; $oldIndices = $this->client->getIndicesNameByAlias($indexAlias); foreach ($oldIndices as $oldIndexName) { ...
php
public function proceedIndexInstall($indexName, $indexAlias) { $aliasActions = [['add' => ['index' => $indexName, 'alias' => $indexAlias]]]; $deletedIndices = []; $oldIndices = $this->client->getIndicesNameByAlias($indexAlias); foreach ($oldIndices as $oldIndexName) { ...
[ "public", "function", "proceedIndexInstall", "(", "$", "indexName", ",", "$", "indexAlias", ")", "{", "$", "aliasActions", "=", "[", "[", "'add'", "=>", "[", "'index'", "=>", "$", "indexName", ",", "'alias'", "=>", "$", "indexAlias", "]", "]", "]", ";", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-core/Index/IndexOperation.php#L247-L266
Smile-SA/elasticsuite
src/module-elasticsuite-core/Index/IndexOperation.php
IndexOperation.initIndex
private function initIndex($indexIdentifier, $store, $existingIndex) { if (!isset($this->indicesConfiguration[$indexIdentifier])) { throw new \LogicException( "No index found with identifier {$indexIdentifier} into elasticsuite_indices.xml." ); } $ind...
php
private function initIndex($indexIdentifier, $store, $existingIndex) { if (!isset($this->indicesConfiguration[$indexIdentifier])) { throw new \LogicException( "No index found with identifier {$indexIdentifier} into elasticsuite_indices.xml." ); } $ind...
[ "private", "function", "initIndex", "(", "$", "indexIdentifier", ",", "$", "store", ",", "$", "existingIndex", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "indicesConfiguration", "[", "$", "indexIdentifier", "]", ")", ")", "{", "throw", "n...
Init the index object. @param string $indexIdentifier An index indentifier. @param integer|string|\Magento\Store\Api\Data\StoreInterface $store The store. @param boolean $existingIndex Is the index already existing...
[ "Init", "the", "index", "object", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-core/Index/IndexOperation.php#L277-L303
Smile-SA/elasticsuite
src/module-elasticsuite-virtual-category/Model/Product/Search/Request/Container/Filter/CategoryBlacklist.php
CategoryBlacklist.getFilterQuery
public function getFilterQuery() { $query = null; if ($this->searchContext->getCurrentCategory()) { $query = $this->getIsNotBlacklistedQuery((int) $this->searchContext->getCurrentCategory()->getId()); } return $query; }
php
public function getFilterQuery() { $query = null; if ($this->searchContext->getCurrentCategory()) { $query = $this->getIsNotBlacklistedQuery((int) $this->searchContext->getCurrentCategory()->getId()); } return $query; }
[ "public", "function", "getFilterQuery", "(", ")", "{", "$", "query", "=", "null", ";", "if", "(", "$", "this", "->", "searchContext", "->", "getCurrentCategory", "(", ")", ")", "{", "$", "query", "=", "$", "this", "->", "getIsNotBlacklistedQuery", "(", "...
{@inheritDoc}
[ "{" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-virtual-category/Model/Product/Search/Request/Container/Filter/CategoryBlacklist.php#L56-L64
Smile-SA/elasticsuite
src/module-elasticsuite-virtual-category/Model/Product/Search/Request/Container/Filter/CategoryBlacklist.php
CategoryBlacklist.getIsNotBlacklistedQuery
private function getIsNotBlacklistedQuery($value) { $isBlacklisted = $this->queryFactory->create( QueryInterface::TYPE_NESTED, [ 'path' => 'category', 'query' => $this->queryFactory->create( QueryInterface::TYPE_BOOL, ...
php
private function getIsNotBlacklistedQuery($value) { $isBlacklisted = $this->queryFactory->create( QueryInterface::TYPE_NESTED, [ 'path' => 'category', 'query' => $this->queryFactory->create( QueryInterface::TYPE_BOOL, ...
[ "private", "function", "getIsNotBlacklistedQuery", "(", "$", "value", ")", "{", "$", "isBlacklisted", "=", "$", "this", "->", "queryFactory", "->", "create", "(", "QueryInterface", "::", "TYPE_NESTED", ",", "[", "'path'", "=>", "'category'", ",", "'query'", "=...
Create the "is not blacklisted" query according to context parameters. @param int $value The nested query field id value @return \Smile\ElasticsuiteCore\Search\Request\QueryInterface
[ "Create", "the", "is", "not", "blacklisted", "query", "according", "to", "context", "parameters", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-virtual-category/Model/Product/Search/Request/Container/Filter/CategoryBlacklist.php#L73-L100
Smile-SA/elasticsuite
src/module-elasticsuite-virtual-category/Plugin/Catalog/Category/SaveProductsPositions.php
SaveProductsPositions.aroundSave
public function aroundSave( \Magento\Catalog\Model\ResourceModel\Category $categoryResource, \Closure $proceed, \Magento\Framework\Model\AbstractModel $category ) { if ($category->getId() && $category->getSortedProducts()) { $this->unserializeProductPositions($category); ...
php
public function aroundSave( \Magento\Catalog\Model\ResourceModel\Category $categoryResource, \Closure $proceed, \Magento\Framework\Model\AbstractModel $category ) { if ($category->getId() && $category->getSortedProducts()) { $this->unserializeProductPositions($category); ...
[ "public", "function", "aroundSave", "(", "\\", "Magento", "\\", "Catalog", "\\", "Model", "\\", "ResourceModel", "\\", "Category", "$", "categoryResource", ",", "\\", "Closure", "$", "proceed", ",", "\\", "Magento", "\\", "Framework", "\\", "Model", "\\", "A...
Resource model save function plugin. Append a commit callback to save the product positions. @param \Magento\Catalog\Model\ResourceModel\Category $categoryResource Category original resource model. @param \Closure $proceed Original save method. @param \Magento\Framework\Mo...
[ "Resource", "model", "save", "function", "plugin", ".", "Append", "a", "commit", "callback", "to", "save", "the", "product", "positions", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-virtual-category/Plugin/Catalog/Category/SaveProductsPositions.php#L70-L92
Smile-SA/elasticsuite
src/module-elasticsuite-virtual-category/Plugin/Catalog/Category/SaveProductsPositions.php
SaveProductsPositions.getAffectedProductIds
private function getAffectedProductIds($category) { $oldPositionProductIds = array_keys($this->saveHandler->getProductPositionsByCategory($category)); $defaultPositionProductIds = []; $newPositionProductIds = array_keys($category->getSortedProducts()); $oldBlacklistedProduct...
php
private function getAffectedProductIds($category) { $oldPositionProductIds = array_keys($this->saveHandler->getProductPositionsByCategory($category)); $defaultPositionProductIds = []; $newPositionProductIds = array_keys($category->getSortedProducts()); $oldBlacklistedProduct...
[ "private", "function", "getAffectedProductIds", "(", "$", "category", ")", "{", "$", "oldPositionProductIds", "=", "array_keys", "(", "$", "this", "->", "saveHandler", "->", "getProductPositionsByCategory", "(", "$", "category", ")", ")", ";", "$", "defaultPositio...
List of product that have been moved during the save. @param \Magento\Catalog\Model\Category $category Category @return array
[ "List", "of", "product", "that", "have", "been", "moved", "during", "the", "save", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-virtual-category/Plugin/Catalog/Category/SaveProductsPositions.php#L101-L141
Smile-SA/elasticsuite
src/module-elasticsuite-virtual-category/Plugin/Catalog/Category/SaveProductsPositions.php
SaveProductsPositions.unserializeProductPositions
private function unserializeProductPositions(\Magento\Catalog\Model\Category $category) { $productPositions = $category->getSortedProducts() ? $category->getSortedProducts() : []; if (is_string($productPositions)) { try { $productPositions = $this->jsonHelper->jsonDecode...
php
private function unserializeProductPositions(\Magento\Catalog\Model\Category $category) { $productPositions = $category->getSortedProducts() ? $category->getSortedProducts() : []; if (is_string($productPositions)) { try { $productPositions = $this->jsonHelper->jsonDecode...
[ "private", "function", "unserializeProductPositions", "(", "\\", "Magento", "\\", "Catalog", "\\", "Model", "\\", "Category", "$", "category", ")", "{", "$", "productPositions", "=", "$", "category", "->", "getSortedProducts", "(", ")", "?", "$", "category", "...
Unserialize the sorted_products field of category if it is a string value. @param \Magento\Catalog\Model\Category $category Category @return array
[ "Unserialize", "the", "sorted_products", "field", "of", "category", "if", "it", "is", "a", "string", "value", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-virtual-category/Plugin/Catalog/Category/SaveProductsPositions.php#L150-L165
Smile-SA/elasticsuite
src/module-elasticsuite-virtual-category/Plugin/Catalog/Category/DataProviderPlugin.php
DataProviderPlugin.aroundGetData
public function aroundGetData(CategoryDataProvider $dataProvider, \Closure $proceed) { $data = $proceed(); $currentCategory = $dataProvider->getCurrentCategory(); if ($currentCategory->getId() === null || $currentCategory->getLevel() < 2) { $data[$currentCategory->getId()]['use...
php
public function aroundGetData(CategoryDataProvider $dataProvider, \Closure $proceed) { $data = $proceed(); $currentCategory = $dataProvider->getCurrentCategory(); if ($currentCategory->getId() === null || $currentCategory->getLevel() < 2) { $data[$currentCategory->getId()]['use...
[ "public", "function", "aroundGetData", "(", "CategoryDataProvider", "$", "dataProvider", ",", "\\", "Closure", "$", "proceed", ")", "{", "$", "data", "=", "$", "proceed", "(", ")", ";", "$", "currentCategory", "=", "$", "dataProvider", "->", "getCurrentCategor...
Append virtual rule and sorting product data. @param CategoryDataProvider $dataProvider Data provider. @param \Closure $proceed Original method. @return array
[ "Append", "virtual", "rule", "and", "sorting", "product", "data", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-virtual-category/Plugin/Catalog/Category/DataProviderPlugin.php#L80-L115
Smile-SA/elasticsuite
src/module-elasticsuite-virtual-category/Plugin/Catalog/Category/DataProviderPlugin.php
DataProviderPlugin.getProductSorterLoadUrl
private function getProductSorterLoadUrl(Category $category) { $url = null; $storeId = $this->getStoreId($category); if ($storeId) { $urlParams = ['ajax' => true, 'store' => $storeId]; $url = $this->urlBuilder->getUrl('virtualcategory/category_virtual/preview', $url...
php
private function getProductSorterLoadUrl(Category $category) { $url = null; $storeId = $this->getStoreId($category); if ($storeId) { $urlParams = ['ajax' => true, 'store' => $storeId]; $url = $this->urlBuilder->getUrl('virtualcategory/category_virtual/preview', $url...
[ "private", "function", "getProductSorterLoadUrl", "(", "Category", "$", "category", ")", "{", "$", "url", "=", "null", ";", "$", "storeId", "=", "$", "this", "->", "getStoreId", "(", "$", "category", ")", ";", "if", "(", "$", "storeId", ")", "{", "$", ...
Retrieve the category product sorter load URL. @param Category $category Category. @return string|null
[ "Retrieve", "the", "category", "product", "sorter", "load", "URL", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-virtual-category/Plugin/Catalog/Category/DataProviderPlugin.php#L124-L136
Smile-SA/elasticsuite
src/module-elasticsuite-virtual-category/Plugin/Catalog/Category/DataProviderPlugin.php
DataProviderPlugin.getProductSavedPositions
private function getProductSavedPositions(Category $category) { $productPositions = []; if ($category->getId()) { $productPositions = $this->productPositionResource->getProductPositionsByCategory($category); } return json_encode($productPositions, JSON_FORCE_OBJECT); ...
php
private function getProductSavedPositions(Category $category) { $productPositions = []; if ($category->getId()) { $productPositions = $this->productPositionResource->getProductPositionsByCategory($category); } return json_encode($productPositions, JSON_FORCE_OBJECT); ...
[ "private", "function", "getProductSavedPositions", "(", "Category", "$", "category", ")", "{", "$", "productPositions", "=", "[", "]", ";", "if", "(", "$", "category", "->", "getId", "(", ")", ")", "{", "$", "productPositions", "=", "$", "this", "->", "p...
Load product saved positions for the current category. @param Category $category Category. @return array
[ "Load", "product", "saved", "positions", "for", "the", "current", "category", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-virtual-category/Plugin/Catalog/Category/DataProviderPlugin.php#L145-L154
Smile-SA/elasticsuite
src/module-elasticsuite-virtual-category/Plugin/Catalog/Category/DataProviderPlugin.php
DataProviderPlugin.getBlacklistedProducts
private function getBlacklistedProducts(Category $category) { $productIds = $this->productPositionResource->getProductBlacklistByCategory($category); return array_map('intval', $productIds); }
php
private function getBlacklistedProducts(Category $category) { $productIds = $this->productPositionResource->getProductBlacklistByCategory($category); return array_map('intval', $productIds); }
[ "private", "function", "getBlacklistedProducts", "(", "Category", "$", "category", ")", "{", "$", "productIds", "=", "$", "this", "->", "productPositionResource", "->", "getProductBlacklistByCategory", "(", "$", "category", ")", ";", "return", "array_map", "(", "'...
Return list of blacklisted products for the current category. @param Category $category Category. @return array
[ "Return", "list", "of", "blacklisted", "products", "for", "the", "current", "category", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-virtual-category/Plugin/Catalog/Category/DataProviderPlugin.php#L163-L168
Smile-SA/elasticsuite
src/module-elasticsuite-virtual-category/Plugin/Catalog/Category/DataProviderPlugin.php
DataProviderPlugin.getStoreId
private function getStoreId(Category $category) { $storeId = $category->getStoreId(); if ($storeId === 0) { $defaultStoreId = $this->getDefaultStoreId(); $categoryStoreIds = array_filter($category->getStoreIds()); $storeId = current($categoryStoreIds); ...
php
private function getStoreId(Category $category) { $storeId = $category->getStoreId(); if ($storeId === 0) { $defaultStoreId = $this->getDefaultStoreId(); $categoryStoreIds = array_filter($category->getStoreIds()); $storeId = current($categoryStoreIds); ...
[ "private", "function", "getStoreId", "(", "Category", "$", "category", ")", "{", "$", "storeId", "=", "$", "category", "->", "getStoreId", "(", ")", ";", "if", "(", "$", "storeId", "===", "0", ")", "{", "$", "defaultStoreId", "=", "$", "this", "->", ...
Get store id for the current category. @param Category $category Category. @return int
[ "Get", "store", "id", "for", "the", "current", "category", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-virtual-category/Plugin/Catalog/Category/DataProviderPlugin.php#L195-L209
Smile-SA/elasticsuite
src/module-elasticsuite-core/Cluster/ClusterInfo.php
ClusterInfo.getServerVersion
public function getServerVersion() { if ($this->serverVersion === null) { $this->serverVersion = $this->client->info()['version']['number']; } return $this->serverVersion; }
php
public function getServerVersion() { if ($this->serverVersion === null) { $this->serverVersion = $this->client->info()['version']['number']; } return $this->serverVersion; }
[ "public", "function", "getServerVersion", "(", ")", "{", "if", "(", "$", "this", "->", "serverVersion", "===", "null", ")", "{", "$", "this", "->", "serverVersion", "=", "$", "this", "->", "client", "->", "info", "(", ")", "[", "'version'", "]", "[", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-core/Cluster/ClusterInfo.php#L51-L58
Smile-SA/elasticsuite
src/module-elasticsuite-core/Search/Adapter/Elasticsuite/Adapter.php
Adapter.query
public function query(RequestInterface $request) { \Magento\Framework\Profiler::start('ES:Execute Search Query'); try { $searchResponse = $this->doSearch($request); } catch (\Exception $e) { $searchResponse = []; $this->logger->error($e->getMessage()); ...
php
public function query(RequestInterface $request) { \Magento\Framework\Profiler::start('ES:Execute Search Query'); try { $searchResponse = $this->doSearch($request); } catch (\Exception $e) { $searchResponse = []; $this->logger->error($e->getMessage()); ...
[ "public", "function", "query", "(", "RequestInterface", "$", "request", ")", "{", "\\", "Magento", "\\", "Framework", "\\", "Profiler", "::", "start", "(", "'ES:Execute Search Query'", ")", ";", "try", "{", "$", "searchResponse", "=", "$", "this", "->", "doS...
@SuppressWarnings(PHPMD.StaticAccess) {@inheritdoc}
[ "@SuppressWarnings", "(", "PHPMD", ".", "StaticAccess", ")" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-core/Search/Adapter/Elasticsuite/Adapter.php#L77-L91
Smile-SA/elasticsuite
src/module-elasticsuite-core/Search/Adapter/Elasticsuite/Adapter.php
Adapter.doSearch
private function doSearch(RequestInterface $request) { $searchRequest = [ 'index' => $request->getIndex(), 'type' => $request->getType(), 'body' => $this->requestMapper->buildSearchRequest($request), ]; return $this->client->search($searchRequest); ...
php
private function doSearch(RequestInterface $request) { $searchRequest = [ 'index' => $request->getIndex(), 'type' => $request->getType(), 'body' => $this->requestMapper->buildSearchRequest($request), ]; return $this->client->search($searchRequest); ...
[ "private", "function", "doSearch", "(", "RequestInterface", "$", "request", ")", "{", "$", "searchRequest", "=", "[", "'index'", "=>", "$", "request", "->", "getIndex", "(", ")", ",", "'type'", "=>", "$", "request", "->", "getType", "(", ")", ",", "'body...
Execute the search request with ES. @param RequestInterface $request Search request. @return array
[ "Execute", "the", "search", "request", "with", "ES", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-core/Search/Adapter/Elasticsuite/Adapter.php#L100-L109
Smile-SA/elasticsuite
src/module-elasticsuite-catalog/Model/ResourceModel/Product/Indexer/Fulltext/Datasource/CategoryData.php
CategoryData.loadCategoryData
public function loadCategoryData($storeId, $productIds) { $select = $this->getCategoryProductSelect($productIds, $storeId); $categoryData = $this->getConnection()->fetchAll($select); $categoryIds = []; foreach ($categoryData as $categoryDataRow) { $categoryIds[] =...
php
public function loadCategoryData($storeId, $productIds) { $select = $this->getCategoryProductSelect($productIds, $storeId); $categoryData = $this->getConnection()->fetchAll($select); $categoryIds = []; foreach ($categoryData as $categoryDataRow) { $categoryIds[] =...
[ "public", "function", "loadCategoryData", "(", "$", "storeId", ",", "$", "productIds", ")", "{", "$", "select", "=", "$", "this", "->", "getCategoryProductSelect", "(", "$", "productIds", ",", "$", "storeId", ")", ";", "$", "categoryData", "=", "$", "this"...
Load categories data for a list of product ids and a given store. @param integer $storeId Store id. @param array $productIds Product ids list. @return array
[ "Load", "categories", "data", "for", "a", "list", "of", "product", "ids", "and", "a", "given", "store", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog/Model/ResourceModel/Product/Indexer/Fulltext/Datasource/CategoryData.php#L91-L112
Smile-SA/elasticsuite
src/module-elasticsuite-catalog/Model/ResourceModel/Product/Indexer/Fulltext/Datasource/CategoryData.php
CategoryData.getCategoryProductSelect
protected function getCategoryProductSelect($productIds, $storeId) { $select = $this->getConnection()->select() ->from(['cpi' => $this->getTable($this->getCategoryProductIndexTable($storeId))]) ->where('cpi.store_id = ?', $storeId) ->where('cpi.product_id IN(?)', $product...
php
protected function getCategoryProductSelect($productIds, $storeId) { $select = $this->getConnection()->select() ->from(['cpi' => $this->getTable($this->getCategoryProductIndexTable($storeId))]) ->where('cpi.store_id = ?', $storeId) ->where('cpi.product_id IN(?)', $product...
[ "protected", "function", "getCategoryProductSelect", "(", "$", "productIds", ",", "$", "storeId", ")", "{", "$", "select", "=", "$", "this", "->", "getConnection", "(", ")", "->", "select", "(", ")", "->", "from", "(", "[", "'cpi'", "=>", "$", "this", ...
Prepare indexed data select. @param array $productIds Product ids. @param integer $storeId Store id. @return \Zend_Db_Select
[ "Prepare", "indexed", "data", "select", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog/Model/ResourceModel/Product/Indexer/Fulltext/Datasource/CategoryData.php#L122-L130
Smile-SA/elasticsuite
src/module-elasticsuite-catalog/Model/ResourceModel/Product/Indexer/Fulltext/Datasource/CategoryData.php
CategoryData.getCategoryNameAttribute
protected function getCategoryNameAttribute() { $this->categoryNameAttribute = $this->eavConfig->getAttribute(\Magento\Catalog\Model\Category::ENTITY, 'name'); return $this->categoryNameAttribute; }
php
protected function getCategoryNameAttribute() { $this->categoryNameAttribute = $this->eavConfig->getAttribute(\Magento\Catalog\Model\Category::ENTITY, 'name'); return $this->categoryNameAttribute; }
[ "protected", "function", "getCategoryNameAttribute", "(", ")", "{", "$", "this", "->", "categoryNameAttribute", "=", "$", "this", "->", "eavConfig", "->", "getAttribute", "(", "\\", "Magento", "\\", "Catalog", "\\", "Model", "\\", "Category", "::", "ENTITY", "...
Returns category name attribute @return \Magento\Eav\Model\Entity\Attribute\AbstractAttribute
[ "Returns", "category", "name", "attribute" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog/Model/ResourceModel/Product/Indexer/Fulltext/Datasource/CategoryData.php#L137-L142
Smile-SA/elasticsuite
src/module-elasticsuite-catalog/Model/ResourceModel/Product/Indexer/Fulltext/Datasource/CategoryData.php
CategoryData.getUseNameInSearchAttribute
protected function getUseNameInSearchAttribute() { $this->useNameInSearchAttribute = $this->eavConfig ->getAttribute(\Magento\Catalog\Model\Category::ENTITY, 'use_name_in_product_search'); return $this->useNameInSearchAttribute; }
php
protected function getUseNameInSearchAttribute() { $this->useNameInSearchAttribute = $this->eavConfig ->getAttribute(\Magento\Catalog\Model\Category::ENTITY, 'use_name_in_product_search'); return $this->useNameInSearchAttribute; }
[ "protected", "function", "getUseNameInSearchAttribute", "(", ")", "{", "$", "this", "->", "useNameInSearchAttribute", "=", "$", "this", "->", "eavConfig", "->", "getAttribute", "(", "\\", "Magento", "\\", "Catalog", "\\", "Model", "\\", "Category", "::", "ENTITY...
Returns category "use name in product search" attribute @return \Magento\Eav\Model\Entity\Attribute\AbstractAttribute
[ "Returns", "category", "use", "name", "in", "product", "search", "attribute" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog/Model/ResourceModel/Product/Indexer/Fulltext/Datasource/CategoryData.php#L149-L155
Smile-SA/elasticsuite
src/module-elasticsuite-catalog/Model/ResourceModel/Product/Indexer/Fulltext/Datasource/CategoryData.php
CategoryData.loadCategoryNames
private function loadCategoryNames($categoryIds, $storeId) { $loadCategoryIds = $categoryIds; if (isset($this->categoryNameCache[$storeId])) { $loadCategoryIds = array_diff($categoryIds, array_keys($this->categoryNameCache[$storeId])); } $loadCategoryIds = array_map('i...
php
private function loadCategoryNames($categoryIds, $storeId) { $loadCategoryIds = $categoryIds; if (isset($this->categoryNameCache[$storeId])) { $loadCategoryIds = array_diff($categoryIds, array_keys($this->categoryNameCache[$storeId])); } $loadCategoryIds = array_map('i...
[ "private", "function", "loadCategoryNames", "(", "$", "categoryIds", ",", "$", "storeId", ")", "{", "$", "loadCategoryIds", "=", "$", "categoryIds", ";", "if", "(", "isset", "(", "$", "this", "->", "categoryNameCache", "[", "$", "storeId", "]", ")", ")", ...
Add some categories name into the cache of names of categories. @param array $categoryIds Ids of the categories to be added to the cache. @param int $storeId Store Id @return array
[ "Add", "some", "categories", "name", "into", "the", "cache", "of", "names", "of", "categories", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog/Model/ResourceModel/Product/Indexer/Fulltext/Datasource/CategoryData.php#L198-L223
Smile-SA/elasticsuite
src/module-elasticsuite-catalog/Model/ResourceModel/Product/Indexer/Fulltext/Datasource/CategoryData.php
CategoryData.prepareCategoryNameSelect
private function prepareCategoryNameSelect($loadCategoryIds, $storeId) { $rootCategoryId = (int) $this->storeManager->getStore($storeId)->getRootCategoryId(); $this->categoryNameCache[$storeId][$rootCategoryId] = ''; $nameAttr = $this->getCategoryNameAttribute(); $useNameAttr ...
php
private function prepareCategoryNameSelect($loadCategoryIds, $storeId) { $rootCategoryId = (int) $this->storeManager->getStore($storeId)->getRootCategoryId(); $this->categoryNameCache[$storeId][$rootCategoryId] = ''; $nameAttr = $this->getCategoryNameAttribute(); $useNameAttr ...
[ "private", "function", "prepareCategoryNameSelect", "(", "$", "loadCategoryIds", ",", "$", "storeId", ")", "{", "$", "rootCategoryId", "=", "(", "int", ")", "$", "this", "->", "storeManager", "->", "getStore", "(", "$", "storeId", ")", "->", "getRootCategoryId...
Prepare SQL query to retrieve category names @param array $loadCategoryIds Category ids to load name for @param int $storeId The current store Id @return \Magento\Framework\DB\Select
[ "Prepare", "SQL", "query", "to", "retrieve", "category", "names" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-catalog/Model/ResourceModel/Product/Indexer/Fulltext/Datasource/CategoryData.php#L233-L293
Smile-SA/elasticsuite
src/module-elasticsuite-tracker/Model/Event/Processor/OrderItems.php
OrderItems.process
public function process($eventData) { if (isset($eventData['page']['order']['items'])) { $eventData['page']['order']['items'] = array_values($eventData['page']['order']['items']); foreach ($eventData['page']['order']['items'] as &$item) { if (isset($item['category_id...
php
public function process($eventData) { if (isset($eventData['page']['order']['items'])) { $eventData['page']['order']['items'] = array_values($eventData['page']['order']['items']); foreach ($eventData['page']['order']['items'] as &$item) { if (isset($item['category_id...
[ "public", "function", "process", "(", "$", "eventData", ")", "{", "if", "(", "isset", "(", "$", "eventData", "[", "'page'", "]", "[", "'order'", "]", "[", "'items'", "]", ")", ")", "{", "$", "eventData", "[", "'page'", "]", "[", "'order'", "]", "["...
{@inheritDoc}
[ "{" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-tracker/Model/Event/Processor/OrderItems.php#L31-L44
Smile-SA/elasticsuite
src/module-elasticsuite-swatches/Helper/Swatches.php
Swatches.getOptionIds
public function getOptionIds(Attribute $attribute, $labels) { $optionIds = []; if (!is_array($labels)) { $labels = [$labels]; } $options = $attribute->getSource()->getAllOptions(); foreach ($labels as $label) { foreach ($options as $option) { ...
php
public function getOptionIds(Attribute $attribute, $labels) { $optionIds = []; if (!is_array($labels)) { $labels = [$labels]; } $options = $attribute->getSource()->getAllOptions(); foreach ($labels as $label) { foreach ($options as $option) { ...
[ "public", "function", "getOptionIds", "(", "Attribute", "$", "attribute", ",", "$", "labels", ")", "{", "$", "optionIds", "=", "[", "]", ";", "if", "(", "!", "is_array", "(", "$", "labels", ")", ")", "{", "$", "labels", "=", "[", "$", "labels", "]"...
Retrive options ids from a labels array. @param Attribute $attribute Attribute. @param string[] $labels Labels @return integer[]
[ "Retrive", "options", "ids", "from", "a", "labels", "array", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-swatches/Helper/Swatches.php#L83-L102
Smile-SA/elasticsuite
src/module-elasticsuite-swatches/Helper/Swatches.php
Swatches.addFilterByAttributes
protected function addFilterByAttributes(ProductCollection $productCollection, array $attributes) { foreach ($attributes as $code => $option) { if (!is_array($option)) { $option = [$option]; } $productCollection->addAttributeToFilter($code, ['in' => $optio...
php
protected function addFilterByAttributes(ProductCollection $productCollection, array $attributes) { foreach ($attributes as $code => $option) { if (!is_array($option)) { $option = [$option]; } $productCollection->addAttributeToFilter($code, ['in' => $optio...
[ "protected", "function", "addFilterByAttributes", "(", "ProductCollection", "$", "productCollection", ",", "array", "$", "attributes", ")", "{", "foreach", "(", "$", "attributes", "as", "$", "code", "=>", "$", "option", ")", "{", "if", "(", "!", "is_array", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-swatches/Helper/Swatches.php#L107-L115
Smile-SA/elasticsuite
src/module-elasticsuite-swatches/Helper/Swatches.php
Swatches.loadVariationsFromSearchIndex
private function loadVariationsFromSearchIndex(Product $parentProduct, array $attributes) { $documentSource = $parentProduct->getDocumentSource(); $childrenIds = isset($documentSource['children_ids']) ? $documentSource['children_ids'] : []; $variation = false; if (!empty($ch...
php
private function loadVariationsFromSearchIndex(Product $parentProduct, array $attributes) { $documentSource = $parentProduct->getDocumentSource(); $childrenIds = isset($documentSource['children_ids']) ? $documentSource['children_ids'] : []; $variation = false; if (!empty($ch...
[ "private", "function", "loadVariationsFromSearchIndex", "(", "Product", "$", "parentProduct", ",", "array", "$", "attributes", ")", "{", "$", "documentSource", "=", "$", "parentProduct", "->", "getDocumentSource", "(", ")", ";", "$", "childrenIds", "=", "isset", ...
Load variations for a given product with data coming from the search index. @param Product $parentProduct Parent Product @param array $attributes Attributes @return bool|\Magento\Catalog\Api\Data\ProductInterface
[ "Load", "variations", "for", "a", "given", "product", "with", "data", "coming", "from", "the", "search", "index", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-swatches/Helper/Swatches.php#L125-L158
Smile-SA/elasticsuite
src/module-elasticsuite-swatches/Helper/Swatches.php
Swatches.addFilterByParent
private function addFilterByParent(ProductCollection $productCollection, $parentId) { $tableProductRelation = $productCollection->getTable('catalog_product_relation'); $productCollection->getSelect()->join( ['pr' => $tableProductRelation], 'e.entity_id = pr.child_id' ...
php
private function addFilterByParent(ProductCollection $productCollection, $parentId) { $tableProductRelation = $productCollection->getTable('catalog_product_relation'); $productCollection->getSelect()->join( ['pr' => $tableProductRelation], 'e.entity_id = pr.child_id' ...
[ "private", "function", "addFilterByParent", "(", "ProductCollection", "$", "productCollection", ",", "$", "parentId", ")", "{", "$", "tableProductRelation", "=", "$", "productCollection", "->", "getTable", "(", "'catalog_product_relation'", ")", ";", "$", "productColl...
Filter a collection by its parent. Inherited method since it's private in the parent. @param ProductCollection $productCollection Product Collection @param integer $parentId Parent Product Id @return void
[ "Filter", "a", "collection", "by", "its", "parent", ".", "Inherited", "method", "since", "it", "s", "private", "in", "the", "parent", "." ]
train
https://github.com/Smile-SA/elasticsuite/blob/0199ac1383c8db3b996ae3a0963e94edadaf0880/src/module-elasticsuite-swatches/Helper/Swatches.php#L169-L176