Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full Text Search v1/search API throws error #869

Closed
atishgoswami opened this issue Apr 15, 2018 · 1 comment
Closed

Full Text Search v1/search API throws error #869

atishgoswami opened this issue Apr 15, 2018 · 1 comment

Comments

@atishgoswami
Copy link

Preconditions

  • Magento Version: 2.2.3 EE
  • PHP: 7.1.13
  • Database: 5.7.21
  • OS: CentOS 7
  • ElasticSearch: 2.4.6
  • ElasticSuite:

After configurating the extension the full text search API
V1/search?searchCriteria[requestName]=quick_search_container&searchCriteria[filterGroups][][filters][][field]=search_term&searchCriteria[filterGroups][][filters][][value]=phones throws error

"Warning: Invalid argument supplied for foreach() in /projects/vendor/smile/elasticsuite/src/module-elasticsuite-core/Model/Search/RequestMapper.php on line 43"

Steps to reproduce

  1. Install and configure the extension using the steps in the WIKI
  2. Send a GET request to the below url
V1/search?searchCriteria[requestName]=quick_search_container&searchCriteria[filterGroups][][filters][][field]=search_term&searchCriteria[filterGroups][][filters][][value]=phones

Expected result

Should get a search result for the GET request query

Actual result

{
    "message": "Warning: Invalid argument supplied for foreach() in /project/vendor/smile/elasticsuite/src/module-elasticsuite-core/Model/Search/RequestMapper.php on line 43",
    "trace": "#0 /project/vendor/smile/elasticsuite/src/module-elasticsuite-core/Model/Search/RequestMapper.php(43): Magento\\Framework\\App\\ErrorHandler->handler(2, 'Invalid argumen...', '/project...', 43, Array)\n#1 /project/vendor/magento/framework/Interception/Interceptor.php(58): Smile\\ElasticsuiteCore\\Model\\Search\\RequestMapper->getSortOrders(Object(Smile\\ElasticsuiteCore\\Search\\Request\\ContainerConfiguration), Object(Magento\\Framework\\Api\\Search\\SearchCriteria))\n#2 /project/vendor/magento/framework/Interception/Interceptor.php(138): Smile\\ElasticsuiteCore\\Model\\Search\\RequestMapper\\Interceptor->___callParent('getSortOrders', Array)\n#3 /project/vendor/magento/framework/Interception/Interceptor.php(153): Smile\\ElasticsuiteCore\\Model\\Search\\RequestMapper\\Interceptor->Magento\\Framework\\Interception\\{closure}(Object(Smile\\ElasticsuiteCore\\Search\\Request\\ContainerConfiguration), Object(Magento\\Framework\\Api\\Search\\SearchCriteria))\n#4 /project/generated/code/Smile/ElasticsuiteCore/Model/Search/RequestMapper/Interceptor.php(25): Smile\\ElasticsuiteCore\\Model\\Search\\RequestMapper\\Interceptor->___callPlugins('getSortOrders', Array, Array)\n#5 /project/vendor/smile/elasticsuite/src/module-elasticsuite-core/Model/Search/RequestBuilder.php(92): Smile\\ElasticsuiteCore\\Model\\Search\\RequestMapper\\Interceptor->getSortOrders(Object(Smile\\ElasticsuiteCore\\Search\\Request\\ContainerConfiguration), Object(Magento\\Framework\\Api\\Search\\SearchCriteria))\n#6 /project/vendor/smile/elasticsuite/src/module-elasticsuite-core/Model/Search.php(67): Smile\\ElasticsuiteCore\\Model\\Search\\RequestBuilder->getRequest(Object(Magento\\Framework\\Api\\Search\\SearchCriteria))\n#7 [internal function]: Smile\\ElasticSuiteCore\\Model\\Search->search(Object(Magento\\Framework\\Api\\Search\\SearchCriteria))\n#8 /project/vendor/magento/module-webapi/Controller/Rest.php(330): call_user_func_array(Array, Array)\n#9 /project/vendor/magento/module-webapi/Controller/Rest.php(239): Magento\\Webapi\\Controller\\Rest->processApiRequest()\n#10 /project/vendor/magento/framework/Interception/Interceptor.php(58): Magento\\Webapi\\Controller\\Rest->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#11 /project/vendor/magento/framework/Interception/Interceptor.php(138): Magento\\Webapi\\Controller\\Rest\\Interceptor->___callParent('dispatch', Array)\n#12 /project/vendor/magento/framework/Interception/Interceptor.php(153): Magento\\Webapi\\Controller\\Rest\\Interceptor->Magento\\Framework\\Interception\\{closure}(Object(Magento\\Framework\\App\\Request\\Http))\n#13 /project/generated/code/Magento/Webapi/Controller/Rest/Interceptor.php(39): Magento\\Webapi\\Controller\\Rest\\Interceptor->___callPlugins('dispatch', Array, Array)\n#14 /project/vendor/magento/framework/App/Http.php(135): Magento\\Webapi\\Controller\\Rest\\Interceptor->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#15 /project/vendor/magento/framework/Interception/Interceptor.php(58): Magento\\Framework\\App\\Http->launch()\n#16 /project/vendor/magento/framework/Interception/Interceptor.php(138): Magento\\Framework\\App\\Http\\Interceptor->___callParent('launch', Array)\n#17 /project/vendor/msp/apienhancer/Plugin/AppInterfacePlugin.php(75): Magento\\Framework\\App\\Http\\Interceptor->Magento\\Framework\\Interception\\{closure}()\n#18 /project/vendor/magento/framework/Interception/Interceptor.php(135): MSP\\APIEnhancer\\Plugin\\AppInterfacePlugin->aroundLaunch(Object(Magento\\Framework\\App\\Http\\Interceptor), Object(Closure))\n#19 /project/vendor/magento/framework/Interception/Interceptor.php(153): Magento\\Framework\\App\\Http\\Interceptor->Magento\\Framework\\Interception\\{closure}()\n#20 /project/generated/code/Magento/Framework/App/Http/Interceptor.php(26): Magento\\Framework\\App\\Http\\Interceptor->___callPlugins('launch', Array, NULL)\n#21 /project/vendor/magento/framework/App/Bootstrap.php(256): Magento\\Framework\\App\\Http\\Interceptor->launch()\n#22 /project/pub/index.php(37): Magento\\Framework\\App\\Bootstrap->run(Object(Magento\\Framework\\App\\Http\\Interceptor))\n#23 {main}"
}
afoucret pushed a commit to afoucret/elasticsuite that referenced this issue Apr 16, 2018
@afoucret
Copy link
Contributor

PR #872 fix this one and will be part of the next maintenance release (2.5.7).

BR,

afoucret added a commit that referenced this issue Apr 16, 2018
Fix #869 : API error when sort order or filter are missing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants