diff --git a/app/Http/Controllers/Api/SearchController.php b/app/Http/Controllers/Api/SearchController.php index 1966ec2..c84381b 100644 --- a/app/Http/Controllers/Api/SearchController.php +++ b/app/Http/Controllers/Api/SearchController.php @@ -29,9 +29,7 @@ public function __invoke(Request $request) private function searchFor($q) { return Cache::remember(CacheKeys::packageSearchResults($q), self::CACHE_LENGTH, function () use ($q) { - return Package::search($q, function (SearchIndex $algolia, string $query, array $options) { - return $algolia->search($query, array_merge($options, ['advancedSyntax' => true])); - })->get()->load(['tags', 'author']); + return Package::search($q)->get()->load(['tags', 'author']); }); } } diff --git a/app/Http/Livewire/PackageList.php b/app/Http/Livewire/PackageList.php index c00145f..0388180 100644 --- a/app/Http/Livewire/PackageList.php +++ b/app/Http/Livewire/PackageList.php @@ -2,7 +2,6 @@ namespace App\Http\Livewire; -use Algolia\AlgoliaSearch\SearchIndex; use App\CacheKeys; use App\Package; use App\Tag; diff --git a/phpunit.xml b/phpunit.xml index b4b625b..8413a55 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -34,6 +34,6 @@ - + diff --git a/tests/Feature/SearchTest.php b/tests/Feature/SearchTest.php index 0681fb9..90116b9 100644 --- a/tests/Feature/SearchTest.php +++ b/tests/Feature/SearchTest.php @@ -10,13 +10,6 @@ class SearchTest extends TestCase { use RefreshDatabase; - protected function setUp(): void - { - parent::setUp(); - - $this->markTestIncomplete('Need to figure out how to test with Scout.'); - } - /** @test */ public function it_returns_matching_results(): void { diff --git a/tests/Unit/PackageTest.php b/tests/Unit/PackageTest.php index 3554929..edf7f3a 100644 --- a/tests/Unit/PackageTest.php +++ b/tests/Unit/PackageTest.php @@ -64,7 +64,7 @@ public function it_excludes_attributes_from_being_synchronized_to_the_scout_sear } /** @test */ - public function the_readme_is_truncated_to_500_characters_when_being_synchronized_with_the_scout_index(): void + public function the_readme_is_preserved_even_when_its_above_500_characters_when_being_synchronized_with_the_scout_index(): void { $package = Package::factory()->create([ 'readme' => Str::random(1400), @@ -72,7 +72,7 @@ public function the_readme_is_truncated_to_500_characters_when_being_synchronize $searchableArray = $package->toSearchableArray(); - $this->assertEquals(500, strlen($searchableArray['readme'])); + $this->assertEquals(1400, strlen($searchableArray['readme'])); } /**