@@ -2432,6 +2432,86 @@ func TestPerformerStore_FindByStashIDStatus(t *testing.T) {
24322432 }
24332433}
24342434
2435+ func TestPerformerQueryUnicodeSearchCaseInsensitive (t * testing.T ) {
2436+ withTxn (func (ctx context.Context ) error {
2437+ qb := db .Performer
2438+
2439+ // test cases with various Unicode characters
2440+ testCases := []struct {
2441+ name string
2442+ performerName string
2443+ searchTerm string
2444+ }{
2445+ {
2446+ "Cyrillic lowercase search" ,
2447+ "Анна" ,
2448+ "анна" ,
2449+ },
2450+ {
2451+ "Cyrillic uppercase search" ,
2452+ "мария" ,
2453+ "МАРИЯ" ,
2454+ },
2455+ {
2456+ "Accented Latin lowercase" ,
2457+ "Zoë" ,
2458+ "zoë" ,
2459+ },
2460+ {
2461+ "Accented Latin uppercase" ,
2462+ "chloé" ,
2463+ "CHLOÉ" ,
2464+ },
2465+ {
2466+ "Greek lowercase search" ,
2467+ "Έλενα" ,
2468+ "έλενα" ,
2469+ },
2470+ }
2471+
2472+ for _ , tc := range testCases {
2473+ t .Run (tc .name , func (t * testing.T ) {
2474+ // create performer with unicode name
2475+ performer := models.Performer {
2476+ Name : tc .performerName ,
2477+ }
2478+ err := qb .Create (ctx , & models.CreatePerformerInput {Performer : & performer })
2479+ if err != nil {
2480+ t .Fatalf ("Error creating performer: %s" , err .Error ())
2481+ }
2482+
2483+ // search using different case
2484+ findFilter := & models.FindFilterType {
2485+ Q : & tc .searchTerm ,
2486+ }
2487+
2488+ performers , _ , err := qb .Query (ctx , nil , findFilter )
2489+ if err != nil {
2490+ t .Fatalf ("Error querying performers: %s" , err .Error ())
2491+ }
2492+
2493+ // should find the performer regardless of case
2494+ found := false
2495+ for _ , p := range performers {
2496+ if p .ID == performer .ID {
2497+ found = true
2498+ break
2499+ }
2500+ }
2501+
2502+ assert .True (t , found )
2503+
2504+ // clean up
2505+ if err := qb .Destroy (ctx , performer .ID ); err != nil {
2506+ t .Fatalf ("Error cleaning up performer: %s" , err .Error ())
2507+ }
2508+ })
2509+ }
2510+
2511+ return nil
2512+ })
2513+ }
2514+
24352515// TODO Update
24362516// TODO Destroy
24372517// TODO Find
0 commit comments