├── .gitignore ├── LICENSE ├── Model └── Indexer │ └── IndexerHandler.php ├── README.md ├── SearchAdapter └── Adapter.php ├── composer.json ├── etc ├── di.xml ├── indexer.xml └── module.xml └── registration.php /.gitignore: -------------------------------------------------------------------------------- 1 | .idea -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Zepgram - Benjamin Calef 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Model/Indexer/IndexerHandler.php: -------------------------------------------------------------------------------- 1 | 30 | [ 31 | "hits" => [] 32 | ], 33 | "aggregations" => 34 | [ 35 | "price_bucket" => [], 36 | "category_bucket" => 37 | [ 38 | "buckets" => [] 39 | ] 40 | ] 41 | ]; 42 | 43 | /** 44 | * @var ResponseFactory 45 | */ 46 | private $responseFactory; 47 | 48 | /** 49 | * @var AggregationFactory 50 | */ 51 | private $aggregationFactory; 52 | 53 | /** 54 | * @var BucketFactory 55 | */ 56 | private $bucketFactory; 57 | 58 | /** 59 | * Adapter constructor. 60 | * @param ResponseFactory $responseFactory 61 | * @param AggregationFactory $aggregationFactory 62 | */ 63 | public function __construct( 64 | ResponseFactory $responseFactory, 65 | AggregationFactory $aggregationFactory, 66 | BucketFactory $bucketFactory 67 | ) { 68 | $this->responseFactory = $responseFactory; 69 | $this->aggregationFactory = $aggregationFactory; 70 | $this->bucketFactory = $bucketFactory; 71 | } 72 | 73 | /** 74 | * Empty Query Response 75 | * 76 | * @param RequestInterface $request 77 | * @return QueryResponse 78 | */ 79 | public function query(RequestInterface $request): QueryResponse 80 | { 81 | $values = $buckets = []; 82 | foreach ($request->getAggregation() as $aggregation) { 83 | $name = $aggregation->getName(); 84 | $buckets[$name] = $this->bucketFactory->create([ 85 | 'name' => $name, 86 | 'values' => $values 87 | ]); 88 | } 89 | 90 | return $this->responseFactory->create( 91 | [ 92 | 'documents' => [], 93 | 'aggregations' => $this->aggregationFactory->create(['buckets' => $buckets]), 94 | 'total' => self::$emptyRawResponse['hits']['total']['value'] ?? 0 95 | ] 96 | ); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "zepgram/module-disable-search-engine", 3 | "description": "Magento2 module to disable search engine and fulltext indexing for category search", 4 | "type": "magento2-module", 5 | "version": "0.4.0", 6 | "authors": [ 7 | { 8 | "name": "Benjamin Calef", 9 | "email": "zepgram@gmail.com" 10 | } 11 | ], 12 | "require": { 13 | "php": "^8.2", 14 | "magento/framework": "^103.0.6", 15 | "magento/module-backend": "^102.0.6", 16 | "magento/module-indexer": "^100.4.6", 17 | "magento/module-search": "^101.1.6", 18 | "magento/module-catalog-search": "^102.0.6" 19 | }, 20 | "replace": { 21 | "magento/module-elasticsearch-catalog-permissions": "*", 22 | "magento/module-elasticsearch-catalog-permissions-graph-ql": "*", 23 | "magento/module-inventory-elasticsearch": "*", 24 | "magento/module-elasticsearch": "*", 25 | "magento/module-elasticsearch-6": "*", 26 | "magento/module-elasticsearch-7": "*", 27 | "magento/module-elasticsearch-8": "*", 28 | "magento/module-open-search": "*" 29 | }, 30 | "autoload": { 31 | "files": [ 32 | "registration.php" 33 | ], 34 | "psr-4": { 35 | "Zepgram\\DisableSearchEngine\\": "" 36 | } 37 | }, 38 | "license": "MIT", 39 | "repositories": { 40 | "repo.magento.com": { 41 | "type": "composer", 42 | "url": "https://repo.magento.com/" 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /etc/di.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 9 | 10 | 11 | 12 | none 13 | 14 | 15 | 16 | 17 | 18 | 19 | none 20 | 21 | none 22 | 23 | 24 | 25 | 26 | 27 | Zepgram\DisableSearchEngine\SearchAdapter\Adapter 28 | 29 | 30 | 31 | 32 | 33 | 34 | Zepgram\DisableSearchEngine\Model\Indexer\IndexerHandler 35 | 36 | 37 | 38 | 39 | 40 | 41 | Magento\AdvancedSearch\Model\DataProvider\Suggestions 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /etc/indexer.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /etc/module.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /registration.php: -------------------------------------------------------------------------------- 1 |