Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
chore: update logs
Nathan437deaf98635
diff --git a/frontend/appflowy_flutter/integration_test/desktop/command_palette/folder_search_test.dart b/frontend/appflowy_flutter/integration_test/desktop/command_palette/folder_search_test.dartindex 265d313320..a1d7f12667 100644--- a/frontend/appflowy_flutter/integration_test/desktop/command_palette/folder_search_test.dart+++ b/frontend/appflowy_flutter/integration_test/desktop/command_palette/folder_search_test.dart@@ -44,11 +44,11 @@ void main() {await tester.pumpAndSettle(const Duration(milliseconds: 200));// Expect two search results "ViewOna" and "ViewOne" (Distance 1 to ViewOna)- expect(find.byType(SearchResultTile), findsNWidgets(2));+ expect(find.byType(SearchResultCell), findsNWidgets(2));// The score should be higher for "ViewOna" thus it should be shown firstfinal secondDocumentWidget = tester- .widget(find.byType(SearchResultTile).first) as SearchResultTile;+ .widget(find.byType(SearchResultCell).first) as SearchResultCell;expect(secondDocumentWidget.item.data, secondDocument);// Change search to "ViewOne"@@ -57,8 +57,8 @@ void main() {// The score should be higher for "ViewOne" thus it should be shown firstfinal firstDocumentWidget = tester.widget(- find.byType(SearchResultTile).first,- ) as SearchResultTile;+ find.byType(SearchResultCell).first,+ ) as SearchResultCell;expect(firstDocumentWidget.item.data, firstDocument);});@@ -89,11 +89,11 @@ void main() {);await tester.enterText(searchFieldFinder, 'Page-$randomValue');await tester.pumpAndSettle(const Duration(milliseconds: 200));- expect(find.byType(SearchResultTile), findsNWidgets(2));+ expect(find.byType(SearchResultCell), findsNWidgets(2));/// check resultsfinal svgs = find.descendant(- of: find.byType(SearchResultTile),+ of: find.byType(SearchResultCell),matching: find.byType(FlowySvg),);expect(svgs, findsNWidgets(2));diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_result_tile.dart b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_result_tile.dartindex a11721d1c3..551823f08e 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_result_tile.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_result_tile.dart@@ -13,23 +13,25 @@ import 'package:flowy_infra_ui/widget/spacing.dart';import 'package:flutter/material.dart';import 'package:flutter/services.dart';-class SearchResultTile extends StatefulWidget {- const SearchResultTile({+class SearchResultCell extends StatefulWidget {+ const SearchResultCell({super.key,required this.item,required this.onSelected,+ required this.onHover,this.isTrashed = false,});final SearchResponseItemPB item;final VoidCallback onSelected;+ final Function(SearchResponseItemPB) onHover;final bool isTrashed;@override- State<SearchResultTile> createState() => _SearchResultTileState();+ State<SearchResultCell> createState() => _SearchResultCellState();}-class _SearchResultTileState extends State<SearchResultTile> {+class _SearchResultCellState extends State<SearchResultCell> {bool _hasFocus = false;final focusNode = FocusNode();@@ -132,33 +134,36 @@ class _SearchResultTileState extends State<SearchResultTile> {);}- return GestureDetector(- behavior: HitTestBehavior.opaque,- onTap: _handleSelection,- child: Focus(- focusNode: focusNode,- onKeyEvent: (node, event) {- if (event is! KeyDownEvent) return KeyEventResult.ignored;- if (event.logicalKey == LogicalKeyboardKey.enter) {- _handleSelection();- return KeyEventResult.handled;- }- return KeyEventResult.ignored;- },- onFocusChange: (hasFocus) => setState(() => _hasFocus = hasFocus),- child: FlowyHover(- isSelected: () => _hasFocus,- style: HoverStyle(- borderRadius: BorderRadius.circular(8),- hoverColor:- Theme.of(context).colorScheme.primary.withValues(alpha: 0.1),- foregroundColorOnHover: AFThemeExtension.of(context).textColor,- ),- child: Padding(- padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 6),- child: ConstrainedBox(- constraints: const BoxConstraints(minHeight: 30),- child: tileContent,+ return MouseRegion(+ onEnter: (_) => widget.onHover(widget.item),+ child: GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTap: _handleSelection,+ child: Focus(+ focusNode: focusNode,+ onKeyEvent: (node, event) {+ if (event is! KeyDownEvent) return KeyEventResult.ignored;+ if (event.logicalKey == LogicalKeyboardKey.enter) {+ _handleSelection();+ return KeyEventResult.handled;+ }+ return KeyEventResult.ignored;+ },+ onFocusChange: (hasFocus) => setState(() => _hasFocus = hasFocus),+ child: FlowyHover(+ isSelected: () => _hasFocus,+ style: HoverStyle(+ borderRadius: BorderRadius.circular(8),+ hoverColor:+ Theme.of(context).colorScheme.primary.withValues(alpha: 0.1),+ foregroundColorOnHover: AFThemeExtension.of(context).textColor,+ ),+ child: Padding(+ padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 6),+ child: ConstrainedBox(+ constraints: const BoxConstraints(minHeight: 30),+ child: tileContent,+ ),),),),diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_results_list.dart b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_results_list.dartindex b2ca24b68f..2eb3b44b3e 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_results_list.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_results_list.dart@@ -7,7 +7,7 @@ import 'package:appflowy_backend/protobuf/flowy-search/result.pb.dart';import 'package:easy_localization/easy_localization.dart';import 'package:flowy_infra_ui/flowy_infra_ui.dart';-class SearchResultList extends StatelessWidget {+class SearchResultList extends StatefulWidget {const SearchResultList({required this.trash,required this.resultItems,@@ -19,6 +19,13 @@ class SearchResultList extends StatelessWidget {final List<SearchResponseItemPB> resultItems;final List<SearchSummaryPB> resultSummaries;+ @override+ State<SearchResultList> createState() => _SearchResultListState();+}++class _SearchResultListState extends State<SearchResultList> {+ dynamic _selectedCellData;+Widget _buildSectionHeader(String title) => Padding(padding: const EdgeInsets.symmetric(vertical: 8) +const EdgeInsets.only(left: 8),@@ -28,6 +35,18 @@ class SearchResultList extends StatelessWidget {),);+ void _onHoverSummary(SearchSummaryPB summary) {+ setState(() {+ _selectedCellData = summary;+ });+ }++ void _onHoverResult(SearchResponseItemPB item) {+ setState(() {+ _selectedCellData = item;+ });+ }+Widget _buildSummariesSection() {return Column(crossAxisAlignment: CrossAxisAlignment.start,@@ -36,10 +55,11 @@ class SearchResultList extends StatelessWidget {ListView.separated(physics: const NeverScrollableScrollPhysics(),shrinkWrap: true,- itemCount: resultSummaries.length,+ itemCount: widget.resultSummaries.length,separatorBuilder: (_, __) => const Divider(height: 0),- itemBuilder: (_, index) => SearchSummaryTile(- summary: resultSummaries[index],+ itemBuilder: (_, index) => SearchSummaryCell(+ summary: widget.resultSummaries[index],+ onHover: _onHoverSummary,),),],@@ -55,14 +75,15 @@ class SearchResultList extends StatelessWidget {ListView.separated(physics: const NeverScrollableScrollPhysics(),shrinkWrap: true,- itemCount: resultItems.length,+ itemCount: widget.resultItems.length,separatorBuilder: (_, __) => const Divider(height: 0),itemBuilder: (_, index) {- final item = resultItems[index];- return SearchResultTile(+ final item = widget.resultItems[index];+ return SearchResultCell(item: item,onSelected: () => FlowyOverlay.pop(context),- isTrashed: trash.any((t) => t.id == item.viewId),+ isTrashed: widget.trash.any((t) => t.id == item.viewId),+ onHover: _onHoverResult,);},),@@ -74,31 +95,127 @@ class SearchResultList extends StatelessWidget {Widget build(BuildContext context) {return Padding(padding: const EdgeInsets.symmetric(horizontal: 6),- child: ListView(- shrinkWrap: true,- physics: const ClampingScrollPhysics(),+ child: Row(children: [- if (resultSummaries.isNotEmpty) _buildSummariesSection(),- const VSpace(10),- if (resultItems.isNotEmpty) _buildResultsSection(context),+ Flexible(+ flex: 7,+ child: ListView(+ shrinkWrap: true,+ physics: const ClampingScrollPhysics(),+ children: [+ if (widget.resultSummaries.isNotEmpty) _buildSummariesSection(),+ const VSpace(10),+ if (widget.resultItems.isNotEmpty)+ _buildResultsSection(context),+ ],+ ),+ ),+ Flexible(+ flex: 3,+ child: SearchCellDetail(cellData: _selectedCellData),+ ),],),);}}-class SearchSummaryTile extends StatelessWidget {- const SearchSummaryTile({required this.summary, super.key});+class SearchCellDetail extends StatelessWidget {+ const SearchCellDetail({+ super.key,+ required this.cellData,+ });++ final dynamic cellData;++ @override+ Widget build(BuildContext context) {+ if (cellData == null) {+ return const Padding(+ padding: EdgeInsets.all(16.0),+ child: Center(+ child: FlowyText(+ 'Hover over an item to see details',+ fontSize: 12,+ color: Colors.grey,+ ),+ ),+ );+ }++ if (cellData is SearchSummaryPB) {+ return Padding(+ padding: const EdgeInsets.all(16.0),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ const FlowyText(+ 'AI Summary',+ fontSize: 14,+ fontWeight: FontWeight.bold,+ ),+ const VSpace(8),+ FlowyText(+ cellData.content,+ fontSize: 12,+ ),+ ],+ ),+ );+ }++ if (cellData is SearchResponseItemPB) {+ final item = cellData as SearchResponseItemPB;+ return Padding(+ padding: const EdgeInsets.all(16.0),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ FlowyText(+ item.data,+ fontSize: 14,+ fontWeight: FontWeight.bold,+ ),+ const VSpace(8),+ if (item.preview.isNotEmpty)+ FlowyText(+ item.preview,+ fontSize: 12,+ ),+ ],+ ),+ );+ }++ return const SizedBox.shrink();+ }+}++class SearchSummaryCell extends StatefulWidget {+ const SearchSummaryCell({+ required this.summary,+ required this.onHover,+ super.key,+ });final SearchSummaryPB summary;+ final Function(SearchSummaryPB) onHover;+ @override+ State<SearchSummaryCell> createState() => _SearchSummaryCellState();+}++class _SearchSummaryCellState extends State<SearchSummaryCell> {@overrideWidget build(BuildContext context) {- return Padding(- padding: const EdgeInsets.symmetric(horizontal: 12),- child: FlowyText(- summary.content,- maxLines: 10,+ return MouseRegion(+ onEnter: (_) => widget.onHover(widget.summary),+ child: Padding(+ padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),+ child: FlowyText(+ widget.summary.content,+ maxLines: 3,+ ),),);}diff --git a/frontend/appflowy_flutter/macos/Podfile.lock b/frontend/appflowy_flutter/macos/Podfile.lockindex 30ee626f09..b4a1a3d20d 100644--- a/frontend/appflowy_flutter/macos/Podfile.lock+++ b/frontend/appflowy_flutter/macos/Podfile.lock@@ -144,34 +144,34 @@ EXTERNAL SOURCES::path: Flutter/ephemeral/.symlinks/plugins/window_manager/macosSPEC CHECKSUMS:- app_links: 9028728e32c83a0831d9db8cf91c526d16cc5468- appflowy_backend: 464aeb3e5c6966a41641a2111e5ead72ce2695f7- auto_updater_macos: 3a42f1a06be6981f1a18be37e6e7bf86aa732118- bitsdojo_window_macos: 7959fb0ca65a3ccda30095c181ecb856fae48ea9- connectivity_plus: e74b9f74717d2d99d45751750e266e55912baeb5- desktop_drop: e0b672a7d84c0a6cbc378595e82cdb15f2970a43- device_info_plus: a56e6e74dbbd2bb92f2da12c64ddd4f67a749041- file_selector_macos: 6280b52b459ae6c590af5d78fc35c7267a3c4b31- flowy_infra_ui: 8760ff42a789de40bf5007a5f176b454722a341e+ app_links: 10e0a0ab602ffaf34d142cd4862f29d34b303b2a+ appflowy_backend: 865496343de667fc8c600e04b9fd05234e130cf9+ auto_updater_macos: 3e3462c418fe4e731917eacd8d28eef7af84086d+ bitsdojo_window_macos: 44e3b8fe3dd463820e0321f6256c5b1c16bb6a00+ connectivity_plus: 18d3c32514c886e046de60e9c13895109866c747+ desktop_drop: 69eeff437544aa619c8db7f4481b3a65f7696898+ device_info_plus: ce1b7762849d3ec103d0e0517299f2db7ad60720+ file_selector_macos: cc3858c981fe6889f364731200d6232dac1d812d+ flowy_infra_ui: 03301a39ad118771adbf051a664265c61c507f38FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24HotKey: 400beb7caa29054ea8d864c96f5ba7e5b4852277- hotkey_manager: b443f35f4d772162937aa73fd8995e579f8ac4e2- irondash_engine_context: 893c7d96d20ce361d7e996f39d360c4c2f9869ba- local_notifier: ebf072651e35ae5e47280ad52e2707375cb2ae4e- package_info_plus: f0052d280d17aa382b932f399edf32507174e870- path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564+ hotkey_manager: c32bf0bfe8f934b7bc17ab4ad5c4c142960b023c+ irondash_engine_context: da62996ee25616d2f01bbeb85dc115d813359478+ local_notifier: e9506bc66fc70311e8bc7291fb70f743c081e4ff+ package_info_plus: 12f1c5c2cfe8727ca46cbd0b26677728972d9a5b+ path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46ReachabilitySwift: 32793e867593cfc1177f5d16491e3a197d2fccda- screen_retriever_macos: 452e51764a9e1cdb74b3c541238795849f21557f+ screen_retriever_macos: 776e0fa5d42c6163d2bf772d22478df4b302b161Sentry: 1fe34e9c2cbba1e347623610d26db121dcb569f1- sentry_flutter: e24b397f9a61fa5bbefd8279c3b2242ca86faa90- share_plus: 510bf0af1a42cd602274b4629920c9649c52f4cc- shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7+ sentry_flutter: a39c2a2d67d5e5b9cb0b94a4985c76dd5b3fc737+ share_plus: 1fa619de8392a4398bfaf176d441853922614e89+ shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78Sparkle: 5f8960a7a119aa7d45dacc0d5837017170bc5675- sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0- super_native_extensions: c2795d6d9aedf4a79fae25cb6160b71b50549189- url_launcher_macos: 0fba8ddabfc33ce0a9afe7c5fef5aab3d8d2d673- webview_flutter_wkwebview: 44d4dee7d7056d5ad185d25b38404436d56c547c- window_manager: 1d01fa7ac65a6e6f83b965471b1a7fdd3f06166c+ sqflite_darwin: 5a7236e3b501866c1c9befc6771dfd73ffb8702d+ super_native_extensions: 85efee3a7495b46b04befcfc86ed12069264ebf3+ url_launcher_macos: c82c93949963e55b228a30115bd219499a6fe404+ webview_flutter_wkwebview: 0982481e3d9c78fd5c6f62a002fcd24fc791f1e4+ window_manager: 3a1844359a6295ab1e47659b1a777e36773cd6e8PODFILE CHECKSUM: 0532f3f001ca3110b8be345d6491fff690e95823diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lockindex fd3ae1a6b9..671d8bccf2 100644--- a/frontend/rust-lib/Cargo.lock+++ b/frontend/rust-lib/Cargo.lock@@ -493,7 +493,7 @@ checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f"[[package]]name = "app-error"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=c95dcc6bc7762d4b89d3d382e8ed2b6a68742ba6#c95dcc6bc7762d4b89d3d382e8ed2b6a68742ba6"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=873415478ed58686c98df578e2c39d07ddce6773#873415478ed58686c98df578e2c39d07ddce6773"dependencies = ["anyhow","bincode",@@ -513,7 +513,7 @@ dependencies = [[[package]]name = "appflowy-ai-client"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=c95dcc6bc7762d4b89d3d382e8ed2b6a68742ba6#c95dcc6bc7762d4b89d3d382e8ed2b6a68742ba6"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=873415478ed58686c98df578e2c39d07ddce6773#873415478ed58686c98df578e2c39d07ddce6773"dependencies = ["anyhow","bytes",@@ -1159,7 +1159,7 @@ dependencies = [[[package]]name = "client-api"version = "0.2.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=c95dcc6bc7762d4b89d3d382e8ed2b6a68742ba6#c95dcc6bc7762d4b89d3d382e8ed2b6a68742ba6"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=873415478ed58686c98df578e2c39d07ddce6773#873415478ed58686c98df578e2c39d07ddce6773"dependencies = ["again","anyhow",@@ -1214,7 +1214,7 @@ dependencies = [[[package]]name = "client-api-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=c95dcc6bc7762d4b89d3d382e8ed2b6a68742ba6#c95dcc6bc7762d4b89d3d382e8ed2b6a68742ba6"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=873415478ed58686c98df578e2c39d07ddce6773#873415478ed58686c98df578e2c39d07ddce6773"dependencies = ["collab-entity","collab-rt-entity",@@ -1227,7 +1227,7 @@ dependencies = [[[package]]name = "client-websocket"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=c95dcc6bc7762d4b89d3d382e8ed2b6a68742ba6#c95dcc6bc7762d4b89d3d382e8ed2b6a68742ba6"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=873415478ed58686c98df578e2c39d07ddce6773#873415478ed58686c98df578e2c39d07ddce6773"dependencies = ["futures-channel","futures-util",@@ -1499,7 +1499,7 @@ dependencies = [[[package]]name = "collab-rt-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=c95dcc6bc7762d4b89d3d382e8ed2b6a68742ba6#c95dcc6bc7762d4b89d3d382e8ed2b6a68742ba6"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=873415478ed58686c98df578e2c39d07ddce6773#873415478ed58686c98df578e2c39d07ddce6773"dependencies = ["anyhow","bincode",@@ -1521,7 +1521,7 @@ dependencies = [[[package]]name = "collab-rt-protocol"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=c95dcc6bc7762d4b89d3d382e8ed2b6a68742ba6#c95dcc6bc7762d4b89d3d382e8ed2b6a68742ba6"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=873415478ed58686c98df578e2c39d07ddce6773#873415478ed58686c98df578e2c39d07ddce6773"dependencies = ["anyhow","async-trait",@@ -1969,7 +1969,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"[[package]]name = "database-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=c95dcc6bc7762d4b89d3d382e8ed2b6a68742ba6#c95dcc6bc7762d4b89d3d382e8ed2b6a68742ba6"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=873415478ed58686c98df578e2c39d07ddce6773#873415478ed58686c98df578e2c39d07ddce6773"dependencies = ["bincode","bytes",@@ -3459,7 +3459,7 @@ dependencies = [[[package]]name = "gotrue"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=c95dcc6bc7762d4b89d3d382e8ed2b6a68742ba6#c95dcc6bc7762d4b89d3d382e8ed2b6a68742ba6"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=873415478ed58686c98df578e2c39d07ddce6773#873415478ed58686c98df578e2c39d07ddce6773"dependencies = ["anyhow","getrandom 0.2.10",@@ -3474,7 +3474,7 @@ dependencies = [[[package]]name = "gotrue-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=c95dcc6bc7762d4b89d3d382e8ed2b6a68742ba6#c95dcc6bc7762d4b89d3d382e8ed2b6a68742ba6"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=873415478ed58686c98df578e2c39d07ddce6773#873415478ed58686c98df578e2c39d07ddce6773"dependencies = ["app-error","jsonwebtoken",@@ -4098,7 +4098,7 @@ dependencies = [[[package]]name = "infra"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=c95dcc6bc7762d4b89d3d382e8ed2b6a68742ba6#c95dcc6bc7762d4b89d3d382e8ed2b6a68742ba6"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=873415478ed58686c98df578e2c39d07ddce6773#873415478ed58686c98df578e2c39d07ddce6773"dependencies = ["anyhow","bytes",@@ -6784,7 +6784,7 @@ dependencies = [[[package]]name = "shared-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=c95dcc6bc7762d4b89d3d382e8ed2b6a68742ba6#c95dcc6bc7762d4b89d3d382e8ed2b6a68742ba6"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=873415478ed58686c98df578e2c39d07ddce6773#873415478ed58686c98df578e2c39d07ddce6773"dependencies = ["anyhow","app-error",diff --git a/frontend/rust-lib/Cargo.toml b/frontend/rust-lib/Cargo.tomlindex 0a3cf409bb..8d8e11f6a0 100644--- a/frontend/rust-lib/Cargo.toml+++ b/frontend/rust-lib/Cargo.toml@@ -105,8 +105,8 @@ tantivy = { version = "0.24.0" }# Run the script.add_workspace_members:# scripts/tool/update_client_api_rev.sh new_rev_id# ⚠️⚠️⚠️️-client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "c95dcc6bc7762d4b89d3d382e8ed2b6a68742ba6" }-client-api-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "c95dcc6bc7762d4b89d3d382e8ed2b6a68742ba6" }+client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "873415478ed58686c98df578e2c39d07ddce6773" }+client-api-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "873415478ed58686c98df578e2c39d07ddce6773" }[profile.dev]opt-level = 0diff --git a/frontend/rust-lib/flowy-search/src/document/handler.rs b/frontend/rust-lib/flowy-search/src/document/handler.rsindex 45bf5864c7..b808b38e74 100644--- a/frontend/rust-lib/flowy-search/src/document/handler.rs+++ b/frontend/rust-lib/flowy-search/src/document/handler.rs@@ -1,6 +1,6 @@use crate::entities::{CreateSearchResultPBArgs, RepeatedSearchResponseItemPB, RepeatedSearchSummaryPB, SearchResultPB,- SearchSourcePB, SearchSummaryPB,+ SearchSummaryPB,};use crate::{entities::{IndexTypePB, ResultIconPB, ResultIconTypePB, SearchFilterPB, SearchResponseItemPB},@@ -82,7 +82,6 @@ impl SearchHandler for DocumentSearchHandler {},};- trace!("[Search] search results: {:?}", result_items);let summary_input = result_items.iter().map(|v| SearchResult {@@ -137,13 +136,8 @@ impl SearchHandler for DocumentSearchHandler {let summaries: Vec<SearchSummaryPB> = summary_result.summaries.into_iter()- .filter_map(|v| {- v.metadata.as_object().and_then(|object| {- let id = object.get("id")?.as_str()?.to_string();- let source = object.get("source")?.as_str()?.to_string();- let metadata = SearchSourcePB {id, source };- Some(SearchSummaryPB { content: v.content, metadata: Some(metadata) })- })+ .map(|v| {+ SearchSummaryPB { content: v.content, source_ids: v.sources.iter().map(|id| id.to_string()).collect() }}).collect();diff --git a/frontend/rust-lib/flowy-search/src/entities/result.rs b/frontend/rust-lib/flowy-search/src/entities/result.rsindex d7d6db0820..48de24728d 100644--- a/frontend/rust-lib/flowy-search/src/entities/result.rs+++ b/frontend/rust-lib/flowy-search/src/entities/result.rs@@ -28,8 +28,8 @@ pub struct SearchSummaryPB {#[pb(index = 1)]pub content: String,- #[pb(index = 2, one_of)]- pub metadata: Option<SearchSourcePB>,+ #[pb(index = 2)]+ pub source_ids: Vec<String>,}#[derive(ProtoBuf, Default, Debug, Clone)]diff --git a/frontend/rust-lib/flowy-search/src/services/manager.rs b/frontend/rust-lib/flowy-search/src/services/manager.rsindex 30c6783fb0..157781eceb 100644--- a/frontend/rust-lib/flowy-search/src/services/manager.rs+++ b/frontend/rust-lib/flowy-search/src/services/manager.rs@@ -62,16 +62,14 @@ impl SearchManager {search_id: String,) {// Cancel previous search by updating current_search- {- let mut current = self.current_search.lock().await;- *current = Some(search_id.clone());- }+ *self.current_search.lock().await = Some(search_id.clone());let handlers = self.handlers.clone();let sink = IsolateSink::new(Isolate::new(stream_port));let mut join_handles = vec![];let current_search = self.current_search.clone();+ tracing::info!("[Search] perform search: {}", query);for (_, handler) in handlers {let mut clone_sink = sink.clone();let query = query.clone();@@ -80,11 +78,16 @@ impl SearchManager {let current_search = current_search.clone();let handle = tokio::spawn(async move {+ if !is_current_search(¤t_search, &search_id).await {+ trace!("[Search] cancel search: {}", query);+ return;+ }+let mut stream = handler.perform_search(query.clone(), filter).await;while let Some(result) = stream.next().await {if !is_current_search(¤t_search, &search_id).await {- trace!("[Search] search changed, cancel search: {}", query);- break;+ trace!("[Search] discard search stream: {}", query);+ return;}if let Ok(result) = result {@@ -103,7 +106,7 @@ impl SearchManager {}if !is_current_search(¤t_search, &search_id).await {- trace!("[Search] search changed, cancel search: {}", query);+ trace!("[Search] discard search result: {}", query);return;}