about summary refs log tree commit diff
path: root/src/search/native.rs
diff options
context:
space:
mode:
authorAlexander_Kabui <alexanderkabui@proton.me>2026-11-17 12:11:19 +0300
committerAlexander_Kabui <alexanderkabui@proton.me>2026-11-17 14:06:50 +0300
commitf76043bf82b6c86b5e844b27b53e957d770aeb33 (patch)
tree5b4257c2523410f077e9fbc4f71f3fd797360b9f /src/search/native.rs
parente13bbd27d0b7addd277d0f50d9e90fee2a936211 (diff)
downloadgenenetwork4-search/extract-engine.tar.gz
* src/search (engine): no default arm, so a wrong name is refused. search/extract-engine
An unrecognised SEARCH_ENGINE used to fall through to the gn3 proxy, which
turned a typo into a silently different engine. The arms are now explicit -
"crate"/"native" for the in-process engine, "forward" for the proxy - and
anything else returns the value it was given. src/search/native.rs is deleted;
the former name resolves through the same arm.
Diffstat (limited to 'src/search/native.rs')
-rw-r--r--src/search/native.rs43
1 files changed, 0 insertions, 43 deletions
diff --git a/src/search/native.rs b/src/search/native.rs
deleted file mode 100644
index 667e786..0000000
--- a/src/search/native.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-//! The native [`Engine`]: a thin wrapper over the extracted engine.
-//!
-//! The engine itself — the `QueryParser` configuration and every
-//! prefix/slot registration, the checked parse, the Hs/Mm and numeric-range
-//! guards, `open_database` and its pre-checks, the full-match-set fetch and
-//! the doc-data decode — now lives in the `gn-search` crate
-//! (`gn-search/src/native.rs`; before the move this file was the whole
-//! 1003-line engine, and that code is unchanged there).
-//!
-//! What is left here is the [`Engine`] impl and nothing else: it delegates
-//! to [`CrateEngine`], so `SEARCH_ENGINE=native` and `SEARCH_ENGINE=crate`
-//! are the same engine, reached through the same seam, with the same error
-//! classes — including the unset-index `Internal` that names
-//! `XAPIAN_DB_PATH`. They cannot diverge, and no behaviour above this
-//! module learns that the engine moved.
-//!
-//! The async shell stays here rather than in the crate because xapian calls
-//! are synchronous C++ work: [`CrateEngine`] keeps them off the runtime's
-//! workers with `spawn_blocking` (the house pattern, cf. every
-//! `spawn_blocking` handler in `src/routes`), and that is the only thing
-//! this module adds.
-
-use super::gnindex::CrateEngine;
-use super::{Engine, SearchError, SearchHit};
-
-/// The native xapian search engine. Configure the index directory with
-/// `XAPIAN_DB_PATH` and select it with `SEARCH_ENGINE=native`; the
-/// default remains the gn3 forwarder (see [`crate::search::search`]).
-pub struct Native;
-
-impl Engine for Native {
-    async fn search(
-        &self,
-        q: &str,
-        type_: &str,
-        limit: u64,
-        page: u64,
-    ) -> Result<Vec<SearchHit>, SearchError> {
-        CrateEngine::from_config()
-            .search(q, type_, limit, page)
-            .await
-    }
-}