Stop lowercasing search queries

Turns out that English tags are dependent on capitalization, like
OMOCAT and omocat:
- https://pixwhile.zangetsu.kaizoku.cyou/tags/OMOCAT/illustrations
- https://pixwhile.zangetsu.kaizoku.cyou/tags/omocat/illustrations
This commit is contained in:
blankie 2023-06-16 17:45:48 +07:00
parent d272caa8f2
commit 16f56abe62
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 0 additions and 12 deletions

View File

@ -9,7 +9,6 @@ using namespace std::string_literals;
static const constexpr char* touch_user_agent = "Mozilla/5.0 (Android 12; Mobile; rv:97.0) Gecko/97.0 Firefox/97.0"; static const constexpr char* touch_user_agent = "Mozilla/5.0 (Android 12; Mobile; rv:97.0) Gecko/97.0 Firefox/97.0";
static const constexpr char* desktop_user_agent = "Mozilla/5.0 (Windows NT 10.0; rv:111.0) Gecko/20100101 Firefox/111.0"; static const constexpr char* desktop_user_agent = "Mozilla/5.0 (Windows NT 10.0; rv:111.0) Gecko/20100101 Firefox/111.0";
static void to_lower(std::string& str);
PixivClient::PixivClient(Redis* redis) : _redis(redis) { PixivClient::PixivClient(Redis* redis) : _redis(redis) {
this->_www_pixiv_net_client.set_keep_alive(true); this->_www_pixiv_net_client.set_keep_alive(true);
@ -46,7 +45,6 @@ Illust PixivClient::get_illust(uint64_t illust_id) {
} }
SearchResults PixivClient::search_illusts(std::string query, size_t page, const std::string& order) { SearchResults PixivClient::search_illusts(std::string query, size_t page, const std::string& order) {
to_lower(query);
httplib::Params params = { httplib::Params params = {
{"lang", "en"}, {"lang", "en"},
{"mode", "all"}, {"mode", "all"},
@ -64,7 +62,6 @@ SearchResults PixivClient::search_illusts(std::string query, size_t page, const
} }
std::vector<SearchSuggestion> PixivClient::get_search_suggestions(std::string query) { std::vector<SearchSuggestion> PixivClient::get_search_suggestions(std::string query) {
to_lower(query);
std::string body = [&]() { std::string body = [&]() {
std::string cache_key = "pixwhile:searchsugg:"s + std::to_string(FastHash(query.data(), query.size(), 0)); std::string cache_key = "pixwhile:searchsugg:"s + std::to_string(FastHash(query.data(), query.size(), 0));
if (this->_redis) { if (this->_redis) {
@ -142,12 +139,3 @@ bool PixivClient::i_pximg_url_valid(const std::string& path) {
} }
return res->status >= 200 && res->status <= 200; return res->status >= 200 && res->status <= 200;
} }
static void to_lower(std::string& str) {
for (size_t i = 0; i < str.size(); i++) {
if (str[i] >= 'A' && str[i] <= 'Z') {
str[i] = static_cast<char>(str[i] - 'A' + 'a');
}
}
}