From 0d8ac302bef5f5327f743b0ecc402510a9abf75f Mon Sep 17 00:00:00 2001 From: fulleni Date: 2025年8月22日 20:29:21 +0100 Subject: [PATCH 1/4] fix(country): use Object instead of dynamic for empty list type - Change type of 'matchingSources' and 'matchingHeadlines' from List to List in country query service - This modification improves type safety and eliminates potential type-related issues --- lib/src/services/country_query_service.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/services/country_query_service.dart b/lib/src/services/country_query_service.dart index 1af081c..e51098f 100644 --- a/lib/src/services/country_query_service.dart +++ b/lib/src/services/country_query_service.dart @@ -174,7 +174,7 @@ class CountryQueryService { }); pipeline.add({ r'$match': { - 'matchingSources': {r'$ne': []}, + 'matchingSources': {r'$ne': []}, }, }); } @@ -202,7 +202,7 @@ class CountryQueryService { }); pipeline.add({ r'$match': { - 'matchingHeadlines': {r'$ne': []}, + 'matchingHeadlines': {r'$ne': []}, }, }); } From 7b78c6676407f499505dad1fc299e564023eaa37 Mon Sep 17 00:00:00 2001 From: fulleni Date: 2025年8月22日 20:39:31 +0100 Subject: [PATCH 2/4] refactor(country): improve type safety in aggregation pipeline - Change return type of _buildAggregationPipeline from List
    > to List
      > - Update pipeline variable type accordingly - Modify sortStage map type from dynamic to Object for better type safety --- lib/src/services/country_query_service.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/src/services/country_query_service.dart b/lib/src/services/country_query_service.dart index e51098f..39c121f 100644 --- a/lib/src/services/country_query_service.dart +++ b/lib/src/services/country_query_service.dart @@ -115,12 +115,12 @@ class CountryQueryService { } /// Builds the MongoDB aggregation pipeline based on the provided filters. - List
        > _buildAggregationPipeline( + List
          > _buildAggregationPipeline( Map filter, PaginationOptions? pagination, List? sort, ) { - final pipeline =
            >[]; + final pipeline =
              >[]; final compoundMatchStages =
                >[]; // --- Stage 1: Initial Match for active status, text search, and other filters --- @@ -209,7 +209,7 @@ class CountryQueryService { // --- Stage 4: Sorting --- if (sort != null && sort.isNotEmpty) { - final sortStage = {}; + final sortStage = {}; for (final option in sort) { sortStage[option.field] = option.order == SortOrder.asc ? 1 : -1; } From 0b9354cac7dabb49ef96d399031c97578381788d Mon Sep 17 00:00:00 2001 From: fulleni Date: 2025年8月22日 20:45:25 +0100 Subject: [PATCH 3/4] fix(country): update aggregation queries for country IDs - Change headquarters._id to headquarters.id in artist query - Change eventCountry._id to eventCountry.id in event query - Add $toString operator to ensure proper type comparison for countryId --- lib/src/services/country_query_service.dart | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/src/services/country_query_service.dart b/lib/src/services/country_query_service.dart index 39c121f..8361663 100644 --- a/lib/src/services/country_query_service.dart +++ b/lib/src/services/country_query_service.dart @@ -163,7 +163,10 @@ class CountryQueryService { { r'$match': { r'$expr': { - r'$eq': [r'$headquarters._id', r'$$countryId'], + r'$eq': [ + r'$headquarters.id', + {r'$toString': r'$$countryId'}, + ], }, 'status': ContentStatus.active.name, }, @@ -191,7 +194,10 @@ class CountryQueryService { { r'$match': { r'$expr': { - r'$eq': [r'$eventCountry._id', r'$$countryId'], + r'$eq': [ + r'$eventCountry.id', + {r'$toString': r'$$countryId'}, + ], }, 'status': ContentStatus.active.name, }, From e88fb059d83296193846f123009ec11b0eb9f69f Mon Sep 17 00:00:00 2001 From: fulleni Date: 2025年8月22日 20:56:59 +0100 Subject: [PATCH 4/4] fix(country): replace text search with regex for case-insensitive search - Replaced MongoDB text search with a case-insensitive regex search - This change affects the 'q' parameter handling in the CountryQueryService - The modification improves search functionality by making it case-insensitive --- lib/src/services/country_query_service.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/src/services/country_query_service.dart b/lib/src/services/country_query_service.dart index 8361663..9dc2ba7 100644 --- a/lib/src/services/country_query_service.dart +++ b/lib/src/services/country_query_service.dart @@ -131,7 +131,10 @@ class CountryQueryService { final qValue = filter['q']; if (qValue is String && qValue.isNotEmpty) { compoundMatchStages.add({ - r'$text': {r'$search': qValue}, + 'name': { + r'$regex': qValue, + r'$options': 'i', // Case-insensitive + }, }); }

                AltStyle によって変換されたページ (->オリジナル) /