Elasticsuite: Magento 2 REST API compatibility

Created on 25 Nov 2016  路  14Comments  路  Source: Smile-SA/elasticsuite

I'm trying to list all products for each category but I can't list products inside the virtual categories that follow the virtual rules. Is this possible using the Magento 2 REST API?

Thanks.

bug feature

All 14 comments

Hello @nghelo and thank you for submitting this issue, and for using our module.

You are right, actually it is impossible to retrieve the product list associated to a virtual categorie via the API. This is a known limitation of the module and we'll probably fix it on a later version.

We keep this issue open and will keep you in touch about this one.

Best regards,

Hi @nghelo,

I didn't have time to review this issue before but I think there is an important things here.

As a matter of semantic, It is fully expected that you are not able to list products inside a category if you are using this API : GET /V1/categories/{categoryId}/products. This API is an admin API in Magento whose behavior is to list products attached to the category (or Get products assigned to category in the documentation).

For a standard Magento, it is not consistent with what you will see in the front layered navigation :

  • For layered categories, you will not see products of the children categories. What is annoying if you want to use this API in a front application

  • It does not handle visibility filtering for the products

  • Sorting is not really applied to the category (only position sort is), what is not always relevant with how category is tuned ...

Concerning virtual categories, products are never attached to the category and this behavior appears to be normal and consistent with Magento API semantic.

We are currently working on repairing the Magento Search API (GET /V1/search) whose purpose is to search in products. You can also applies filters (category, price, attributes) just like in the layer navigation and event fulltext search. I will document it when job will be done.

There is a WIP for this there : https://github.com/afoucret/elasticsuite/tree/fix-search_api and should be released in 2.3.0 or 2.4.0 depending how we are fast to implement it.

TL;DR : we will not work on the category products API but rather implement the search API to be consistent with the layered navigation / search result

Hi, any news on the search API integration ?

Hello, any news? The #13 is returning a bad fatal error and is not good...

I followed the fix#14 like https://github.com/afoucret/elasticsuite/tree/fix-search_api. But I still get error message which says
Fatal Error: 'Uncaught TypeError: Argument 1 passed to Smile\ElasticSuiteCore\Model\Search::__construct() must implement interface Magento\Framework\App\ScopeResolverInterface, instance of Magento\Framework\ObjectManager\ObjectManager given...

@sibhis for me the error was caused by another module and not elasticsuite, try to debug your code

See PR #700 which aims to implement search API support.

Done :

  • [X] Support for text search with all ElasticSuite features enabled (boost, relevance config, ...)
  • [X] Support for sort order including category navigation position from the visual merchandiser
  • [X] Filtering support
  • [X] Virtual categories filtering support

Now missing :

  • [ ] Aggregation support
  • [ ] Automatic handling of visibility and stock configuration.

Update :

  • [X] Automatic handling of visibility and stock configuration (fixed by #781)
  • [ ] Aggregation support

How it possible query for products fultered by category and some of attributes?

Hello @Koc

Actually, you can use the legacy Magento2 search API according to the documentation and you will obtain results based on Elasticsuite.

What is actually missing is the aggregation support : aggregation are not sent back in the API response. It's scheduled for next major release (2.7) and have max priority.

Regards

Thank you. Aggregation support would be very useful for shops which uses Magento in headless mode.

Search API was fully integrated in latest 2.7.0 release. I close this one.

Hello, thank for a great suite, that you guys have developed.
I do have a question though:

How do I create a virtual category and set rules for it via API?

PS To see what it might look like, I manually created a virtual category and set rules for it, but when I retrieve info about this category via API, 'virtual_rule' value is just an empty list. Why is that? Where do I find en example for setting rule for a virtual category via API?

Thanks.

Was this page helpful?
0 / 5 - 0 ratings