Skip to content

Commit

Permalink
Merge pull request #15 from lnx-search/fix-behavour
Browse files Browse the repository at this point in the history
fix schema preparing for fast-fuzzy when it shouldn't
  • Loading branch information
ChillFish8 authored Aug 27, 2021
2 parents 476ae66 + fef1dd2 commit de23872
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lnx"
version = "0.4.0"
version = "0.4.1"
authors = ["Harrison Burt <[email protected]>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion engine/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "engine"
version = "0.1.0"
version = "0.1.1"
authors = ["Harrison Burt <[email protected]>"]
edition = "2018"

Expand Down
4 changes: 4 additions & 0 deletions engine/src/index/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,11 @@ fn parse_query(
/// of fault tolerance with spelling. This is the default
/// config as it its the most plug and play setup.
fn parse_fuzzy_query(query: &str, search_fields: Arc<Vec<(Field, Score)>>) -> Box<dyn Query> {
debug!("using default fuzzy system for {}", &query);
let mut parts: Vec<(Occur, Box<dyn Query>)> = Vec::new();

for search_term in query.to_lowercase().split(" ") {
debug!("making fuzzy term for {}", &search_term);
if search_term.is_empty() {
continue;
}
Expand Down Expand Up @@ -414,6 +416,7 @@ fn parse_fast_fuzzy_query(
search_fields: Arc<Vec<(Field, Score)>>,
strip_stop_words: bool,
) -> Result<Box<dyn Query>> {
debug!("using fast fuzzy system for {}", &query);
if query.is_empty() {
return Ok(Box::new(EmptyQuery {}));
}
Expand All @@ -433,6 +436,7 @@ fn parse_fast_fuzzy_query(
}

for search_term in words.iter() {
debug!("making fast-fuzzy term for {}", &search_term);
if ignore_stop_words && stop_words.contains(*search_term) {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion engine/src/structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ impl IndexDeclaration {
schema.add_text_field(&name, opts);
}
FieldDeclaration::Text { stored } => {
let field = if !self.use_fast_fuzzy {
let field = if !(self.use_fast_fuzzy && crate::correction::enabled()) {
let mut opts = TEXT;

if stored {
Expand Down

0 comments on commit de23872

Please sign in to comment.