search fix

This commit is contained in:
merdan 2023-09-15 14:33:37 +05:00
parent 7bfcb58878
commit 1f58f19a76
2 changed files with 10 additions and 2 deletions

View File

@ -120,7 +120,7 @@ return [
'key' => env('MEILISEARCH_KEY', 'qazwsx12qazwsx12'),
'index-settings' => [
\Webkul\Product\Models\ProductFlat::class => [
'filterableAttributes'=> ['locale', 'channel' ],
// 'filterableAttributes'=> ['locale', 'channel' ],
'sortableAttributes' => ['name','created_at','min_price'],
// Other settings fields...
],

View File

@ -53,15 +53,23 @@ class ProductFlat extends Model implements ProductFlatContract
{
return 'products_index';
}
public function searchable(): bool
{
return $this->status || $this->visible_individually;
}
public function toSearchableArray():array
{
return [
'id' => $this->id,
'name' => $this->name,
'meta_keywords' => $this->meta_keywords,
'min_price' => $this->min_price,
'status' => $this->status,
'visible_individually'=> $this->visible_individually,
'product_id' => $this->product_id
'product_id' => $this->product_id,
'created_at' => $this->created_at,
];
}
/**