Skip to content

Commit

Permalink
simplify search_fields init
Browse files Browse the repository at this point in the history
  • Loading branch information
eli-r-ph committed Feb 25, 2025
1 parent eaf8556 commit 16fd8f4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rust/property-defs-rs/src/api/v1/routing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,16 @@ fn parse_request(params: HashMap<String, String>) -> Params {

// NOTE: this can be parameterized in the orig Django query but
// I didn't see any evidence of that happening in the code yet
let search_fields: HashSet<String> = params
let search_fields: HashSet<String> = HashSet::from([
"name".to_string(),
params
.get("search_fields")
.map(|raw| {
raw.split(" ")
.map(|s| s.trim().to_string().to_lowercase())
.collect()
})
.unwrap_or_default();
let mut search_fields = search_fields;
search_fields.insert("name".to_string());
.unwrap_or_default()]);

// default value is "event" type, so we set that here if the input is bad or missing
let property_type =
Expand Down

0 comments on commit 16fd8f4

Please sign in to comment.