Skip to content
This repository has been archived by the owner on Aug 7, 2021. It is now read-only.

Commit

Permalink
Add test to ensure quoted terms still match with no_fulltext_search f…
Browse files Browse the repository at this point in the history
…eature
  • Loading branch information
Kevin Butler authored and Ryman committed Oct 22, 2018
1 parent b8b5909 commit 718dd44
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/resources/talent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,10 @@ impl Talent {
let raw_query = keywords.contains('\"');
macro_rules! maybe_raw {
($field:expr) => {{
let field_modifier = overrides.get($field).unwrap_or(&"");
format!("{}{}{}", $field, field_modifier, if raw_query { ".raw" } else { "" })
let raw_modifier = if raw_query { ".raw" } else { "" };
// the overrides should handle the 'raw' matching enough for now.
let field_modifier = overrides.get($field).unwrap_or(&raw_modifier);
format!("{}{}", $field, field_modifier)
}};
}
let query = Query::build_query_string(keywords.to_owned())
Expand Down
9 changes: 9 additions & 0 deletions tests/smoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,15 @@ fn keyword_quotes() {
assert_eq!(vec![2], results.ids());
}

#[test]
fn keyword_quotes_no_fts() {
let (mut client, index, _talents) = index_default_talents!();

let params = parse_query("keywords=\"Unity\"&features[]=no_fulltext_search");
let results = Talent::search(&mut client, &*index, &params);
assert_eq!(vec![2], results.ids());
}

#[test]
// searching for a single word that's supposed to be split
fn keyword_expected_split() {
Expand Down

0 comments on commit 718dd44

Please sign in to comment.