Sylius / SyliusElasticSearchPlugin

DEPRECATED! Use https://github.com/BitBagCommerce/SyliusElasticsearchPlugin instead.
22 stars 26 forks source link

Filtering on main_taxon.slug delivers no results #92

Open wimulkeman opened 6 years ago

wimulkeman commented 6 years ago

After updating to sylius/elastic-search-plugin:v1.0.0-beta.17, I wasn't able to search for data put into objects within ElasticSearch, and in fields containing a dot in their name (main_taxon.slug).

The following code would not work afterwards:

/** @var FilterManagerInterface $filterManager */
$filterManager = $this->get('ongr_filter_manager.manager.search_list');

/** @var LocaleContextInterface $channelLocale */
$channelLocale = $this->get('sylius.context.locale');
$localeCode = $channelLocale->getLocaleCode();

/** @var ChannelContextInterface $channelContext */
$channelContext = $this->get('sylius.context.channel');
$channel = $channelContext->getChannel();

$request->query->set('taxonSlug', $request->attributes->get('slug'));
$request->query->set('channel', [$channel->getCode()]);
$request->query->set('locale', $localeCode);

$response = $filterManager->handleRequest($request);

The field taxonSlug has the following config for it in ONGR:

taxonSlug:
    type: multi_choice
    request_field: taxonSlug
    document_field: taxons.slug

Downgrading to sylius/elastic-search-plugin:v1.0.0-beta.16 fixed it for me