SyliusElasticsearchPlugin icon indicating copy to clipboard operation
SyliusElasticsearchPlugin copied to clipboard

Unable to use checkbox filter

Open jbcr opened this issue 5 years ago • 2 comments

On product, I have many checkbox attributes. When I check "1" in the filter and I click on "Filter" button, I have this error :

An exception has been thrown during the rendering of a template ("failed to create query: {
  "bool": {
    "must": [
      {
        "term": {
          "enabled": {
            "value": true,
            "boost": 1.0
          }
        }
      },
      {
        "terms": {
          "channels": [
            "sylius"
          ],
          "boost": 1.0
        }
      },
      {
        "terms": {
          "product_taxons": [
            "01"
          ],
          "boost": 1.0
        }
      },
      {
        "range": {
          "price_sylius": {
            "from": 0,
            "to": 9223372036854775807,
            "include_lower": true,
            "include_upper": true,
            "boost": 1.0
          }
        }
      },
      {
        "bool": {
          "should": [
            {
              "term": {
                "attribute_promotion": {
                  "value": "1",
                  "boost": 1.0
                }
              }
            }
          ],
          "adjust_pure_negative": true,
          "boost": 1.0
        }
      },
      {
        "bool": {
          "should": [
            {
              "term": {
                "attribute_news_auto": {
                  "value": "9a9bf86a_8e14_11ea_ad31_0242ac120005",
                  "boost": 1.0
                }
              }
            }
          ],
          "adjust_pure_negative": true,
          "boost": 1.0
        }
      }
    ],
    "adjust_pure_negative": true,
    "boost": 1.0
  }
} [index: bitbag_shop_products_dev] [reason: all shards failed]").

When I replace the "1" value by true in the query string, the filter work fine but the filter form is not checked.

jbcr avatar May 04 '20 15:05 jbcr

Here's a quick POC in case someone needs to implement this feature https://github.com/vvasiloi/SyliusElasticsearchPlugin/commit/d006d35d530e81c59fab45e065efc7122f50b422

vvasiloi avatar May 19 '20 16:05 vvasiloi

Issued a PR to fix this issue

mvriel avatar May 28 '20 11:05 mvriel