mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
* fix: support filtering results by workspace * feat: add search button to sidebar * fix: reduce view/recent view fetching across application * feat: add channel to search listener * feat: clean + localization * chore: remove redundant code * fix: disable search * chore: trigger ci * chore: disable search in backend * test: disable search tests for now * feat: temp disable reliance on folder search * fix: add debounce to inline actions * chore: complete future if disposed * fix: clean code * chore: disable unused bloc with feature flag * fix: recent views lazy read * chore: revert podilfe change * chore: update logs * chore: update client api and collab * chore: fix tst * chore: fix test & update collab commit * chore: update collab commit * test: fix unit tests * chore: update rust toolchain 1.77 * chore: use opt-level 1 * fix: code review * chore: clippy --------- Co-authored-by: nathan <nathan@appflowy.io> Co-authored-by: Lucas.Xu <lucas.xu@appflowy.io>
28 lines
844 B
Rust
28 lines
844 B
Rust
use std::sync::{Arc, Weak};
|
|
|
|
use flowy_error::{FlowyError, FlowyResult};
|
|
use lib_dispatch::prelude::{AFPluginData, AFPluginState};
|
|
|
|
use crate::{entities::SearchQueryPB, services::manager::SearchManager};
|
|
|
|
fn upgrade_manager(
|
|
search_manager: AFPluginState<Weak<SearchManager>>,
|
|
) -> FlowyResult<Arc<SearchManager>> {
|
|
let manager = search_manager
|
|
.upgrade()
|
|
.ok_or(FlowyError::internal().with_context("The SearchManager has already been dropped"))?;
|
|
Ok(manager)
|
|
}
|
|
|
|
#[tracing::instrument(level = "debug", skip(manager), err)]
|
|
pub(crate) async fn search_handler(
|
|
data: AFPluginData<SearchQueryPB>,
|
|
manager: AFPluginState<Weak<SearchManager>>,
|
|
) -> Result<(), FlowyError> {
|
|
let query = data.into_inner();
|
|
let manager = upgrade_manager(manager)?;
|
|
manager.perform_search(query.search, query.filter, query.channel);
|
|
|
|
Ok(())
|
|
}
|