Skip to content
This repository was archived by the owner on Jan 9, 2024. It is now read-only.

Commit 501babf

Browse files
CasperLaiTWmsonowal
authored andcommitted
Support scout v9
1 parent c377525 commit 501babf

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
],
1515
"require": {
1616
"php": "^7.2|^8.0",
17-
"laravel/scout": "~6.0|~7.0|~8.0"
17+
"laravel/scout": "~6.0|~7.0|~8.0|~9.0"
1818
},
1919
"require-dev": {
2020
"phpunit/phpunit": "8.5.x-dev",

src/Engines/MySQLEngine.php

+41
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Yab\MySQLScout\Engines;
44

5+
use Illuminate\Support\LazyCollection;
56
use Yab\MySQLScout\Engines\Modes\ModeContainer;
67
use Illuminate\Database\Eloquent\Collection;
78
use Illuminate\Support\Facades\DB;
@@ -165,4 +166,44 @@ protected function shouldUseFallback($builder)
165166
strlen($builder->query) < config('scout.mysql.min_fulltext_search_length')) ||
166167
$this->fallbackSearchShouldBeUsedForModel($builder);
167168
}
169+
170+
/**
171+
* Map the given results to instances of the given model via a lazy collection.
172+
*
173+
* @param \Laravel\Scout\Builder $builder
174+
* @param mixed $results
175+
* @param \Illuminate\Database\Eloquent\Model $model
176+
* @return \Illuminate\Support\LazyCollection
177+
*/
178+
public function lazyMap(Builder $builder, $results, $model)
179+
{
180+
if ($this->getTotalCount($results) === 0) {
181+
return LazyCollection::empty();
182+
}
183+
184+
return LazyCollection::make($results['results']->all());
185+
}
186+
187+
/**
188+
* Create a search index.
189+
*
190+
* @param string $name
191+
* @param array $options
192+
* @return mixed
193+
*/
194+
public function createIndex($name, array $options = [])
195+
{
196+
197+
}
198+
199+
/**
200+
* Delete a search index.
201+
*
202+
* @param string $name
203+
* @return mixed
204+
*/
205+
public function deleteIndex($name)
206+
{
207+
208+
}
168209
}

0 commit comments

Comments
 (0)