Code Monkey home page Code Monkey logo

syliuselasticsearchplugin's Introduction

[DEPRECATED] Sylius ElasticSearchPlugin

The development of this plugin by Sylius organization is currently frozen. We may or may not approach the problem again but nothing is planned yet. Please use the production-ready plugin by BitBag available here: https://github.com/BitBagCommerce/SyliusElasticsearchPlugin.

If you would like to fork this plugin and continue its development, please consider contributing to the plugin mentioned above. If you still think it is a good idea to fork, then feel free to do so when respecting the MIT license.

Thanks for your understanding and happy coding! :)

syliuselasticsearchplugin's People

Contributors

arminek avatar damonsson avatar jantvrdik avatar kpitn avatar lchrusciel avatar mbabker avatar michalmarcinkowski avatar pamil avatar pjedrzejewski avatar psihius avatar william-nedbase avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

syliuselasticsearchplugin's Issues

Customizing documents

Is there any recommended way of customizing documents, for example by extending them from the vendor?

Selecting an option in a filter makes other option groups disappear

When selecting an option in a filter using the default configuration makes other option groups disappear.

The default configuration of options is:

options:
    type: sylius_elastic_search.multi_dynamic_aggregate_options
    request_field: options
    document_field: variants>variants.options>variants.options.value.raw
        options:
            name_field: variants.options.name.raw
            sort_type: _term
            sort_order: asc
            size: 100

The document field variants>variants.options>variants.options.value.raw defines a double nested aggregation to get to the variant's options. Because of this double nested aggregation the sylius_elastic_search.multi_dynamic_aggregate_options filter type is needed to override ONGR's default functionality. This override however, breaks the default functionality.

Changing the document field to variants.options>variants.options.value.raw (directly pointed to the variant's options in a single nested aggregation) makes the need for an overridden filter type redundant. By changing this document field, we're able to make use of the sylius_elastic_search.multi_dynamic_aggregate filter type. The excess OptionMultiDynamicAggregate could be removed.

By making use of the MultiDynamicAggregate filter type, functionality of multiple option groups is restored.

The new configuration for options would be:

options:
    type: sylius_elastic_search.multi_dynamic_aggregate
    request_field: options
    document_field: variants.options>variants.options.value.raw
        options:
            name_field: variants.options.name.raw
            sort_type: _term
            sort_order: asc
            size: 100

Filter by attribute with range

Is it possible to filter attributes with range? For example, an attribute is a size, and I would like filter shoe products with size attribute between 40-45?

Exists filter range, and filter (multi) dynamic aggregate in ONGR Filters. Unfortunately, it does not looks like I can use it together.

ONGR ElasticsearchDSL and own custom query is the option? Is it possible with it at all?

Missing product updates because of bulk size in Commands

When the updateProductIndexCommand loops through the productDocuments, every 100th time the elasticsearchManager:commit method will be triggered. When the size of productDocuments is not exact divisible by 100 there are documents left that are not committed

Missing document interfaces for customisation

There is a way to define your own custom classes for documents in configuration in case one needs to override the default ones, however there are no interfaces for documents and the factories are inclined to return objects from Omni\Sylius\ElasticsearchPlugin\Document namespace as shown here:

public function create(TaxonInterface $taxon, LocaleInterface $localeCode, ?int $position = null): TaxonDocument;

This means that there is no way for me to completely override the document classes and I can only extend on defaults. But that denies me a possibility to locally fix the error comming from ill formed collection setter methods

Return value of Sylius\ElasticSearchPlugin\Filter\Widget\Pager::getCountPerPage() must be of the type integer, string returned

image

image

Symfony\Component\Debug\Exception\FatalThrowableError:
Type error: Return value of Sylius\ElasticSearchPlugin\Filter\Widget\Pager::getCountPerPage() must be of the type integer, string returned

  at vendor/sylius/elastic-search-plugin/src/Filter/Widget/Pager.php:27
  at Sylius\ElasticSearchPlugin\Filter\Widget\Pager->getCountPerPage(object(FilterState))
     (vendor/sylius/elastic-search-plugin/src/Filter/Widget/Pager.php:54)
  at Sylius\ElasticSearchPlugin\Filter\Widget\Pager->modifySearch(object(Search), object(FilterState), object(SearchRequest))
     (vendor/ongr/filter-manager-bundle/Search/FilterContainer.php:121)
  at ONGR\FilterManagerBundle\Search\FilterContainer->buildSearch(object(SearchRequest))
     (vendor/ongr/filter-manager-bundle/Search/FilterManager.php:94)
  at ONGR\FilterManagerBundle\Search\FilterManager->search(object(SearchRequest))
     (vendor/ongr/filter-manager-bundle/Search/FilterManager.php:80)
  at ONGR\FilterManagerBundle\Search\FilterManager->handleRequest(object(Request))
     (vendor/sylius/elastic-search-plugin/src/Controller/SearchController.php:104)
  at Sylius\ElasticSearchPlugin\Controller\SearchController->__invoke(object(Request))
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:151)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:202)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (web/app_dev.php:37)

Filtering on main_taxon.slug delivers no results

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

Error response (Sort order [ASC] not supported) for shop-api/ request

When calling the API (as stated in the README.md - /shop-api/taxon-products/mugs?channel=WEB_GB) the response is:

{"error":{"root_cause":[{"type":"parsing_exception","reason":"Sort order [ASC] not supported.","line":1,"col":524}],"type":"parsing_exception","reason":"Sort order [ASC] not supported.","line":1,"col":524},"status":400}

Also when performing the sylius:elastic-search:update-product-index via CLI this problem occurs.

It seems to me that this is caused by incorrect use of capital letters in the term 'asc' in two files: UpdateProductIndexCommand.php and SearchController.php

In UpdateProductIndexCommand.php
$search->addSort(new FieldSort('synchronised_at', 'ASC')); sould be: $search->addSort(new FieldSort('synchronised_at', 'asc'));

SearchController.php
$request->query->set('sort', ['taxonPositionByXXXX' => [$request->get('taxonXXXX') => 'ASC']]); sould be $request->query->set('sort', ['taxonPositionByXXXX' => [$request->get('taxonXXXX') => 'asc']]);

limit value in configuration is not respected in pager.php

Hello,

SyliusElasticSearchPlugin/src/Filter/Widget/Pager.php

line number 43 should be changed

from

    $state->addOption('limit', (int) $request->get('limit', 10));

to

    $state->addOption('limit', $request->get('limit', $this->getOption('limit', 10)));

Otherwise search page always show 10 results

Example form usage

Please could you provide sample code to demonstrate how to embed the search form/textbox within a view?

Error when rendering results

When I try rendering results got from filter manager in twig I get an error:

Type error: Argument 1 passed to Sylius\ElasticSearchPlugin\Document\TaxonDocument::setImages() must be an instance of ONGR\ElasticsearchBundle\Collection\Collection, instance of ONGR\ElasticsearchBundle\Result\ObjectIterator given, called in /Users/m/Projects/omni/sylius-standard/vendor/ongr/elasticsearch-bundle/Result/Converter.php on line 134

ProductListViewFactory cannot be extended

Should the ProductListViewFactory be a final class? Now it is very hard to change the creation of e.g. a variantView.

I want to pass the options from VariantDocument:getOptions() to the VariantView via the ProductListViewFactory. But because this class is final, and the getVarantViews method is private I have to duplicate the whole class.

When filtering by taxonSlug, price range is returned with wrong maxBounds value

When searching by query, minBounds and maxBounds of priceRange is returned valid.
It looks like that only when searching by taxonSlug, priceRange.maxBounds value is always max value from all products.

I would like that maxBounds value would be the max value of current taxon (+ all children).
Any ideas where to start digging?

Possibility to configure filterable attributes from UI

Currently the plugin has the attribute_whitelist parameter in configuration. This is not exactly the best implementation as this denies non-technical administrators of the shop from adding additional attributes for the shop to filter on.
I propose the introduction of filterable field in ProductModel entity. Me and my team have done the same in our SQL based filter plugin. This way the administrator of the shop can simply flag this option in admin panel and from that moment on these product attributes will be taken into the ES index.
I think I could even find time to make a contribution on this, if you consider it a valid improvement

Error after install

I've follow the installation guide, this is that Sylius return's for this request.
/shop-api/products?channel=US_WEB

Type error: Argument 1 passed to Sylius\\ElasticSearchPlugin\\Document\\TaxonDocument::setImages() must be an instance of ONGR\\ElasticsearchBundle\\Collection\\Collection, instance of ONGR\\ElasticsearchBundle\\Result\\ObjectIterator given, called in \/private\/var\/www\/sylius-test\/vendor\/ongr\/elasticsearch-bundle\/Result\/Converter.php on line 134"}

Probably bug?

Connect to own elastic search server.

I do not see any configuration options to make a connection to another elastic search hosted on an another network.
I think this should be possible.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.