Remove unnecessary trimming and lowercasing
This commit is contained in:
parent
6c2e981509
commit
0eb544a3e6
|
@ -202,7 +202,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hanimers"
|
name = "hanimers"
|
||||||
version = "0.1.4"
|
version = "0.1.5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"quick-xml",
|
"quick-xml",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "hanimers"
|
name = "hanimers"
|
||||||
version = "0.1.4"
|
version = "0.1.5"
|
||||||
authors = ["blank X <theblankx@protonmail.com>"]
|
authors = ["blank X <theblankx@protonmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ pub const AVALIABLE_TAGS: &[&str] = &["3D", "Ahegao", "Anal", "BDSM", "Big Boobs
|
||||||
|
|
||||||
pub async fn search(arg_m: &ArgMatches<'_>) {
|
pub async fn search(arg_m: &ArgMatches<'_>) {
|
||||||
let broad_search = arg_m.is_present("broad");
|
let broad_search = arg_m.is_present("broad");
|
||||||
let tags = arg_m.values_of("tags").unwrap_or_default().map(|i| i.trim().to_lowercase()).collect();
|
let tags = arg_m.values_of("tags").unwrap_or_default().collect();
|
||||||
let query = arg_m.values_of("query").unwrap_or_default().collect::<Vec<_>>().join(" ");
|
let query = arg_m.values_of("query").unwrap_or_default().collect::<Vec<_>>().join(" ");
|
||||||
let query = query.trim();
|
let query = query.trim();
|
||||||
let results = utils::search(Client::new(), query, tags, broad_search).await.unwrap();
|
let results = utils::search(Client::new(), query, tags, broad_search).await.unwrap();
|
||||||
|
|
|
@ -5,7 +5,7 @@ use quick_xml::events::Event;
|
||||||
extern crate reqwest;
|
extern crate reqwest;
|
||||||
extern crate serde_json;
|
extern crate serde_json;
|
||||||
|
|
||||||
pub async fn search(client: reqwest::Client, query: &str, tags: Vec<String>, broad_search: bool) -> Result<Vec<structs::SearchResult>, structs::Error> {
|
pub async fn search(client: reqwest::Client, query: &str, tags: Vec<&str>, broad_search: bool) -> Result<Vec<structs::SearchResult>, structs::Error> {
|
||||||
let tags_mode = match broad_search {
|
let tags_mode = match broad_search {
|
||||||
true => "OR",
|
true => "OR",
|
||||||
false => "AND"
|
false => "AND"
|
||||||
|
|
Loading…
Reference in New Issue