JSONADM API - New Product - Not Rebuild Index

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
User avatar
Kevin1596
Posts: 28
Joined: 13 Aug 2020, 10:11

JSONADM API - New Product - Not Rebuild Index

Post by Kevin1596 » 13 Oct 2020, 06:32

Hi there,

I am currently using AIMEOS Laravel version 7.2020, and JSONADM API

I am trying to figure out how to manage the products and catalog relationship using JSON API via catalog.lists table

Here are the steps to reproduce:
- Create new product
- Get the Id of new product to create a catalog.list with existing Catalog (add the product to catalog when calling API)

With these steps all the API work fine except the index of catalog is not rebuild. That make the product not available to the front end via the JSON API

I already investigated this post, seem the core is already fixed , but i couldnt make it

JSONADM API and rebuild index
post11064.html

PS: Is it okay to manually add and remove product via the catalog.lists resource? Is there any potential problems behind that?

thank you very much for your time

User avatar
aimeos
Administrator
Posts: 7881
Joined: 01 Jan 1970, 00:00

Re: JSONADM API - New Product - Not Rebuild Index

Post by aimeos » 13 Oct 2020, 17:09

The index should be rebuilt if you use POST or PATCH for the "catalog" endpoint with relationships:
https://github.com/aimeos/ai-admin-json ... #L447-L454

PATCH Example:

Code: Select all

    "data": {
    	"id": "12",
        "type": "catalog",
        "attributes": {
        },
        "relationships": {
            "product": {
                "data": [{
                    "id": "123",
                    "type": "product",
                    "attributes": {
                        "catalog.lists.type": "promotion",
                        "catalog.lists.config": {},
                        "catalog.lists.refid": "123",
                    }
                }]
            }
        }
    }
}
See also: https://aimeos.org/docs/latest/admin/js ... eate-items

The index won't be rebuilt if you change the "catalog/lists" resource directly.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
Kevin1596
Posts: 28
Joined: 13 Aug 2020, 10:11

Re: JSONADM API - New Product - Not Rebuild Index

Post by Kevin1596 » 14 Oct 2020, 06:20

Thank you for your replying,

How about the Delele method?
As I want to delete the relationship between catalog and product?

If I just delete the catalog.list endpoint is there any potentital problems or there is any way to safely make it

User avatar
aimeos
Administrator
Posts: 7881
Joined: 01 Jan 1970, 00:00

Re: JSONADM API - New Product - Not Rebuild Index

Post by aimeos » 14 Oct 2020, 06:43

Deleting product references using the "catalog/lists" endpoint doesn't update the index at the moment:
https://github.com/aimeos/ai-admin-json ... #L507-L530

We will see how we can fix that.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
Kevin1596
Posts: 28
Joined: 13 Aug 2020, 10:11

Re: JSONADM API - New Product - Not Rebuild Index

Post by Kevin1596 » 14 Oct 2020, 07:22

AsI saw on the Aimeos Version 10.2020 laravel has a new JSON Adm API endpoint Index, which I did not find any related documentations yet,

Could you help me brieftly explain, what Index is used for?

And is it okay for me to solve the delete method above by Manually delete both the catalog.list and Index-catalog through the api. Will it affect the Index for JSON api
Thank you for your help

User avatar
aimeos
Administrator
Posts: 7881
Joined: 01 Jan 1970, 00:00

Re: JSONADM API - New Product - Not Rebuild Index

Post by aimeos » 14 Oct 2020, 07:30

Yes, you can use it to update the index, esp. using the DELETE method is very handy to remove products from the index. You can also rebuild the index for specific products. Just pass the product IDs using the "id" parameter to both methods:
https://github.com/aimeos/ai-admin-json ... andard.php
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
Kevin1596
Posts: 28
Joined: 13 Aug 2020, 10:11

Re: JSONADM API - New Product - Not Rebuild Index

Post by Kevin1596 » 14 Oct 2020, 07:38

Could you please shortly explain the Logic of Index in the Aimeos system?

As i understand now, it is used to get the list of products which are available for customer without login. And it is used for Aimeos system to operating for searching and filtering.
Is there any notices when modify

If I manually delete index as above? Do I mess up anything under the hook of the system?

Thank you for your fast response

User avatar
aimeos
Administrator
Posts: 7881
Joined: 01 Jan 1970, 00:00

Re: JSONADM API - New Product - Not Rebuild Index

Post by aimeos » 14 Oct 2020, 07:50

The index is used for searching and filtering for the frontend and also used for displaying products in all list views.
You can update the index using the JsonAdm endpoint. The only thing you can do wrong is to delete products from the index but not from the categories. Then, the products will get into the index again when a full index rebuild is done.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
Kevin1596
Posts: 28
Joined: 13 Aug 2020, 10:11

Re: JSONADM API - New Product - Not Rebuild Index

Post by Kevin1596 » 14 Oct 2020, 07:57

In which cases the index is rebuild?

Will it rebuild the index everytime i modify the Index through JSON ADM Api ?

If yes will that affect the performance of system?

User avatar
aimeos
Administrator
Posts: 7881
Joined: 01 Jan 1970, 00:00

Re: JSONADM API - New Product - Not Rebuild Index

Post by aimeos » 15 Oct 2020, 11:03

The complete index is only rebuilt if you execute the "index/rebuild" job from the command line.
Using the JsonAdm API with DELETE or POST, only the product is updated in the index. Thus, the performance of the system won't be affected much by the index update.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply