Skip to content

Instantly share code, notes, and snippets.

View JEreth's full-sized avatar

Julian Ereth JEreth

View GitHub Profile
@JEreth
JEreth / Match.php
Created November 25, 2021 13:51
Magento2 Change elastic search query default operator to AND. See https://magento.stackexchange.com/questions/192718/how-do-i-change-magento-2-search-from-or-logic-to-and for full discussion.
<?php
namespace <VENDOR>\<MODULE>\SearchAdapter\Query\Builder;
use Magento\Elasticsearch\Model\Adapter\FieldMapper\Product\AttributeProvider;
use Magento\Elasticsearch\Model\Adapter\FieldMapper\Product\FieldProvider\FieldType\ResolverInterface as TypeResolver;
use Magento\Elasticsearch\Model\Config;
use Magento\Elasticsearch\SearchAdapter\Query\ValueTransformerPool;
use Magento\Framework\Search\Request\Query\BoolExpression;
use Magento\Framework\Search\Request\QueryInterface as RequestQueryInterface;
use Magento\Elasticsearch\Model\Adapter\FieldMapperInterface;