@@ -102,6 +102,39 @@ public function movies_search_name_queries_use_exact_search_without_fuzzy_fallba
102102 $ this ->assertSame ('Resurrection.2025.1080p.WEB-DL.TEST ' , $ results [0 ]->searchname );
103103 }
104104
105+ #[Test]
106+ public function movies_search_mysql_fallback_excludes_unrelated_2025_and_resurrection_releases (): void
107+ {
108+ config (['nntmux.mysql_search_fallback ' => true ]);
109+
110+ $ mock = Mockery::mock (SearchService::class, [$ this ->app ]);
111+ $ mock ->shouldReceive ('searchReleasesByExternalId ' )->never ();
112+ $ mock ->shouldReceive ('searchReleases ' )->once ()->with (['searchname ' => 'Resurrection 2025 ' ], 1000 )->andReturn ([]);
113+ $ mock ->shouldReceive ('searchReleasesWithFuzzy ' )->never ();
114+ $ mock ->shouldReceive ('isAvailable ' )->andReturn (false );
115+
116+ $ this ->app ->instance (SearchService::class, $ mock );
117+
118+ $ service = new ReleaseSearchService ;
119+ $ results = $ service ->moviesSearch (
120+ '' ,
121+ -1 ,
122+ -1 ,
123+ 0 ,
124+ 100 ,
125+ 'Resurrection 2025 ' ,
126+ [2030 ],
127+ -1 ,
128+ 0 ,
129+ [],
130+ 'posted_desc '
131+ );
132+
133+ $ this ->assertCount (1 , $ results );
134+ $ this ->assertSame (['Resurrection.2025.1080p.WEB-DL.TEST ' ], $ results ->pluck ('searchname ' )->all ());
135+ $ this ->assertNotContains ('Titanic.The.Digital.Resurrection.2025.720p.WEBRip-LAMA ' , $ results ->pluck ('searchname ' )->all ());
136+ }
137+
105138 private function registerSqliteConcatIfNeeded (): void
106139 {
107140 if (DB ::getDriverName () !== 'sqlite ' ) {
@@ -215,6 +248,20 @@ private function seedData(): void
215248 'traktid ' => 2002 ,
216249 'title ' => 'Resurrection Road ' ,
217250 ],
251+ [
252+ 'id ' => 3 ,
253+ 'imdbid ' => '2468135 ' ,
254+ 'tmdbid ' => 1003 ,
255+ 'traktid ' => 2003 ,
256+ 'title ' => 'Drop ' ,
257+ ],
258+ [
259+ 'id ' => 4 ,
260+ 'imdbid ' => '1123581 ' ,
261+ 'tmdbid ' => 1004 ,
262+ 'traktid ' => 2004 ,
263+ 'title ' => 'Titanic: The Digital Resurrection ' ,
264+ ],
218265 ]);
219266
220267 $ now = now ()->toDateTimeString ();
@@ -252,6 +299,38 @@ private function seedData(): void
252299 'imdbid ' => '7654321 ' ,
253300 'movieinfo_id ' => 2 ,
254301 ],
302+ [
303+ 'id ' => 3 ,
304+ 'searchname ' => 'Drop.2025.2160p.BluRay.TEST ' ,
305+ 'guid ' => 'movie-guid-3 ' ,
306+ 'postdate ' => $ now ,
307+ 'adddate ' => $ now ,
308+ 'categories_id ' => 2030 ,
309+ 'groups_id ' => 1 ,
310+ 'size ' => 1000 ,
311+ 'totalpart ' => 1 ,
312+ 'passwordstatus ' => 0 ,
313+ 'grabs ' => 0 ,
314+ 'comments ' => 0 ,
315+ 'imdbid ' => '2468135 ' ,
316+ 'movieinfo_id ' => 3 ,
317+ ],
318+ [
319+ 'id ' => 4 ,
320+ 'searchname ' => 'Titanic.The.Digital.Resurrection.2025.720p.WEBRip-LAMA ' ,
321+ 'guid ' => 'movie-guid-4 ' ,
322+ 'postdate ' => $ now ,
323+ 'adddate ' => $ now ,
324+ 'categories_id ' => 2030 ,
325+ 'groups_id ' => 1 ,
326+ 'size ' => 1000 ,
327+ 'totalpart ' => 1 ,
328+ 'passwordstatus ' => 0 ,
329+ 'grabs ' => 0 ,
330+ 'comments ' => 0 ,
331+ 'imdbid ' => '1123581 ' ,
332+ 'movieinfo_id ' => 4 ,
333+ ],
255334 ]);
256335
257336 Release::clearBootedModels ();
0 commit comments