From 846e1aa391a3458f7340348701ba1a2227127020 Mon Sep 17 00:00:00 2001 From: merdan Date: Tue, 15 Aug 2023 14:40:30 +0500 Subject: [PATCH] search refactor3 --- config/meilisearch.php | 15 +++++++++++++++ .../Webkul/Product/src/Models/ProductFlat.php | 5 ++++- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 config/meilisearch.php diff --git a/config/meilisearch.php b/config/meilisearch.php new file mode 100644 index 000000000..381108b1a --- /dev/null +++ b/config/meilisearch.php @@ -0,0 +1,15 @@ + [ + 'host' => env('MEILISEARCH_HOST', 'http://localhost:7700'), + 'key' => env('MEILISEARCH_KEY', null), + 'index-settings' => [ + \Webkul\Product\Models\ProductFlat::class => [ + 'filterableAttributes'=> ['locale', 'channel' ], + 'sortableAttributes' => ['created_at'], + // Other settings fields... + ], + + ], + ], +]; \ No newline at end of file diff --git a/packages/Webkul/Product/src/Models/ProductFlat.php b/packages/Webkul/Product/src/Models/ProductFlat.php index 52cff4ee8..ec4b01b86 100644 --- a/packages/Webkul/Product/src/Models/ProductFlat.php +++ b/packages/Webkul/Product/src/Models/ProductFlat.php @@ -49,7 +49,10 @@ class ProductFlat extends Model implements ProductFlatContract { return 'products_index'; } - + public function searchable(): bool + { + return $this->status || $this->visible_individually; + } /** * Get an attribute from the model. *