Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Wildcard.php
Go to the documentation of this file.
1 <?php
7 
8 use Magento\Framework\Search\Request\Filter\Wildcard as WildcardFilterRequest;
9 use Magento\Framework\Search\Request\FilterInterface as RequestFilterInterface;
11 
12 class Wildcard implements FilterInterface
13 {
17  protected $fieldMapper;
18 
23  {
24  $this->fieldMapper = $fieldMapper;
25  }
26 
31  public function buildFilter(RequestFilterInterface $filter)
32  {
33  $fieldName = $this->fieldMapper->getFieldName($filter->getField());
34  return [
35  [
36  'wildcard' => [
37  $fieldName => '*' . $filter->getValue() . '*',
38  ],
39  ]
40  ];
41  }
42 }
__construct(FieldMapperInterface $fieldMapper)
Definition: Wildcard.php:22