This topic contains a post which is marked as Best Answer. Press here if you would like to see it.
*

Wiz

  • ****
  • 138 posts
Searching locations in non-English on main page bug - 8.1.1
« on: February 14, 2023, 12:11:06 AM »
Hello,

Searching cities, regions or countries in languages other than English (when switched to a language other than English) yields no results on the main page under 8.1.1 - works fine on the search page. Searching for items / categories etc. works fine in any language. It's just locations that aren't searchable anymore.

Strangely enough, searching in English while viewing other languages (non-English) outputs results in the selected language. I believe this is a core issue, perhaps with locales and/or the new rewrite / redirect rules in index / languages / rewrite / helpers / search.

Tested on osclass 8.1.1 (upgraded from 8.0.2) with latest epsilon.

Thanks
« Last Edit: February 14, 2023, 08:54:45 AM by Wiz »

*

MB Themes

Re: Searching locations in non-English on main page bug - 8.1.1
« Reply #1 on: February 14, 2023, 12:30:26 PM »
@Wiz
Could not reproduce.
Can you provide details in wich box it does not work, link it used to get results, and query if you have it?
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Wiz

  • ****
  • 138 posts
Re: Searching locations in non-English on main page bug - 8.1.1
« Reply #2 on: February 14, 2023, 05:04:12 PM »
@MB The search box on the homepage - see attached screenshots.

When دبي is typed under the Arabic version of the test site, no results are returned (دبي in Arabic was added as a native word for the region/city).

When Dubai is typed in English under the Arabic version, Arabic location results are returned.

Searching locations using English on English version of the site works fine.

Forgot to add: this was working perfectly fine under 8.0.2 and I'll share the queries soon.
« Last Edit: February 14, 2023, 07:42:05 PM by Wiz »

Marked as best answer by Wiz on February 15, 2023, 03:34:11 PM
*

MB Themes

Re: Searching locations in non-English on main page bug - 8.1.1
« Reply #3 on: February 15, 2023, 11:22:47 AM »
@Wiz
In theme model, try to change (3 times, for cities it starts with c.s_name...):
Code: [Select]
$this->dao->where('s_name like "%' . osc_esc_html($pattern) . '%"');
into:
Code: [Select]
    if(osc_get_current_user_locations_native() == 1) {
      $this->dao->where(sprintf('(s_name like "%%%s%%" OR s_name_native like "%%%s%%")', osc_esc_html($pattern), osc_esc_html($pattern)));
    } else {
      $this->dao->where(sprintf('s_name like "%%%s%%"', osc_esc_html($pattern)));
    }
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Wiz

  • ****
  • 138 posts
Re: Searching locations in non-English on main page bug - 8.1.1
« Reply #4 on: February 15, 2023, 04:10:22 PM »
@Wiz
In theme model, try to change (3 times, for cities it starts with c.s_name...):
Code: [Select]
$this->dao->where('s_name like "%' . osc_esc_html($pattern) . '%"');
into:
Code: [Select]
    if(osc_get_current_user_locations_native() == 1) {
      $this->dao->where(sprintf('(s_name like "%%%s%%" OR s_name_native like "%%%s%%")', osc_esc_html($pattern), osc_esc_html($pattern)));
    } else {
      $this->dao->where(sprintf('s_name like "%%%s%%"', osc_esc_html($pattern)));
    }

Worked perfectly for regions and countries, thank you ;) For cities, I had to replace s_name with c.s_name in the code you provided as such:

Code: [Select]
    if(osc_get_current_user_locations_native() == 1) {
      $this->dao->where(sprintf('(c.s_name like "%%%s%%" OR c.s_name_native like "%%%s%%")', osc_esc_html($pattern), osc_esc_html($pattern)));
    } else {
      $this->dao->where(sprintf('c.s_name like "%%%s%%"', osc_esc_html($pattern)));
    }

I also noticed another bug while testing the above fix (probably old) ...  "Your recent search" and "Other People Searched" is only displaying in English but not for RTL languages searches. "ٌYour recent search" loads in the search bar fine when not entering anything in the search bar (clicking inside) on RTL but as soon as you enter a pattern, "Your recent search" is no longer returned even though the the pattern was searched before. "Other people searched" didn't load once under RTL.


*

MB Themes

Re: Searching locations in non-English on main page bug - 8.1.1
« Reply #5 on: February 15, 2023, 05:33:39 PM »
Well if you search "car", it will be "car" in all languages
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Wiz

  • ****
  • 138 posts
Re: Searching locations in non-English on main page bug - 8.1.1
« Reply #6 on: February 16, 2023, 02:17:53 AM »
That's true but that's not what the bug is about.

When searching in epsilon on the homepage, you can see your latest searches and what other people searched if you enter something you searched for or matches what someone else searched for before in English under English or other languages. That's working fine.

In RTL, the 'what other people searched for' is only shown if you enter the previously searched for term in English... It will not show up for non-English RTL keywords searched for previously.

Makes sense? I can take new screenshots if you like.


*

MB Themes

Re: Searching locations in non-English on main page bug - 8.1.1
« Reply #7 on: February 16, 2023, 09:56:22 AM »
Checked on demo and latest searches are identical in all languages.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Wiz

  • ****
  • 138 posts
Re: Searching locations in non-English on main page bug - 8.1.1
« Reply #8 on: February 16, 2023, 11:22:59 AM »
You probably searched for something other than a location - try searching for a location in different languages using native names and you'll see the bug.


*

MB Themes

Re: Searching locations in non-English on main page bug - 8.1.1
« Reply #9 on: February 16, 2023, 12:45:08 PM »
This can be related to transfering special characters.
Try to check in network tab what term was used here
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots