MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / parse_search_query

Function parse_search_query

chirpstack/src/storage/search.rs:331–347  ·  view source on GitHub ↗
(q: &str)

Source from the content-addressed store, hash-verified

329}
330
331fn parse_search_query(q: &str) -> (String, HashMap<String, String>) {
332 let mut tags: HashMap<String, String> = HashMap::new();
333
334 for caps in SEARCH_TAG_RE.captures_iter(q) {
335 if caps.len() != 3 {
336 continue;
337 }
338
339 tags.insert(
340 caps.get(1).unwrap().as_str().to_string(),
341 caps.get(2).unwrap().as_str().to_string(),
342 );
343 }
344
345 let query = SEARCH_TAG_RE.replace_all(q, "").trim().to_string();
346 (query, tags)
347}
348
349#[cfg(test)]
350pub mod test {

Callers 2

global_searchFunction · 0.85
test_parse_search_queryFunction · 0.85

Calls 4

insertMethod · 0.80
to_stringMethod · 0.80
unwrapMethod · 0.80
getMethod · 0.45

Tested by 1

test_parse_search_queryFunction · 0.68