mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: search mvp (#5064)
* feat: implement folder indexer * feat: sqlite search views using fts5 * feat: add view indexing to user manager * feat: implement folder indexer * feat: add sqlite search documents * feat: add document indexing to user manager * feat: add document indexing to folder indexer * chore: update collab rev * feat: search frontend integration * refactor: search index * test: add event test * chore: fix ci * feat: initial command palette overlay impl (#4619) * chore: test search engine * chore: initial structure * chore: replace old search request * chore: enable log for lib-dispatch * chore: move search manager to core * feat: move traits and responsibility to search crate * feat: move search to search crate * feat: replace sqlite with tantivy * feat: deserialize tantivy documents * chore: fixes after rebase * chore: clean code * feat: fetch and sort results * fix: code review + cleaning * feat: support custom icons * feat: support view layout icons * feat: rename bloc and fix indexing * fix: prettify dialog * feat: score results * chore: update collab rev * feat: add recent view history to command palette * test: add integration_tests * fix: clippy changes * fix: focus traversal in cmd palette * fix: remove file after merging main * chore: code review and panic-safe * feat: index all views if index does not exist * chore: improve logic with conditional * chore: add is_empty check * chore: abstract logic from folder manager init * chore: update collab rev * chore: code review * chore: fixes after merge + update lock file * chore: revert cargo lock * fix: set icon type when removing icon * fix: code review + dependency inversion * fix: remove icon fix for not persisting icon type * test: simple tests manipulating views * test: create 100 views * fix: tauri build * chore: create 1000 views * chore: create util methods * chore: test * chore: test * chore: remove logs * chore: fix build.rs * chore: export models * chore: enable clear cache on Rust-CI * fix: navigate to newly created views * fix: force disable setting workspace listener on rebuilds * fix: remove late final * fix: missing returns * fix: localization and minor fixes * test: add index assert to large test * fix: missing section param after merging main * chore: try fix unzip file error * chore: lower the test * feat: show hint when result is in trash * feat: one index_writer per index * fix: minor changes after merge * fix: make create_log_filter public after merge * chore: fix test * chore: fix test * chore: flutter analyze * chore: flutter analyze * chore: fix tauri build --------- Co-authored-by: nathan <nathan@appflowy.io> Co-authored-by: Lucas.Xu <lucas.xu@appflowy.io> Co-authored-by: Nathan.fooo <86001920+appflowy@users.noreply.github.com>
This commit is contained in:
@ -14,7 +14,7 @@ bytes.workspace = true
|
||||
anyhow.workspace = true
|
||||
thiserror = "1.0"
|
||||
validator = "0.16.0"
|
||||
tokio = { workspace = true, features = ["sync"]}
|
||||
tokio = { workspace = true, features = ["sync", "rt"] }
|
||||
|
||||
fancy-regex = { version = "0.11.0" }
|
||||
lib-dispatch = { workspace = true, optional = true }
|
||||
@ -32,16 +32,23 @@ collab-document = { version = "0.1.0", optional = true }
|
||||
collab-plugins = { version = "0.1.0", optional = true }
|
||||
collab-folder = { version = "0.1.0", optional = true }
|
||||
client-api = { version = "0.1.0", optional = true }
|
||||
tantivy = { version = "0.21.1", optional = true }
|
||||
|
||||
|
||||
[features]
|
||||
impl_from_dispatch_error = ["lib-dispatch"]
|
||||
impl_from_serde = []
|
||||
impl_from_reqwest = ["reqwest"]
|
||||
impl_from_collab_persistence = ["collab-plugins"]
|
||||
impl_from_collab_document = ["collab-document", "impl_from_reqwest", "collab-plugins"]
|
||||
impl_from_collab_document = [
|
||||
"collab-document",
|
||||
"impl_from_reqwest",
|
||||
"collab-plugins",
|
||||
]
|
||||
impl_from_collab_folder = ["collab-folder"]
|
||||
impl_from_collab_database= ["collab-database"]
|
||||
impl_from_collab_database = ["collab-database"]
|
||||
impl_from_url = ["url"]
|
||||
impl_from_tantivy = ["tantivy"]
|
||||
|
||||
impl_from_sqlite = ["flowy-sqlite", "r2d2"]
|
||||
impl_from_appflowy_cloud = ["client-api"]
|
||||
@ -50,6 +57,4 @@ tauri_ts = ["flowy-codegen/ts"]
|
||||
web_ts = ["flowy-codegen/ts"]
|
||||
|
||||
[build-dependencies]
|
||||
flowy-codegen = { workspace = true, features = [
|
||||
"proto_gen",
|
||||
] }
|
||||
flowy-codegen = { workspace = true, features = ["proto_gen"] }
|
||||
|
@ -265,6 +265,18 @@ pub enum ErrorCode {
|
||||
|
||||
#[error("Workspace member limit exceeded")]
|
||||
WorkspaceMemberLimitExceeded = 92,
|
||||
|
||||
#[error("IndexWriter failed to commit")]
|
||||
IndexWriterFailedCommit = 93,
|
||||
|
||||
#[error("Failed to open Index directory")]
|
||||
FailedToOpenIndexDir = 94,
|
||||
|
||||
#[error("Failed to parse query")]
|
||||
FailedToParseQuery = 95,
|
||||
|
||||
#[error("FolderIndexManager or its dependencies are unavailable")]
|
||||
FolderIndexManagerUnavailable = 96,
|
||||
}
|
||||
|
||||
impl ErrorCode {
|
||||
|
@ -113,6 +113,10 @@ impl FlowyError {
|
||||
static_flowy_error!(server_error, ErrorCode::InternalServerError);
|
||||
static_flowy_error!(not_support, ErrorCode::NotSupportYet);
|
||||
static_flowy_error!(local_version_not_support, ErrorCode::LocalVersionNotSupport);
|
||||
static_flowy_error!(
|
||||
folder_index_manager_unavailable,
|
||||
ErrorCode::FolderIndexManagerUnavailable
|
||||
);
|
||||
}
|
||||
|
||||
impl std::convert::From<ErrorCode> for FlowyError {
|
||||
|
@ -24,3 +24,6 @@ mod cloud;
|
||||
|
||||
#[cfg(feature = "impl_from_url")]
|
||||
mod url;
|
||||
|
||||
#[cfg(feature = "impl_from_tantivy")]
|
||||
mod tantivy;
|
||||
|
21
frontend/rust-lib/flowy-error/src/impl_from/tantivy.rs
Normal file
21
frontend/rust-lib/flowy-error/src/impl_from/tantivy.rs
Normal file
@ -0,0 +1,21 @@
|
||||
use tantivy::{directory::error::OpenDirectoryError, query::QueryParserError, TantivyError};
|
||||
|
||||
use crate::{ErrorCode, FlowyError};
|
||||
|
||||
impl std::convert::From<TantivyError> for FlowyError {
|
||||
fn from(error: TantivyError) -> Self {
|
||||
FlowyError::new(ErrorCode::IndexWriterFailedCommit, error)
|
||||
}
|
||||
}
|
||||
|
||||
impl std::convert::From<OpenDirectoryError> for FlowyError {
|
||||
fn from(error: OpenDirectoryError) -> Self {
|
||||
FlowyError::new(ErrorCode::FailedToOpenIndexDir, error)
|
||||
}
|
||||
}
|
||||
|
||||
impl std::convert::From<QueryParserError> for FlowyError {
|
||||
fn from(error: QueryParserError) -> Self {
|
||||
FlowyError::new(ErrorCode::FailedToParseQuery, error)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user