magento2-vsbridge-indexer icon indicating copy to clipboard operation
magento2-vsbridge-indexer copied to clipboard

Product Category Name missing Type Keyword?

Open tonyisworking opened this issue 5 years ago • 5 comments

Category Filtering on VSF home page didn't seem to work with the default indexer install using category.name.keyword on default.json file in VSF

Seems like the product category needs to be changed to TYPE_KEYWORD on magento2-vsbridge-indexer/src/module-vsbridge-indexer-catalog/Index/Mapping/Product.php

From lines 220:

  'category' => [
                'type' => 'nested',
                'properties' => [
                    'category_id' => ['type' => FieldInterface::TYPE_LONG],
                    'position' => ['type' => FieldInterface::TYPE_LONG],
                    'name' => ['type' => FieldInterface::TYPE_TEXT],
                ],
            ],

To

       'category' => [
                // 'type' => 'nested',
                'properties' => [
                    'category_id' => ['type' => FieldInterface::TYPE_LONG],
                    'position' => ['type' => FieldInterface::TYPE_LONG],
                    'name' => [
                        'type' => FieldInterface::TYPE_TEXT,
                        'fields' => [
                            'keyword' => [
                                'type' => FieldInterface::TYPE_KEYWORD,
                                'ignore_above' => 256
                            ]
                        ]
                    ]
                ]
            ],

This worked for me for vsf 1.8-1.9

tonyisworking avatar Jun 12 '19 18:06 tonyisworking

Seems fixed in version 1.1.0

tonyisworking avatar Jul 12 '19 23:07 tonyisworking

Hi @tonyisworking , Yes I change mapping but you still need to make changes in VSF to make it work. "category" field has a nested type (so we can use sorting by position) and normal query won't work. You have to create nested query to ES.

We have two option here:

  1. We might add the option to indexer to create category as nested type or not. (but then you can't use sorting by category position).
  2. Changes to VSF core might be required to switch query, base on the configuration.

afirlejczyk avatar Jul 19 '19 09:07 afirlejczyk

@pkarw what do you think ? Option 1 Can we change the mapping for "category" field to nested type in vsf-api/maget2vsf schemas and create nested filters queries?

Option 2 I can add a new configuration to vsf category.nested-type: true/false -> and base on this we will make nested query or not.

Probably option 2 will be better so make it compatible with the previous versions.

afirlejczyk avatar Aug 01 '19 12:08 afirlejczyk

@afirlejczyk backward compatibility is our priority

pkarw avatar Aug 01 '19 13:08 pkarw

whoops, yeah it wasn't working, closed out too early. I was on my own fork...

tonyisworking avatar Aug 13 '19 16:08 tonyisworking