mirror of
https://github.com/neon-mmd/websurfx.git
synced 2024-11-23 06:28:23 -05:00
enable non-static-synonyms features
This commit is contained in:
parent
8c7ab9ba98
commit
e61ead3f31
7
Cargo.lock
generated
7
Cargo.lock
generated
@ -3665,17 +3665,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "3e33ea271e53da683cd3439c04ff3b734f3d6052ea33a65ec9e0fa89a4f96369"
|
checksum = "3e33ea271e53da683cd3439c04ff3b734f3d6052ea33a65ec9e0fa89a4f96369"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"thesaurus-wordnet",
|
"thesaurus-moby",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thesaurus-wordnet"
|
name = "thesaurus-moby"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1e0b5b98479fc7554a0cedad4c03264b1caeecc7af51b4e44945c759bab43e35"
|
checksum = "28f7806d5dbe7d9b627e332f88269a014a6a1d40ec411d4ea66cb702aabce4cf"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libflate",
|
"libflate",
|
||||||
"serde_json",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -85,12 +85,9 @@ keyword_extraction = { version = "1.3.0", default-features = false, features = [
|
|||||||
|
|
||||||
] }
|
] }
|
||||||
|
|
||||||
stop-words = { version = "0.8.0", default-features = false, features = [
|
stop-words = { version = "0.8.0", default-features = false, features = ["iso"] }
|
||||||
"iso",
|
|
||||||
]}
|
|
||||||
thesaurus = { version = "0.5.2", default-features = false, optional = true, features = [
|
thesaurus = { version = "0.5.2", default-features = false, optional = true, features = [
|
||||||
"moby",
|
"moby",
|
||||||
"static",
|
|
||||||
] }
|
] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
@ -131,6 +128,7 @@ rpath = false
|
|||||||
strip = "symbols"
|
strip = "symbols"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
use-synonyms-search = ["thesaurus/static"]
|
||||||
default = ["memory-cache"]
|
default = ["memory-cache"]
|
||||||
dhat-heap = ["dep:dhat"]
|
dhat-heap = ["dep:dhat"]
|
||||||
memory-cache = ["dep:mini-moka"]
|
memory-cache = ["dep:mini-moka"]
|
||||||
@ -139,5 +137,4 @@ compress-cache-results = ["dep:async-compression", "dep:cfg-if"]
|
|||||||
encrypt-cache-results = ["dep:chacha20poly1305", "dep:chacha20"]
|
encrypt-cache-results = ["dep:chacha20poly1305", "dep:chacha20"]
|
||||||
cec-cache-results = ["compress-cache-results", "encrypt-cache-results"]
|
cec-cache-results = ["compress-cache-results", "encrypt-cache-results"]
|
||||||
experimental-io-uring = ["actix-web/experimental-io-uring"]
|
experimental-io-uring = ["actix-web/experimental-io-uring"]
|
||||||
use-synonyms-search = ["dep:thesaurus\static"]
|
use-non-static-synonyms-search = ["thesaurus"]
|
||||||
use-non-static-synonyms-search = ["dep:thesaurus"]
|
|
||||||
|
@ -4,7 +4,10 @@
|
|||||||
use super::engine_models::EngineError;
|
use super::engine_models::EngineError;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
#[cfg(feature = "use-synonyms-search")]
|
#[cfg(any(
|
||||||
|
feature = "use-synonyms-search",
|
||||||
|
feature = "use-non-static-synonyms-search"
|
||||||
|
))]
|
||||||
use thesaurus::synonyms;
|
use thesaurus::synonyms;
|
||||||
/// A named struct to store the raw scraped search results scraped search results from the
|
/// A named struct to store the raw scraped search results scraped search results from the
|
||||||
/// upstream search engines before aggregating it.It derives the Clone trait which is needed
|
/// upstream search engines before aggregating it.It derives the Clone trait which is needed
|
||||||
@ -254,7 +257,10 @@ fn calculate_tf_idf(
|
|||||||
let mut search_tokens = vec![];
|
let mut search_tokens = vec![];
|
||||||
|
|
||||||
for token in query_tokens {
|
for token in query_tokens {
|
||||||
#[cfg(feature = "use-synonyms-search")]
|
#[cfg(any(
|
||||||
|
feature = "use-synonyms-search",
|
||||||
|
feature = "use-non-static-synonyms-search"
|
||||||
|
))]
|
||||||
{
|
{
|
||||||
// find some synonyms and add them to the search (from wordnet or moby if feature is enabled)
|
// find some synonyms and add them to the search (from wordnet or moby if feature is enabled)
|
||||||
let synonyms = synonyms(&token);
|
let synonyms = synonyms(&token);
|
||||||
|
Loading…
Reference in New Issue
Block a user