idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
43,900 | private function getRootCategoryId ( $ store ) { if ( is_numeric ( $ store ) || is_string ( $ store ) ) { $ store = $ this -> storeManager -> getStore ( $ store ) ; } elseif ( $ store === null ) { $ store = $ this -> storeManager -> getStore ( ) ; } $ storeGroupId = $ store -> getStoreGroupId ( ) ; return $ this -> sto... | Retrieve store root category id . |
43,901 | public function read ( $ scope = null ) { $ scope = $ scope === null ? ContainerScopeInterface :: SCOPE_DEFAULT : $ scope ; if ( $ scope !== ContainerScopeInterface :: SCOPE_DEFAULT ) { throw new \ Magento \ Framework \ Exception \ LocalizedException ( __ ( "Only default scope allowed" ) ) ; } $ config = $ this -> init... | Read configuration data |
43,902 | protected function isSectionAllowed ( $ sectionId ) { $ container = $ this -> getRequest ( ) -> getParam ( 'container' ) ; $ store = $ this -> getRequest ( ) -> getParam ( 'store' ) ; if ( $ store ) { $ this -> backendConfig -> setStore ( $ store ) ; } elseif ( $ container ) { $ this -> backendConfig -> setContainer ( ... | Sets scope for backend config |
43,903 | public function toOptionArray ( ) { return [ [ 'value' => BucketInterface :: SORT_ORDER_COUNT , 'label' => __ ( 'Result count' ) ] , [ 'value' => BucketInterface :: SORT_ORDER_MANUAL , 'label' => __ ( 'Admin sort' ) ] , [ 'value' => BucketInterface :: SORT_ORDER_TERM , 'label' => __ ( 'Name' ) ] , [ 'value' => BucketIn... | Return array of available sort order |
43,904 | public function aroundReindex ( \ Magento \ Catalog \ Model \ Category $ subject , callable $ proceed ) { $ proceed ( ) ; if ( ! empty ( $ subject -> getAffectedProductIds ( ) ) ) { $ this -> processFullTextIndex ( $ subject -> getAffectedProductIds ( ) ) ; } return ; } | Reindex category s products after reindexing the category |
43,905 | public function getData ( ) { if ( $ this -> data === null ) { $ searchRequest = $ this -> searchRequestBuilder -> getRequest ( ) ; $ searchResponse = $ this -> searchEngine -> search ( $ searchRequest ) ; $ this -> data = $ this -> processResponse ( $ searchResponse ) ; } return $ this -> data ; } | Get report data . |
43,906 | public function create ( ContainerConfigurationInterface $ containerConfig , $ queryText , $ spellingType , $ boost = 1 ) { $ query = null ; $ fuzzySpellingTypes = [ SpellcheckerInterface :: SPELLING_TYPE_FUZZY , SpellcheckerInterface :: SPELLING_TYPE_MOST_FUZZY ] ; if ( is_array ( $ queryText ) ) { $ queries = [ ] ; f... | Create the fulltext search query . |
43,907 | private function getCutoffFrequencyQuery ( ContainerConfigurationInterface $ containerConfig , $ queryText ) { $ relevanceConfig = $ containerConfig -> getRelevanceConfig ( ) ; $ queryParams = [ 'fields' => array_fill_keys ( [ MappingInterface :: DEFAULT_SEARCH_FIELD , 'sku' ] , 1 ) , 'queryText' => $ queryText , 'cuto... | Provides a common search query for the searched text . |
43,908 | private function getPureStopwordsQuery ( ContainerConfigurationInterface $ containerConfig , $ queryText , $ boost ) { $ relevanceConfig = $ containerConfig -> getRelevanceConfig ( ) ; $ analyzer = FieldInterface :: ANALYZER_WHITESPACE ; if ( is_string ( $ queryText ) && str_word_count ( $ queryText ) > 1 ) { $ analyze... | Build a query when the fulltext search query contains only stopwords . |
43,909 | private function getSpellcheckedQuery ( ContainerConfigurationInterface $ containerConfig , $ queryText , $ spellingType , $ boost ) { $ query = null ; $ relevanceConfig = $ containerConfig -> getRelevanceConfig ( ) ; $ queryClauses = [ ] ; if ( $ relevanceConfig -> isFuzzinessEnabled ( ) ) { $ queryClauses [ ] = $ thi... | Spellcheked query building . |
43,910 | private function getFuzzyQuery ( ContainerConfigurationInterface $ containerConfig , $ queryText ) { $ relevanceConfig = $ containerConfig -> getRelevanceConfig ( ) ; $ phraseMatchBoost = $ relevanceConfig -> getPhraseMatchBoost ( ) ; $ defaultSearchField = MappingInterface :: DEFAULT_SPELLING_FIELD ; $ standardAnalyze... | Fuzzy query part . |
43,911 | private function getPhoneticQuery ( ContainerConfigurationInterface $ containerConfig , $ queryText ) { $ relevanceConfig = $ containerConfig -> getRelevanceConfig ( ) ; $ analyzer = FieldInterface :: ANALYZER_PHONETIC ; $ defaultSearchField = MappingInterface :: DEFAULT_SPELLING_FIELD ; $ fuzzyFieldFilter = $ this -> ... | Phonentic query part . |
43,912 | private function getWeightedFields ( ContainerConfigurationInterface $ containerConfig , $ analyzer = null , FieldFilterInterface $ fieldFilter = null , $ defaultField = null , $ boost = 1 ) { $ mapping = $ containerConfig -> getMapping ( ) ; return $ mapping -> getWeightedSearchProperties ( $ analyzer , $ defaultField... | Build an array of weighted fields to be searched with the ability to apply a filter callback method and a default field . |
43,913 | public function applyOptimizers ( ContainerConfigurationInterface $ containerConfiguration , QueryInterface $ query ) { $ functions = $ this -> getFunctions ( $ containerConfiguration ) ; if ( isset ( $ this -> filters [ $ containerConfiguration -> getName ( ) ] ) ) { $ optimizerIds = $ this -> filters [ $ containerCon... | Returns query . |
43,914 | private function applyFunctions ( QueryInterface $ query , $ functions = [ ] ) { if ( ! empty ( $ functions ) ) { $ queryParams = [ 'query' => $ query , 'functions' => $ functions , 'scoreMode' => FunctionScore :: SCORE_MODE_MULTIPLY , 'boostMode' => FunctionScore :: BOOST_MODE_MULTIPLY , ] ; $ query = $ this -> queryF... | Apply boost functions to a given query . |
43,915 | private function getOptimizersFunctions ( ContainerConfigurationInterface $ containerConfiguration , $ optimizers ) { $ functions = [ ] ; foreach ( $ optimizers as $ optimizer ) { $ function = $ this -> getFunction ( $ containerConfiguration , $ optimizer ) ; if ( $ function !== null ) { $ functions [ $ optimizer -> ge... | Retrieve optimizers functions for a given container |
43,916 | private function addVirtualCategoryData ( CategoryInterface $ category ) { $ isVirtualCategory = ( bool ) $ this -> getRequest ( ) -> getParam ( 'is_virtual_category' ) ; $ category -> setIsVirtualCategory ( $ isVirtualCategory ) ; if ( $ isVirtualCategory ) { $ category -> getVirtualRule ( ) -> loadPost ( $ this -> ge... | Append virtual rule params to the category . |
43,917 | private function addSelectedProducts ( CategoryInterface $ category ) { $ selectedProducts = $ this -> getRequest ( ) -> getParam ( 'selected_products' , [ ] ) ; $ addedProducts = isset ( $ selectedProducts [ 'added_products' ] ) ? $ selectedProducts [ 'added_products' ] : [ ] ; $ category -> setAddedProductIds ( $ add... | Add user selected products . |
43,918 | private function setSortedProducts ( CategoryInterface $ category ) { $ productPositions = $ this -> getRequest ( ) -> getParam ( 'product_position' , [ ] ) ; $ category -> setSortedProductIds ( array_keys ( $ productPositions ) ) ; return $ this ; } | Append products sorted by the user to the category . |
43,919 | private function joinStorePosition ( \ Magento \ Framework \ Db \ Select & $ select , $ storeId , $ useStorePositionsValue ) { $ useStorePositionsAttr = $ this -> getUseStorePositionsAttribute ( ) ; if ( $ useStorePositionsAttr && $ useStorePositionsAttr -> getAttributeId ( ) ) { $ linkField = $ this -> getEntityMetaDa... | Process left join on a select to the use_store_positions attribute backend table . |
43,920 | private function getUseStorePositionsAttribute ( ) { $ this -> useStorePositionsAttribute = $ this -> getEavConfig ( ) -> getAttribute ( \ Magento \ Catalog \ Model \ Category :: ENTITY , 'use_store_positions' ) ; return $ this -> useStorePositionsAttribute ; } | Returns category attribute use store positions |
43,921 | private function getRangeCondition ( $ bounds ) { $ customerGroupId = $ this -> customerSession -> getCustomerGroupId ( ) ; $ priceQuery = $ this -> queryFactory -> create ( QueryInterface :: TYPE_NESTED , [ 'path' => 'price' , 'query' => $ this -> queryFactory -> create ( QueryInterface :: TYPE_BOOL , [ 'must' => [ $ ... | Create the proper query filter for price according to current customer group Id . |
43,922 | public function buildAggregations ( array $ buckets = [ ] ) { $ aggregations = [ ] ; foreach ( $ buckets as $ bucket ) { $ bucketType = $ bucket -> getType ( ) ; $ builder = $ this -> getBuilder ( $ bucketType ) ; $ aggregation = $ builder -> buildBucket ( $ bucket ) ; $ subAggregations = $ aggregation [ 'aggregations'... | Build ES aggregations from search request buckets . |
43,923 | private function getBuilder ( $ bucketType ) { if ( ! isset ( $ this -> builders [ $ bucketType ] ) ) { throw new \ InvalidArgumentException ( "No builder found for aggregation type {$bucketType}." ) ; } return $ this -> builders [ $ bucketType ] ; } | Retrieve the builder used to convert a bucket into ES aggregation . |
43,924 | private function getPipelineBuilder ( $ pipelineType ) { if ( ! isset ( $ this -> pipelineBuilders [ $ pipelineType ] ) ) { throw new \ InvalidArgumentException ( "No builder found for pipeline aggregation type {$pipelineType}." ) ; } return $ this -> pipelineBuilders [ $ pipelineType ] ; } | Retrieve the builder used to convert a pipeline into an ES aggregation . |
43,925 | protected function loadAttributesRawData ( $ storeId , array $ entityIds , $ tableName , array $ attributeIds ) { return $ this -> resourceModel -> getAttributesRawData ( $ storeId , $ entityIds , $ tableName , $ attributeIds ) ; } | Load attribute data from the database . |
43,926 | private function initAttributes ( ) { $ attributeCollection = $ this -> attributeHelper -> getAttributeCollection ( ) ; $ this -> resourceModel -> addIndexedFilterToAttributeCollection ( $ attributeCollection ) ; foreach ( $ attributeCollection as $ attribute ) { if ( $ this -> canIndexAttribute ( $ attribute ) ) { $ a... | Init attributes used into ES . |
43,927 | private function canIndexAttribute ( AttributeInterface $ attribute ) { $ canIndex = $ attribute -> getBackendType ( ) != 'static' && $ attribute -> getAttributeCode ( ) !== 'price' ; if ( $ canIndex && $ attribute -> getBackendModel ( ) ) { foreach ( $ this -> indexedBackendModels as $ indexedBackendModel ) { $ canInd... | Check if an attribute can be indexed . |
43,928 | private function initField ( AttributeInterface $ attribute ) { $ fieldName = $ attribute -> getAttributeCode ( ) ; $ fieldConfig = $ this -> attributeHelper -> getMappingFieldOptions ( $ attribute ) ; if ( $ attribute -> usesSource ( ) ) { $ optionFieldName = $ this -> attributeHelper -> getOptionTextFieldName ( $ fie... | Create a mapping field from an attribute . |
43,929 | private function getSuggestCollection ( ) { $ queryCollection = $ this -> queryFactory -> get ( ) -> getSuggestCollection ( ) ; $ queryCollection -> addFieldToFilter ( 'is_spellchecked' , 'false' ) -> setPageSize ( $ this -> getResultsPageSize ( ) ) ; return $ queryCollection ; } | Retrieve suggest collection for query |
43,930 | public function saveSearchResults ( QueryModel $ query ) { $ adapter = $ this -> getConnection ( ) ; $ table = $ this -> getMainTable ( ) ; $ numResults = $ query -> getNumResults ( ) ; $ isSpellchecked = ( int ) $ query -> getIsSpellchecked ( ) ; $ saveData = [ 'store_id' => $ query -> getStoreId ( ) , 'query_text' =>... | Save query with number of results and is spellchecked . |
43,931 | public function addData ( $ storeId , array $ indexData ) { $ categoryData = $ this -> resourceModel -> loadCategoryData ( $ storeId , array_keys ( $ indexData ) ) ; foreach ( $ categoryData as $ categoryDataRow ) { $ productId = ( int ) $ categoryDataRow [ 'product_id' ] ; unset ( $ categoryDataRow [ 'product_id' ] ) ... | Add categories data to the index data . |
43,932 | public function buildSordOrders ( ContainerConfigurationInterface $ containerConfig , array $ orders ) { $ sortOrders = [ ] ; $ mapping = $ containerConfig -> getMapping ( ) ; $ orders = $ this -> addDefaultSortOrders ( $ orders , $ mapping ) ; foreach ( $ orders as $ fieldName => $ sortOrderParams ) { $ factory = $ th... | Build sort orders from array of sort orders definition . |
43,933 | private function addDefaultSortOrders ( $ orders , MappingInterface $ mapping ) { $ defaultOrders = [ SortOrderInterface :: DEFAULT_SORT_FIELD => SortOrderInterface :: SORT_DESC , $ mapping -> getIdField ( ) -> getName ( ) => SortOrderInterface :: SORT_DESC , ] ; if ( count ( $ orders ) > 0 ) { $ firstOrder = current (... | Append default sort to all queries to get fully predictable search results . |
43,934 | private function getSortOrderParams ( FieldInterface $ field , array $ sortOrderParams ) { $ sortOrderParams [ 'field' ] = $ field -> getMappingProperty ( FieldInterface :: ANALYZER_SORTABLE ) ; $ sortOrderParams [ 'missing' ] = $ field -> getSortMissing ( $ sortOrderParams [ 'direction' ] ) ; if ( $ field -> isNested ... | Retrieve base params for a sort order field . |
43,935 | public function execute ( ) { $ current = $ this -> getRequest ( ) -> getParam ( 'section' ) ; $ container = $ this -> getRequest ( ) -> getParam ( 'container' ) ; $ store = $ this -> getRequest ( ) -> getParam ( 'store' ) ; $ section = $ this -> configStructure -> getElement ( $ current ) ; if ( $ current && ! $ secti... | Edit configuration section |
43,936 | public function getFacetedData ( $ field ) { $ this -> _renderFilters ( ) ; $ result = [ ] ; $ aggregations = $ this -> queryResponse -> getAggregations ( ) ; $ bucket = $ aggregations -> getBucket ( $ field ) ; if ( $ bucket ) { foreach ( $ bucket -> getValues ( ) as $ value ) { $ metrics = $ value -> getMetrics ( ) ;... | Return field faceted data from faceted search result . |
43,937 | public function addSortFilterParameters ( $ sortName , $ sortField , $ nestedPath = null , $ nestedFilter = null ) { $ sortParams = [ ] ; if ( isset ( $ this -> _productLimitationFilters [ 'sortParams' ] ) ) { $ sortParams = $ this -> _productLimitationFilters [ 'sortParams' ] ; } $ sortParams [ $ sortName ] = [ 'sortF... | Set param for a sort order . |
43,938 | private function prepareRequest ( ) { $ storeId = $ this -> getStoreId ( ) ; $ searchRequestName = $ this -> searchRequestName ; $ size = $ this -> _pageSize ? $ this -> _pageSize : 0 ; $ from = $ size * ( max ( 1 , $ this -> _curPage ) - 1 ) ; $ sortOrders = $ this -> prepareSortOrders ( ) ; $ searchRequest = $ this -... | Prepare the search request before it will be executed . |
43,939 | protected function _prepareForm ( ) { $ form = $ this -> _formFactory -> create ( [ 'data' => [ 'id' => 'edit_form' , 'action' => $ this -> getData ( 'action' ) ] ] ) ; $ thesaurusTypes = [ [ 'value' => ThesaurusInterface :: TYPE_SYNONYM , 'label' => __ ( 'Synonym' ) ] , [ 'value' => ThesaurusInterface :: TYPE_EXPANSIO... | Prepare form fields |
43,940 | private function getFilterArray ( array $ request , \ Magento \ Catalog \ Model \ Product $ product ) { $ filterArray = [ ] ; $ attributes = $ this -> eavConfig -> getEntityAttributes ( \ Magento \ Catalog \ Model \ Product :: ENTITY , $ product ) ; foreach ( $ request as $ code => $ value ) { if ( array_key_exists ( $... | Get filters from request and replace labels by option ids . |
43,941 | private function getBaseSelect ( $ storeId , $ type ) { $ connection = $ this -> getConnection ( ) ; $ select = $ connection -> select ( ) ; $ select -> from ( [ 'thesaurus' => $ this -> getMainTable ( ) ] , [ ] ) -> join ( [ 'terms' => $ this -> getTable ( ThesaurusInterface :: EXPANSION_TABLE_NAME ) ] , 'thesaurus.th... | Base select for thesaurus terms select by store id . |
43,942 | public function getFullTextQuery ( $ containerConfiguration , $ queryText ) { $ spellingType = $ this -> getSpellingType ( $ containerConfiguration , $ queryText ) ; $ query = $ this -> createFullTextQuery ( $ containerConfiguration , $ queryText , $ spellingType ) ; $ filterQuery = $ this -> queryBuilder -> createFilt... | Retrieve Fulltext search Query for a given query Text |
43,943 | public function execute ( ) { $ resultRedirect = $ this -> resultRedirectFactory -> create ( ) ; $ data = $ this -> getRequest ( ) -> getPostValue ( ) ; $ redirectBack = $ this -> getRequest ( ) -> getParam ( 'back' , false ) ; if ( $ data ) { $ identifier = $ this -> getRequest ( ) -> getParam ( 'thesaurus_id' ) ; $ m... | Save a Thesaurus |
43,944 | private function checkAnalyzer ( $ property , $ expectedAnalyzer ) { $ isAnalyzerCorrect = true ; if ( $ property [ 'type' ] == self :: FIELD_TYPE_TEXT || $ property [ 'type' ] == self :: FIELD_TYPE_KEYWORD ) { $ isAnalyzed = $ expectedAnalyzer !== self :: ANALYZER_UNTOUCHED ; if ( $ isAnalyzed && ( ! isset ( $ propert... | Check if an ES property as the right analyzer . |
43,945 | private function getMultiFieldMappingPropertyConfig ( $ analyzers ) { $ property = [ ] ; foreach ( $ analyzers as $ analyzer ) { if ( $ analyzer == $ this -> getDefaultSearchAnalyzer ( ) ) { $ property = array_merge ( $ property , $ this -> getPropertyConfig ( $ analyzer ) ) ; } else { $ property [ 'fields' ] [ $ analy... | Build a multi_field configuration from an analyzers list . Standard analyzer is used as default subfield and should always be present . |
43,946 | private function getFieldAnalyzers ( ) { $ analyzers = [ ] ; if ( $ this -> isSearchable ( ) || $ this -> isUsedForSortBy ( ) ) { $ analyzers = [ $ this -> getDefaultSearchAnalyzer ( ) ] ; if ( $ this -> isSearchable ( ) && $ this -> getSearchWeight ( ) > 1 ) { $ analyzers [ ] = self :: ANALYZER_WHITESPACE ; $ analyzer... | Retrieve analyzers used with the current field depending of the field configuration . |
43,947 | public function getRequest ( \ Magento \ Framework \ Api \ Search \ SearchCriteriaInterface $ searchCriteria ) { $ storeId = $ this -> getCurrentStoreId ( ) ; $ containerName = $ searchCriteria -> getRequestName ( ) ; $ containerConfiguration = $ this -> getSearchContainerConfiguration ( $ storeId , $ containerName ) ;... | Build a search request from a search criteria . |
43,948 | private function updateSearchContext ( $ storeId , $ queryText ) { $ this -> searchContext -> setStoreId ( $ storeId ) ; $ query = $ this -> queryFactory -> create ( ) ; $ query -> setStoreId ( $ storeId ) ; $ query -> loadByQueryText ( $ queryText ) ; if ( $ query -> getId ( ) ) { $ this -> searchContext -> setCurrent... | Update the search context using current store id and query text . |
43,949 | private function getCurrentStoreId ( ) { $ storeId = $ this -> storeManager -> getStore ( ) -> getId ( ) ; if ( $ storeId == 0 ) { $ storeId = $ this -> storeManager -> getDefaultStoreView ( ) -> getId ( ) ; } return $ storeId ; } | Return current store id . |
43,950 | private function getFulltextFilter ( \ Magento \ Framework \ Api \ Search \ SearchCriteriaInterface $ searchCriteria ) { $ queryText = null ; foreach ( $ searchCriteria -> getFilterGroups ( ) as $ filterGroup ) { foreach ( $ filterGroup -> getFilters ( ) as $ filter ) { if ( $ filter -> getField ( ) == "search_term" ) ... | Extract fulltext search query from search criteria . |
43,951 | public function create ( $ rawDocument ) { $ entityIdFieldName = $ this -> entityMetadata -> getEntityId ( ) ; $ rawDocument [ Document :: ID ] = $ rawDocument [ $ entityIdFieldName ] ; return $ this -> objectManager -> create ( $ this -> instanceName , [ 'data' => $ rawDocument ] ) ; } | Create search dcument instance from a ES hit . |
43,952 | public function getFeedUrl ( ) { if ( $ this -> _feedUrl === null ) { $ httpPath = $ this -> _backendConfig -> isSetFlag ( self :: XML_USE_HTTPS_PATH ) ? 'https://' : 'http://' ; $ this -> _feedUrl = $ httpPath . self :: ELASTICSUITE_FEED_URL ; } return $ this -> _feedUrl ; } | Retrieve feed url |
43,953 | public function afterAddProduct ( Quote $ subject , $ result ) { try { if ( $ result instanceof \ Magento \ Quote \ Model \ Quote \ Item ) { $ product = $ result -> getProduct ( ) ; if ( $ product !== null ) { $ this -> logEvent ( $ product -> getId ( ) , $ product -> getStoreId ( ) ) ; } } } catch ( \ Exception $ e ) ... | Log add to cart events into the event queue . |
43,954 | protected function _construct ( ) { $ this -> addColumn ( 'term_id' , [ 'label' => '' ] ) ; $ this -> addColumn ( 'values' , [ 'label' => __ ( 'Synonym terms' ) ] ) ; $ this -> _addAfter = false ; $ this -> _addButtonLabel = __ ( 'Add Synonym' ) ; parent :: _construct ( ) ; } | Initialise form fields |
43,955 | 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 \ ... | Get Data sources of a given index . |
43,956 | protected function _prepareForm ( ) { $ model = $ this -> getModel ( ) ; $ form = $ this -> _formFactory -> create ( [ 'data' => [ 'id' => 'edit_form' , 'action' => $ this -> getData ( 'action' ) , 'method' => 'post' ] ] ) ; $ fieldset = $ form -> addFieldset ( 'base_fieldset' , [ 'legend' => __ ( 'General Information'... | Prepare form fields . |
43,957 | private function addExpansionFields ( $ fieldset , $ model ) { $ form = $ fieldset -> getForm ( ) ; $ bagRenderer = $ this -> getLayout ( ) -> createBlock ( 'Smile\ElasticsuiteThesaurus\Block\Adminhtml\Thesaurus\Renderer\Expansions' ) -> setForm ( $ fieldset -> getForm ( ) ) ; $ fieldset = $ form -> addFieldset ( 'bag_... | Adding expansion - related fields |
43,958 | public function getSessionData ( $ storeId , $ sessionIds ) { $ data = [ ] ; $ searchRequest = $ this -> getSearchRequest ( $ storeId , $ sessionIds ) ; $ searchResponse = $ this -> searchEngine -> search ( $ searchRequest ) ; foreach ( $ searchResponse -> getAggregations ( ) -> getBucket ( 'session_id' ) -> getValues ... | Retrieve session data to be indexed . |
43,959 | private function getSearchRequest ( $ storeId , $ sessionIds ) { $ queryFilters = [ 'session.uid' => $ sessionIds ] ; return $ this -> searchRequestBuilder -> create ( $ storeId , self :: SEARCH_REQUEST_CONTAINER , 0 , 0 , null , [ ] , [ ] , $ queryFilters ) ; } | Build search request used to collect aggregated session data . |
43,960 | 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 ( ) ; $ buc... | Prepare session data from search aggregation response . |
43,961 | private function getUrl ( array $ data ) { $ urlParams = [ 'q' => $ data [ 'value' ] , $ data [ 'attribute_code' ] => $ data [ 'value' ] ] ; return $ this -> urlBuilder -> getUrl ( 'catalogsearch/result' , [ '_query' => $ urlParams ] ) ; } | Returns autocompelete result URL . |
43,962 | 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 ( $ cleanCache ) { $ this -> indice... | Invalidate indices config after attribute is modified . |
43,963 | public function aroundReindex ( \ Magento \ Catalog \ Model \ Category $ category , \ Closure $ proceed ) { $ proceed ( ) ; if ( $ category -> dataHasChangedFor ( 'is_virtual_category' ) && ( $ category -> getIsChangedProductList ( ) === true ) ) { if ( ( ( bool ) $ category -> getIsVirtualCategory ( ) === true ) && ( ... | Enforce reindexing of path ids if the category has just been set to is_virtual_category = true . |
43,964 | public function validateData ( \ Magento \ Framework \ DataObject $ dataObject ) { $ result = [ ] ; $ fromDate = $ toDate = null ; if ( $ dataObject -> hasFromDate ( ) && $ dataObject -> hasToDate ( ) ) { $ fromDate = $ dataObject -> getFromDate ( ) ; $ toDate = $ dataObject -> getToDate ( ) ; } if ( $ fromDate && $ to... | Validate optimizer data |
43,965 | 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 ( $ dateField ) && is_string ( $ this -> getData ... | Parse date related fields |
43,966 | 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' ] ) ; $ virtualRule = $ this -> getV... | Create the form containing the virtual rule field . |
43,967 | public function buildPipeline ( PipelineInterface $ pipeline ) { if ( $ pipeline -> getType ( ) !== PipelineInterface :: TYPE_BUCKET_SELECTOR ) { throw new \ InvalidArgumentException ( "Query builder : invalid aggregation type {$pipeline->getType()}." ) ; } $ aggParams = [ 'buckets_path' => $ pipeline -> getBucketsPath... | Build the pipeline aggregation . |
43,968 | private function getMetrics ( ) { $ metrics = [ $ this -> metricFactory -> create ( [ 'name' => 'unique_sessions' , 'field' => 'session.uid' , 'type' => MetricInterface :: TYPE_CARDINALITY ] ) , $ this -> metricFactory -> create ( [ 'name' => 'unique_visitors' , 'field' => 'session.vid' , 'type' => MetricInterface :: T... | Return metrics aggregations to apply to the main bucket aggregation |
43,969 | public function getIndex ( $ indexIdentifier , $ storeId , $ date ) { $ indexName = $ indexIdentifier ; try { $ indexAlias = $ this -> indexManager -> getIndexAlias ( $ indexIdentifier , $ storeId ) ; $ indexName = $ this -> indexManager -> getIndexName ( $ indexIdentifier , $ storeId , $ date ) ; if ( ! isset ( $ this... | Get index by identifier store and date . |
43,970 | public function getAttributeAutocompleteField ( \ Magento \ Catalog \ Api \ Data \ ProductAttributeInterface $ attribute ) { return $ this -> attributeHelper -> getFilterField ( $ attribute ) ; } | ES field used in attribute autocomplete . |
43,971 | 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 ( $ docSource [ $ field ] ) : $ do... | Return the ES source document for the current product . |
43,972 | 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 ( ) ; } | Retrieve product small image |
43,973 | public function create ( ContainerConfigurationInterface $ containerConfig , array $ filters , $ currentPath = null ) { $ queries = [ ] ; $ mapping = $ containerConfig -> getMapping ( ) ; foreach ( $ filters as $ fieldName => $ condition ) { if ( $ condition instanceof QueryInterface ) { $ queries [ ] = $ condition ; }... | Prepare filter condition from an array as used into addFieldToFilter . |
43,974 | 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 = Query... | Transform the condition into a search request query object . |
43,975 | private function prepareCondition ( $ condition ) { if ( ! is_array ( $ condition ) ) { $ condition = [ 'in' => [ $ condition ] ] ; } $ conditionKeys = array_keys ( $ condition ) ; if ( is_integer ( current ( $ conditionKeys ) ) ) { $ condition = [ 'in' => $ condition ] ; } foreach ( $ condition as $ key => $ value ) {... | Ensure the condition is supported and try to tranform it into a supported type . |
43,976 | public function getSearchQuery ( ProductCondition $ productCondition ) { $ query = null ; $ query = $ this -> getSpecialAttributesSearchQuery ( $ productCondition ) ; if ( $ query === null && ! empty ( $ productCondition -> getValue ( ) ) ) { $ this -> prepareFieldValue ( $ productCondition ) ; $ queryType = QueryInter... | Build the query for a condition . |
43,977 | private function getSpecialAttributesSearchQuery ( ProductCondition $ productCondition ) { $ query = null ; if ( $ productCondition -> getAttribute ( ) === 'sku' ) { $ queryParams = [ ] ; $ fieldName = $ this -> getSearchFieldName ( $ productCondition ) ; foreach ( explode ( ',' , $ productCondition -> getValue ( ) ) a... | Create a query for special attribute . |
43,978 | private function getMatchQueryParams ( ProductCondition $ productCondition ) { $ fieldName = $ this -> getSearchFieldName ( $ productCondition ) ; $ queryText = $ productCondition -> getValue ( ) ; $ minimumShouldMatch = "100%" ; return [ 'field' => $ fieldName , 'queryText' => $ queryText , 'minimumShouldMatch' => $ m... | Retrieve params for a match query from condition . |
43,979 | private function getRangeQueryParams ( ProductCondition $ productCondition ) { $ fieldName = $ this -> getSearchFieldName ( $ productCondition ) ; $ operator = $ productCondition -> getOperator ( ) ; $ value = $ productCondition -> getValue ( ) ; switch ( $ operator ) { case '>' : $ operator = 'gt' ; break ; case '>=' ... | Retrieve params for a range query from condition . |
43,980 | private function getTermsQueryParams ( ProductCondition $ productCondition ) { $ field = $ this -> getSearchField ( $ productCondition ) ; $ fieldName = $ this -> getSearchFieldName ( $ productCondition ) ; $ values = $ productCondition -> getValue ( ) ; if ( ! is_array ( $ values ) && in_array ( $ productCondition -> ... | Retrieve params for a terms query from condition . |
43,981 | private function getSearchField ( ProductCondition $ productCondition ) { $ field = $ this -> attributeList -> getField ( $ productCondition -> getAttribute ( ) ) ; return $ field ; } | Retrieve ES mapping field for the current condition . |
43,982 | private function prepareFieldValue ( ProductCondition $ productCondition ) { $ value = $ productCondition -> getValue ( ) ; if ( is_array ( $ value ) ) { $ value = array_filter ( $ value ) ; } $ productCondition -> setValue ( $ value ) ; return $ this ; } | Update the condition value to ignore empty array items . |
43,983 | public function resolve ( $ scopeType , $ scopeCode ) { if ( isset ( $ this -> resolvedScopeCodes [ $ scopeType ] [ $ scopeCode ] ) ) { return $ this -> resolvedScopeCodes [ $ scopeType ] [ $ scopeCode ] ; } $ resolverScopeCode = $ scopeCode ; if ( ( $ scopeCode === null || is_numeric ( $ scopeCode ) ) && $ scopeType !... | Resolve scope code |
43,984 | public function getQueryRewrites ( ContainerConfigurationInterface $ containerConfig , $ queryText ) { $ cacheKey = $ this -> getCacheKey ( $ containerConfig , $ queryText ) ; $ cacheTags = $ this -> getCacheTags ( $ containerConfig ) ; $ queryRewrites = $ this -> cacheHelper -> loadCache ( $ cacheKey ) ; if ( $ queryR... | Provides weigthed rewrites for the query . |
43,985 | private function computeQueryRewrites ( ContainerConfigurationInterface $ containerConfig , $ queryText ) { $ config = $ this -> getConfig ( $ containerConfig ) ; $ storeId = $ containerConfig -> getStoreId ( ) ; $ rewrites = [ ] ; $ maxRewrites = $ config -> getMaxRewrites ( ) ; if ( $ config -> isSynonymSearchEnabled... | Compute weigthed rewrites for the query . |
43,986 | private function getCacheKey ( ContainerConfigurationInterface $ containerConfig , $ queryText ) { $ tags = $ this -> getCacheTags ( $ containerConfig ) ; return implode ( '|' , array_merge ( $ tags , [ $ queryText ] ) ) ; } | Returns the cache key of the query . |
43,987 | private function getConfig ( ContainerConfigurationInterface $ containerConfig ) { $ storeId = $ containerConfig -> getStoreId ( ) ; $ containerName = $ containerConfig -> getName ( ) ; return $ this -> thesaurusConfigFactory -> create ( $ storeId , $ containerName ) ; } | Load the thesaurus config for the current container . |
43,988 | private function getSynonymRewrites ( $ storeId , $ queryText , $ type , $ maxRewrites ) { $ indexName = $ this -> getIndexAlias ( $ storeId ) ; try { $ analysis = $ this -> client -> analyze ( [ 'index' => $ indexName , 'body' => [ 'text' => $ queryText , 'analyzer' => $ type ] ] ) ; } catch ( \ Exception $ e ) { $ an... | Generates all possible synonym rewrites for a store and text query . |
43,989 | private function combineSynonyms ( $ queryText , $ synonymByPositions , $ maxRewrites , $ substitutions = 0 , $ offset = 0 ) { $ combinations = [ ] ; if ( ! empty ( $ synonymByPositions ) && $ substitutions < $ maxRewrites ) { $ currentPositionSynonyms = current ( $ synonymByPositions ) ; $ remainingSynonyms = array_sl... | Combine analysis result to provides all possible synonyms substitution comination . |
43,990 | private function getWeightedRewrites ( $ queryRewrites , $ divider , $ baseWeight = 1 ) { $ mapper = function ( $ substitutions ) use ( $ baseWeight , $ divider ) { return $ baseWeight / ( $ substitutions * $ divider ) ; } ; return array_map ( $ mapper , $ queryRewrites ) ; } | Convert number of substitution into search queries boost . |
43,991 | private function initIndex ( $ indexIdentifier , $ store , $ existingIndex ) { if ( ! isset ( $ this -> indicesConfiguration [ $ indexIdentifier ] ) ) { throw new \ LogicException ( "No index found with identifier {$indexIdentifier} into elasticsuite_indices.xml." ) ; } $ indexSettings = $ this -> indexSettings ; $ ind... | Init the index object . |
43,992 | private function getIsNotBlacklistedQuery ( $ value ) { $ isBlacklisted = $ this -> queryFactory -> create ( QueryInterface :: TYPE_NESTED , [ 'path' => 'category' , 'query' => $ this -> queryFactory -> create ( QueryInterface :: TYPE_BOOL , [ 'must' => [ $ this -> queryFactory -> create ( QueryInterface :: TYPE_TERM ,... | Create the is not blacklisted query according to context parameters . |
43,993 | public function aroundSave ( \ Magento \ Catalog \ Model \ ResourceModel \ Category $ categoryResource , \ Closure $ proceed , \ Magento \ Framework \ Model \ AbstractModel $ category ) { if ( $ category -> getId ( ) && $ category -> getSortedProducts ( ) ) { $ this -> unserializeProductPositions ( $ category ) ; if ( ... | Resource model save function plugin . Append a commit callback to save the product positions . |
43,994 | private function getAffectedProductIds ( $ category ) { $ oldPositionProductIds = array_keys ( $ this -> saveHandler -> getProductPositionsByCategory ( $ category ) ) ; $ defaultPositionProductIds = [ ] ; $ newPositionProductIds = array_keys ( $ category -> getSortedProducts ( ) ) ; $ oldBlacklistedProductIds = array_v... | List of product that have been moved during the save . |
43,995 | private function unserializeProductPositions ( \ Magento \ Catalog \ Model \ Category $ category ) { $ productPositions = $ category -> getSortedProducts ( ) ? $ category -> getSortedProducts ( ) : [ ] ; if ( is_string ( $ productPositions ) ) { try { $ productPositions = $ this -> jsonHelper -> jsonDecode ( $ productP... | Unserialize the sorted_products field of category if it is a string value . |
43,996 | public function aroundGetData ( CategoryDataProvider $ dataProvider , \ Closure $ proceed ) { $ data = $ proceed ( ) ; $ currentCategory = $ dataProvider -> getCurrentCategory ( ) ; if ( $ currentCategory -> getId ( ) === null || $ currentCategory -> getLevel ( ) < 2 ) { $ data [ $ currentCategory -> getId ( ) ] [ 'use... | Append virtual rule and sorting product data . |
43,997 | 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' , $ urlParams ) ; } return ... | Retrieve the category product sorter load URL . |
43,998 | private function getProductSavedPositions ( Category $ category ) { $ productPositions = [ ] ; if ( $ category -> getId ( ) ) { $ productPositions = $ this -> productPositionResource -> getProductPositionsByCategory ( $ category ) ; } return json_encode ( $ productPositions , JSON_FORCE_OBJECT ) ; } | Load product saved positions for the current category . |
43,999 | private function getBlacklistedProducts ( Category $ category ) { $ productIds = $ this -> productPositionResource -> getProductBlacklistByCategory ( $ category ) ; return array_map ( 'intval' , $ productIds ) ; } | Return list of blacklisted products for the current category . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.