Skip to content

Conversation

@Mayank4352
Copy link
Contributor

@Mayank4352 Mayank4352 commented Oct 10, 2025

Description

Search for Live Rooms capability has been added within the rooms interface. Users should be able to type in a search query and instantly search from the list of available rooms to find the one they want to join.

Fixes #556

Type of change

  • New feature (non-breaking change which adds functionality

How Has This Been Tested?

Tested Locally

Please include screenshots below if applicable.

WhatsApp.Video.2025-10-10.at.17.44.51_232e78de.mp4

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes
  • I have checked my code and corrected any misspellings

Maintainer Checklist

Summary by CodeRabbit

New Features

  • Added room search with live filtering and real-time results
  • Introduced search overlay interface integrated into home screen
  • Search supports both live and upcoming rooms
  • Quick clear search action available

Localization

  • Extended language support with search UI text for English, Hindi, and Gujarati

@github-actions
Copy link
Contributor

🎉 Welcome @Mayank4352!
Thank you for your pull request! Our team will review it soon. 🔍

  • Please ensure your PR follows the contribution guidelines. ✅
  • All automated tests should pass before merging. 🔄
  • If this PR fixes an issue, link it in the description. 🔗

We appreciate your contribution! 🚀

@coderabbitai
Copy link

coderabbitai bot commented Oct 10, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This pull request introduces live room search functionality by integrating MeiliSearch backend into RoomsController, adding reactive state management for search and filtered results, creating a new SearchOverlay UI component, updating home screen to display search UI with filtered room lists, and extending localization support across multiple languages for search-related strings.

Changes

Cohort / File(s) Summary
Search State Management
lib/controllers/rooms_controller.dart
Introduces MeiliSearch integration with reactive state variables (isSearching, searchBarIsEmpty, filteredRooms, filteredUpcomingRooms), MeiliSearch client initialization, public methods searchRooms() and convertMeilisearchResults() for querying and transforming results, and helper methods clearSearch() and updateFilteredRooms() for state management.
Localization Strings
lib/l10n/app_*.arb, lib/l10n/app_localizations.dart, lib/l10n/app_localizations_*.dart
Adds search-related localization keys (searchRooms, searchingRooms, clearSearch, searchError, searchRoomsError, search, clear) across English, Hindi, and Gujarati localization files with accompanying metadata and translations.
Home Screen UI Integration
lib/views/screens/home_screen.dart
Integrates search overlay into home screen with toggle control via app bar search action, wires RoomsController search methods to UI, updates CustomAppBarLiveRoom with onSearchTapped callback, conditionally displays filteredRooms in LiveRoomListView and filteredUpcomingRooms in UpcomingRoomsListView based on search state.
Search Overlay Widget
lib/views/widgets/search_rooms.dart
New SearchOverlay widget providing animated search interface with text input, clear button, loading indicator, auto-focus management, and lifecycle hooks (onSearchChanged callback, onClose callback).

Sequence Diagram

sequenceDiagram
    actor User
    participant HomeScreen
    participant SearchOverlay
    participant RoomsController
    participant MeiliSearch

    User->>HomeScreen: Taps search icon
    HomeScreen->>HomeScreen: Show SearchOverlay
    SearchOverlay->>SearchOverlay: Focus text input

    User->>SearchOverlay: Type search query
    SearchOverlay->>RoomsController: onSearchChanged(query)
    activate RoomsController
    RoomsController->>RoomsController: isSearching = true
    RoomsController->>MeiliSearch: searchRooms(query)
    alt MeiliSearch Available
        MeiliSearch-->>RoomsController: Return hits
        RoomsController->>RoomsController: convertMeilisearchResults()
    else Fallback to Local Search
        RoomsController->>RoomsController: Local filter
    end
    RoomsController->>RoomsController: updateFilteredRooms()
    deactivate RoomsController

    RoomsController-->>HomeScreen: filteredRooms updated
    HomeScreen->>HomeScreen: Rebuild LiveRoomListView<br/>display filteredRooms
    
    User->>SearchOverlay: Taps clear or back
    SearchOverlay->>RoomsController: onClose() → clearSearch()
    RoomsController->>RoomsController: Reset filters & state
    HomeScreen->>HomeScreen: Hide SearchOverlay
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

The changes introduce new search logic in the controller, integrate MeiliSearch with fallback mechanisms, add UI components with lifecycle management, and extend localization across multiple languages. While the individual pieces are straightforward, the heterogeneous nature (controller logic, UI widgets, localization entries, screen integration) and multiple file types require context-switching during review. The logic density is moderate with state management and conditional filtering logic.

Possibly related PRs

Poem

🐰 Whiskers twitch with glee,
Search fields bloom, so spry!
MeiliSearch wings set rooms free,
Quick queries satisfy,
Where conversations comply!

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "Added Room Search Functionality" directly and clearly summarizes the primary change across the entire changeset. The title accurately reflects the main objective of introducing search capabilities for rooms, which encompasses the MeiliSearch integration in the controller, the new SearchOverlay UI component, localization support, and home screen integration. The title is concise, descriptive, and avoids vague terminology, making it immediately clear to teammates reviewing the history what this PR accomplishes.
Linked Issues Check ✅ Passed The code changes comprehensively address all primary objectives from linked issue #556. The implementation includes a search input UI via the new SearchOverlay widget, instant filtering through the searchRooms method in RoomsController that supports both MeiliSearch and local fallback, backend integration with MeiliSearch indices for rooms and upcoming rooms, display of filtered results in LiveRoomListView and UpcomingRoomsListView, and clear search functionality. Additionally, full localization support has been added across multiple language files (English, Hindi, Gujarati), and the search capability is properly integrated into the home screen interface, fulfilling the feature request's goals of improving room discoverability and user experience.
Out of Scope Changes Check ✅ Passed All code changes are directly scoped to implementing the room search functionality specified in issue #556. The modifications include search state management and logic in RoomsController, new UI components for the search overlay, localization entries across multiple language files for search-related strings, integration of search functionality into the home screen, and a new SearchOverlay widget. No extraneous changes, unrelated refactoring, or modifications to unrelated features are present; every alteration contributes directly to enabling live room search.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@M4dhav M4dhav self-requested a review October 13, 2025 19:21
@M4dhav M4dhav added the enhancement New feature or request label Oct 13, 2025
@M4dhav M4dhav linked an issue Oct 13, 2025 that may be closed by this pull request
Copy link
Contributor

@M4dhav M4dhav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Mayank4352 , I think the UI can be improved, let's move the Search button to the right of the Live and Upcoming buttons on the same bar with them and then the search text field should open as sort of a popup on the lower listview when the search button is tapped, so that the searchbar doesn't permanently take up space on the screen

@Mayank4352
Copy link
Contributor Author

WhatsApp.Video.2025-10-14.at.10.41.27_d9b3b818.mp4

Hey @M4dhav I've Implemented the changes, Kindly review the changes

@Mayank4352 Mayank4352 requested a review from M4dhav October 14, 2025 05:48
@M4dhav
Copy link
Contributor

M4dhav commented Oct 14, 2025

Hey @Mayank4352 , is there a backend PR linked to this?

@Mayank4352
Copy link
Contributor Author

yes, there will be

@Mayank4352
Copy link
Contributor Author

Hey @M4dhav I've opened pr for meilisearch integration in backend kindly do review it aswell
AOSSIE-Org/Resonate-Backend#108

@M4dhav
Copy link
Contributor

M4dhav commented Oct 18, 2025

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Oct 18, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (10)
lib/l10n/app_hi.arb (1)

863-894: Unify Hindi terms (“रूम्स” vs “कमरों”).

Keep terminology consistent with existing strings that use “रूम/रूम्स”.

Apply this diff for consistency:

-    "searchingRooms": "रूम खोजे जा रहे हैं...",
+    "searchingRooms": "रूम्स खोजे जा रहे हैं...",
-    "searchRoomsError": "कमरों की खोज असफल हुई। कृपया दोबारा कोशिश करें।",
+    "searchRoomsError": "रूम्स की खोज असफल हुई। कृपया दोबारा कोशिश करें।",
-    "searchUpcomingRoomsError": "आगामी कमरों की खोज असफल हुई। कृपया दोबारा कोशिश करें।",
+    "searchUpcomingRoomsError": "आगामी रूम्स की खोज असफल हुई। कृपया दोबारा कोशिश करें।",
lib/l10n/app_localizations_hi.dart (1)

668-693: Optional: mirror the Hindi wording consistency here too.

If you adopt the ARB edits, reflect them in getters.

-  String get searchingRooms => 'रूम खोजे जा रहे हैं...';
+  String get searchingRooms => 'रूम्स खोजे जा रहे हैं...';
-  String get searchRoomsError =>
-      'कमरों की खोज असफल हुई। कृपया दोबारा कोशिश करें।';
+  String get searchRoomsError =>
+      'रूम्स की खोज असफल हुई। कृपया दोबारा कोशिश करें।';
-  String get searchUpcomingRoomsError =>
-      'आगामी कमरों की खोज असफल हुई। कृपया दोबारा कोशिश करें।';
+  String get searchUpcomingRoomsError =>
+      'आगामी रूम्स की खोज असफल हुई। कृपया दोबारा कोशिश करें।';
lib/controllers/rooms_controller.dart (6)

43-47: Avoid RxList aliasing; use assignAll/copy for filteredRooms.

Setting filteredRooms.value = rooms aliases lists; updates may not notify dependents correctly.

-    filteredRooms.value = rooms;
+    filteredRooms.assignAll(rooms);

And in clear/update:

-  void clearSearch() {
-    filteredRooms.value = rooms;
+  void clearSearch() {
+    filteredRooms.assignAll(rooms);
     searchBarIsEmpty.value = true;
   }

   void updateFilteredRooms() {
     if (searchBarIsEmpty.value) {
-      filteredRooms.value = rooms;
+      filteredRooms.assignAll(rooms);
     }
   }

Also applies to: 297-306


163-233: Debounce user input to avoid flooding queries.

Multiple calls per keystroke will spam Appwrite/Meili. Add a debounced worker or a Timer.

Additional code (outside this hunk):

// In controller:
final RxString searchText = ''.obs;
late final Worker _debounce;
@override
void onInit() {
  super.onInit();
  _debounce = debounce(searchText, (q) => searchRooms(q as String), time: const Duration(milliseconds: 300));
}
@override
void onClose() {
  _debounce.dispose();
  super.onClose();
}
// In UI: update controller.searchText(value) instead of calling searchRooms directly.

185-186: Prefer query-object API for MeiliSearch and restrict attributes searched.

Use IndexSearchQuery to future‑proof and limit scope to name/description/tags. Based on learnings.

-          final meilisearchResult = await indexToUse.search(query);
+          final meilisearchResult = await indexToUse.search(
+            query,
+            IndexSearchQuery(
+              attributesToSearchOn: ['name', 'description', 'tags'],
+              // Optionally: showRankingScoreDetails: false,
+            ),
+          );

235-295: N+1 Appwrite reads per search hit for avatars; consider deferring or batching.

Fetching participants for every hit increases latency/cost. Options:

  • Defer avatars (show placeholders in search list; fetch on room open).
  • Or batch by querying participants for all roomIds then map in memory (if API supports multi‑value equals).

Example (outline):

// 1) Collect ids:
final ids = meilisearchHits.map((h) => h['\$id'] as String).toList();
// 2) Batch fetch participants once (if supported) and build a map<roomId, avatars>.
// 3) Map hits -> AppwriteRoom using the prebuilt map without per-hit network calls.

235-295: Make converters typed; avoid dynamic.

Split into two methods for clarity and type safety.

-  Future<dynamic> convertMeilisearchResults(
+  Future<List<AppwriteRoom>> _convertLiveResults(
     List<Map<String, dynamic>> meilisearchHits, {
-    required bool isLiveRooms,
-    List<AppwriteUpcommingRoom>? originalUpcomingRooms,
+    // any extra deps
   }) async { ... }

+  List<AppwriteUpcommingRoom> _convertUpcomingResults(
+    List<Map<String, dynamic>> meilisearchHits, {
+    required List<AppwriteUpcommingRoom> originalUpcomingRooms,
+  }) { ... }

And call the appropriate one from searchRooms.


12-12: Naming nit: “Upcomming” → “Upcoming”.

If feasible in a separate PR, rename AppwriteUpcommingRoom and its file to avoid the typo and reduce future confusion.

lib/views/widgets/search_rooms.dart (2)

162-164: Redundant onChanged callback.

The onChanged callback is unnecessary since the controller listener (lines 45-50) already invokes widget.onSearchChanged on every text change.

Apply this diff to remove the redundant callback:

         decoration: InputDecoration(
           hintText: AppLocalizations.of(context)!.searchRooms,
           hintStyle: TextStyle(
             color: Theme.of(
               context,
             ).colorScheme.onSurface.withValues(alpha: 0.6),
           ),
           border: InputBorder.none,
           contentPadding: EdgeInsets.symmetric(
             horizontal: UiSizes.width_8,
             vertical: UiSizes.height_12,
           ),
         ),
-        onChanged: (value) {
-          widget.onSearchChanged(value);
-        },
         onSubmitted: (value) {
           _focusNode?.unfocus();
         },

194-194: Use more specific tooltip text.

Consider using clearSearch instead of clear for better clarity, as this button specifically clears the search input.

Apply this diff:

-                        tooltip: AppLocalizations.of(context)!.clear,
+                        tooltip: AppLocalizations.of(context)!.clearSearch,
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 64a2178 and 17a02a2.

📒 Files selected for processing (9)
  • lib/controllers/rooms_controller.dart (4 hunks)
  • lib/l10n/app_en.arb (2 hunks)
  • lib/l10n/app_hi.arb (1 hunks)
  • lib/l10n/app_localizations.dart (1 hunks)
  • lib/l10n/app_localizations_en.dart (1 hunks)
  • lib/l10n/app_localizations_gu.dart (1 hunks)
  • lib/l10n/app_localizations_hi.dart (1 hunks)
  • lib/views/screens/home_screen.dart (8 hunks)
  • lib/views/widgets/search_rooms.dart (1 hunks)
🔇 Additional comments (8)
lib/l10n/app_en.arb (2)

2-2: No action needed on locale marker change.


863-894: LGTM: added search strings/readable descriptions are consistent.

lib/l10n/app_localizations_en.dart (1)

666-690: LGTM: English getters align with ARB and usage.

lib/views/widgets/search_rooms.dart (1)

165-167: Clarify submit behavior.

The onSubmitted callback only unfocuses the input. Consider whether pressing Enter should close the overlay (by calling _closeOverlay()) or remain as-is to keep the overlay open while hiding the keyboard.

If the intent is to close the overlay on submit, apply this diff:

         onSubmitted: (value) {
-          _focusNode?.unfocus();
+          _closeOverlay();
         },
lib/l10n/app_localizations.dart (1)

1357-1403: LGTM!

The new localization getters for search functionality are well-documented and follow the existing patterns in the codebase.

lib/views/screens/home_screen.dart (3)

178-248: LGTM!

The search integration for upcoming rooms is well-implemented with proper empty states and clear user feedback for no results vs. no rooms.


250-336: LGTM!

The live room search implementation provides good UX with loading indicators, search results, and helpful empty states.


123-176: LGTM!

The search button integration in the app bar is clean and follows the existing patterns. The tooltip and styling are appropriate.

Comment on lines 28 to 39
RxBool isSearching = false.obs;
RxBool searchBarIsEmpty = true.obs;
RxList<AppwriteRoom> filteredRooms = <AppwriteRoom>[].obs;
RxList<AppwriteUpcommingRoom> filteredUpcomingRooms =
<AppwriteUpcommingRoom>[].obs;
final MeiliSearchClient meilisearchClient = MeiliSearchClient(
meilisearchEndpoint,
meilisearchApiKey,
);
late final MeiliSearchIndex roomsIndex;
late final MeiliSearchIndex upcomingRoomsIndex;

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify MeiliSearch API key scope and exposure.

Ensure meilisearchApiKey is a search‑only key (not master/admin) and isn’t hard‑coded in source control.


🏁 Script executed:

#!/bin/bash
# Inspect constants and usages to ensure a scoped search key is used and not inlined.
rg -n --no-ignore -C2 -e 'meilisearch(Api)?Key|Meili(Search)?(Key|API)' -e 'meilisearchEndpoint' \
  -g '!*build*' -g '!*ios*' -g '!*android*' -g '!*web/*'
# Show constant definition
fd -a constants.dart | xargs -I{} sh -c 'echo "---- {} ----"; sed -n "1,200p" "{}"'

Length of output: 6174


Use a search-only API key for MeiliSearch, not a master key; remove hardcoded default.

The meilisearchApiKey default value 'myMasterKey' is a master/admin key, not a search-only key, posing a security risk. Remove the hardcoded default or use an empty string/throw on missing environment variable to enforce explicit configuration in production.

🤖 Prompt for AI Agents
In lib/controllers/rooms_controller.dart around lines 28 to 39, the code
instantiates MeiliSearchClient with a hardcoded master API key
(meilisearchApiKey defaulting to 'myMasterKey'); replace this by removing the
hardcoded default and require an explicit search-only key at runtime: read the
key from configuration/environment without a fallback master value, validate it
at startup (throw or log and exit if missing or empty), and ensure
documentation/config uses a MeiliSearch search-only API key rather than a
master/admin key.

Comment on lines 163 to 233
Future<void> searchRooms(
String query, {
bool isLiveRooms = true,
List<AppwriteUpcommingRoom>? upcomingRooms,
}) async {
if (query.isEmpty) {
if (isLiveRooms) {
filteredRooms.value = rooms;
searchBarIsEmpty.value = true;
} else {
filteredUpcomingRooms.value = upcomingRooms ?? [];
}
return;
}
if (isLiveRooms) {
isSearching.value = true;
searchBarIsEmpty.value = false;
}
try {
if (isUsingMeilisearch) {
try {
final indexToUse = isLiveRooms ? roomsIndex : upcomingRoomsIndex;
final meilisearchResult = await indexToUse.search(query);

if (isLiveRooms) {
filteredRooms.value = await convertMeilisearchResults(
meilisearchResult.hits,
isLiveRooms: true,
);
} else {
filteredUpcomingRooms.value = await convertMeilisearchResults(
meilisearchResult.hits,
isLiveRooms: false,
originalUpcomingRooms: upcomingRooms ?? [],
);
}
return;
} catch (meilisearchError) {
log(
'Meilisearch failed, falling back to local search: $meilisearchError',
);
}
}
// Local search
final lowerQuery = query.toLowerCase();
if (isLiveRooms) {
filteredRooms.value = rooms.where((room) {
return room.name.toLowerCase().contains(lowerQuery) ||
room.description.toLowerCase().contains(lowerQuery) ||
room.tags.any((tag) => tag.toLowerCase().contains(lowerQuery));
}).toList();
} else {
filteredUpcomingRooms.value = (upcomingRooms ?? []).where((room) {
return room.name.toLowerCase().contains(lowerQuery) ||
room.description.toLowerCase().contains(lowerQuery) ||
room.tags.any((tag) => tag.toLowerCase().contains(lowerQuery));
}).toList();
}
} catch (e) {
log('Error searching ${isLiveRooms ? 'rooms' : 'upcoming rooms'}: $e');
if (isLiveRooms) {
filteredRooms.value = [];
} else {
filteredUpcomingRooms.value = [];
}
} finally {
if (isLiveRooms) {
isSearching.value = false;
}
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Filter out reported rooms in search results (consistency with getRooms).

Currently, search can surface rooms that getRooms filtered out (reportedUsers contains current user).

-          if (isLiveRooms) {
-            filteredRooms.value = await convertMeilisearchResults(
+          if (isLiveRooms) {
+            final meiliHits = await convertMeilisearchResults(
               meilisearchResult.hits,
               isLiveRooms: true,
             );
+            final uid = Get.find<AuthStateController>().uid!;
+            filteredRooms.assignAll(
+              meiliHits.where((r) => !r.reportedUsers.contains(uid)),
+            );
             ...

Also apply the same filter after the local search branch if you ever remove the getRooms pre-filter:

-        filteredRooms.value = rooms.where((room) {
+        final uid = Get.find<AuthStateController>().uid!;
+        filteredRooms.assignAll(rooms.where((room) {
           return room.name.toLowerCase().contains(lowerQuery) ||
                  room.description.toLowerCase().contains(lowerQuery) ||
                  room.tags.any((tag) => tag.toLowerCase().contains(lowerQuery));
-        }).toList();
+        }).where((r) => !r.reportedUsers.contains(uid)).toList());

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines +666 to +690
@override
String get searchRooms => 'Search rooms...';

@override
String get searchingRooms => 'Searching rooms...';

@override
String get clearSearch => 'Clear search';

@override
String get searchError => 'Search Error';

@override
String get searchRoomsError => 'Failed to search rooms. Please try again.';

@override
String get searchUpcomingRoomsError =>
'Failed to search upcoming rooms. Please try again.';

@override
String get search => 'Search';

@override
String get clear => 'Clear';

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Localize Gujarati strings (currently English).

Translate to match locale for a consistent experience.

-  String get searchRooms => 'Search rooms...';
+  String get searchRooms => 'રૂમ્સ શોધો...';
-  String get searchingRooms => 'Searching rooms...';
+  String get searchingRooms => 'રૂમ્સ શોધી રહ્યા છીએ...';
-  String get clearSearch => 'Clear search';
+  String get clearSearch => 'શોધ સાફ કરો';
-  String get searchError => 'Search Error';
+  String get searchError => 'શોધ ભૂલ';
-  String get searchRoomsError => 'Failed to search rooms. Please try again.';
+  String get searchRoomsError => 'રૂમ્સ શોધવામાં નિષ્ફળ. કૃપા કરીને ફરી પ્રયાસ કરો.';
-  String get searchUpcomingRoomsError =>
-      'Failed to search upcoming rooms. Please try again.';
+  String get searchUpcomingRoomsError =>
+      'આગામી રૂમ્સ શોધવામાં નિષ્ફળ. કૃપા કરીને ફરી પ્રયાસ કરો.';
-  String get search => 'Search';
+  String get search => 'શોધો';
-  String get clear => 'Clear';
+  String get clear => 'સાફ કરો';
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@override
String get searchRooms => 'Search rooms...';
@override
String get searchingRooms => 'Searching rooms...';
@override
String get clearSearch => 'Clear search';
@override
String get searchError => 'Search Error';
@override
String get searchRoomsError => 'Failed to search rooms. Please try again.';
@override
String get searchUpcomingRoomsError =>
'Failed to search upcoming rooms. Please try again.';
@override
String get search => 'Search';
@override
String get clear => 'Clear';
@override
String get searchRooms => 'રૂમ્સ શોધો...';
@override
String get searchingRooms => 'રૂમ્સ શોધી રહ્યા છીએ...';
@override
String get clearSearch => 'શોધ સાફ કરો';
@override
String get searchError => 'શોધ ભૂલ';
@override
String get searchRoomsError => 'રૂમ્સ શોધવામાં નિષ્ફળ. કૃપા કરીને ફરી પ્રયાસ કરો.';
@override
String get searchUpcomingRoomsError =>
'આગામી રૂમ્સ શોધવામાં નિષ્ફળ. કૃપા કરીને ફરી પ્રયાસ કરો.';
@override
String get search => 'શોધો';
@override
String get clear => 'સાફ કરો';
🤖 Prompt for AI Agents
In lib/l10n/app_localizations_gu.dart around lines 666 to 690 the getters return
English strings instead of Gujarati; replace each English string with its
correct Gujarati translation while preserving exact getter names, punctuation
and any ellipses; ensure translations are accurate and natural Gujarati (e.g.,
"Search rooms..." -> appropriate Gujarati equivalent including the trailing
ellipsis), "Search" -> Gujarati, "Clear" -> Gujarati, and error messages
likewise, keeping single-quoted string literals and escaping any characters as
per file conventions.

Comment on lines 95 to 115
SearchOverlay(
isVisible: _showSearchOverlay,
onSearchChanged: (query) {
roomsController.searchRooms(
query,
isLiveRooms: isLiveSelected,
upcomingRooms: isLiveSelected
? null
: upcomingRoomsController.upcomingRooms,
);
},
onClose: () {
setState(() {
_showSearchOverlay = false;
});
roomsController.clearSearch();
},
isSearching: isLiveSelected
? roomsController.isSearching.value
: false,
),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Loading state missing for upcoming room search.

The isSearching parameter (lines 112-114) is only set to roomsController.isSearching.value when isLiveSelected is true. When searching upcoming rooms, isSearching is always false, so no loading indicator is shown.

Apply this diff to show loading state for both room types:

             isSearching: isLiveSelected
                 ? roomsController.isSearching.value
-                : false,
+                : roomsController.isSearching.value,
🤖 Prompt for AI Agents
In lib/views/screens/home_screen.dart around lines 95 to 115, the
SearchOverlay's isSearching currently only uses
roomsController.isSearching.value when isLiveSelected is true, so upcoming room
searches never show a loading state; update the isSearching argument to choose
the correct controller based on isLiveSelected (e.g. use
roomsController.isSearching.value when isLiveSelected is true, otherwise use
upcomingRoomsController.isSearching.value), ensuring you access the proper
observable/value safely to avoid null-safety issues.

Comment on lines 86 to 89
void _clearSearch() {
_searchController.clear();
widget.onSearchChanged('');
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Duplicate callback invocation.

The _searchController.clear() on line 87 triggers the listener (lines 45-50), which already calls widget.onSearchChanged(_searchController.text). The explicit call on line 88 is redundant and causes onSearchChanged to be invoked twice with an empty string.

Apply this diff to remove the duplicate call:

 void _clearSearch() {
   _searchController.clear();
-  widget.onSearchChanged('');
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
void _clearSearch() {
_searchController.clear();
widget.onSearchChanged('');
}
void _clearSearch() {
_searchController.clear();
}
🤖 Prompt for AI Agents
In lib/views/widgets/search_rooms.dart around lines 86 to 89, the _clearSearch
method clears the _searchController which already triggers the controller
listener to call widget.onSearchChanged(''), so remove the redundant explicit
widget.onSearchChanged('') call; update _clearSearch to only call
_searchController.clear() (and leave any existing listener logic unchanged) so
onSearchChanged is invoked once.

@M4dhav
Copy link
Contributor

M4dhav commented Oct 18, 2025

Hey @Mayank4352 , based on. one of CodeRabbit's comments, I realised that we don't actually need the meilisearch integration for this feature, as we are not fetching the records from the server and instead just filtering the locally fetched rooms. As a result, you can remove the meilisearch integration. I believe with this the Backend PR will also become obsolete, so feel free to close that whenever

Copy link
Contributor

@M4dhav M4dhav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please comment on my assessment, and if you agree, please remove meilisearch from the added functions.

@Mayank4352
Copy link
Contributor Author

Yes, I thought about the same at time of implementing but after seeing your integration of meilisearch, I figured maybe we'll be switching to a server in future. Sure, I'll close the PR on the backend and make the changes.
Happy Diwali!!

@Mayank4352
Copy link
Contributor Author

Hey @M4dhav , I've removed the meilisearch integrations you can review the rest

Comment on lines 30 to 31
RxList<AppwriteUpcommingRoom> filteredUpcomingRooms =
<AppwriteUpcommingRoom>[].obs;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Search Logic for Upcoming rooms should be in the Upcoming Rooms Controller

}
}

Future<void> searchRooms(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refactor to put upcoming rooms search login in upcoming rooms controller

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Add Live Room Search Functionality

2 participants