Opened 5 years ago

Closed 4 years ago

#1807 closed bug (fixed)

Location search broken

Reported by: jsfan Owned by: shevek
Priority: critical Milestone: 2.0
Component: BW Search Keywords: search, geo, location, city
Cc: shevek

Description (last modified by sitatara)

  • Issue

The location search currently does not yield any results for certain locations due to a bad handling of ambiguities. This is mainly (or exclusively?) caused by frontend code.

  • Solution

The geo code needs to be consolidated to query one API in a consistent and exhaustive manner. Ambiguities need to be resolved satisfactorily.

  • Notes

This ticket is the descendant of a partly resolved ticket #1631.

Related tickets: #1989, #2054

Change History (31)

comment:1 Changed 5 years ago by planetcruiser

#1631 was fixed via https://gitorious.org/bewelcome/rox/commit/c9fb95a96a83775b1aa1beca0cb00e60b9e5fa49 - please check if this ticket here can be closed, too

comment:2 Changed 5 years ago by shevek

As the search still doesn't work for a lot of places (like Berlin in Schleswig-Holstein or Heidelberg in Brandenburg), this ticket is still needed.

comment:3 follow-up: Changed 5 years ago by sitatara

Members in Curacao cannot be found. There is at least one member: http://www.bewelcome.org/members/arkadip

comment:4 Changed 5 years ago by sitatara

From a support ticket:
"when i browse countries i get this result for the northern territory (australia) Cities
Alice Springs (1)
Barrow Creek (1)
Batchelor (1)
Darwin (12)
yet when i map search i'm told there are no results for darwin."

I tried this too and found the following:

  • "Browse countries"(http://www.bewelcome.org/places) gives the results mentioned above.
  • Search by location on http://www.bewelcome.org/searchmembers gives no results for any of these locations (with or without the addition ", Australia" in the search field).
  • For "Batchelor" the map zoomes to some place in the USA, it only zoomes to the correct place if I enter "Batchelor, Australia".
  • For the other three locations the map zoomes correctly to the location in the Northern Territory, Australia.
  • All members that as listed on the "Browse countries" page can be found when clicking on "search using map boundaries" (once the setting "no, sorry" is included).

comment:5 Changed 5 years ago by shevek

  • Milestone changed from unassigned to 1.6

Toub suggested a fix that would unbreak the search in several case. Adding to 1.6.

Last edited 5 years ago by shevek (previous) (diff)

comment:6 Changed 5 years ago by toub

comment:7 Changed 5 years ago by shevek

I checked Alice Springs and Darwin both show results now (locally). So the fix is a bit broader than Lisbon :-)

Last edited 5 years ago by shevek (previous) (diff)

comment:8 Changed 5 years ago by shevek

  • Status changed from new to to_alpha

comment:9 Changed 5 years ago by toub

It does not fix the problem with Willemstad, Curacao .

Curacao problem is a geonames issue in our database: CW exists in geonames_cache.fk_countrycode but not in geonames_countries.iso_alpha2

The following query in test database shows that this is the unique problem of this type:

SELECT distinct geonames_cache.fk_countrycode

FROM geonames_cache

WHERE not exists 
(SELECT distinct geonames_cache.fk_countrycode

FROM geonames_countries

WHERE geonames_countries.iso_alpha2=geonames_cache.fk_countrycode )

According to http://www.geonames.org/countries/CW/curacao.html, I suggest to execute the following query:

insert into geonames_countries 
(iso_alpha2, name, continent, languages) 
values ('CW', 'Curacao', 'EU', 'nl-NL,fy-NL');

Still not working, due to this code in searchmembers.model.php on line 622:

if (!empty($cities)) {
                $WhereCity = 'geonames_cache.geonameid IN (' . implode(',', $cities) . ')';
            } else {
                $WhereCity = "1 = 0";
            }

Here we do a search by country, so I don't understand why is this $whereCity is not just skipped.

The call to findLocationsByCoordinates returns only one result, Curacao as a country, and does not return Willemstad, so there is no city in the list.

I see 2 options here:

  • search by country, so remove the '1=0'
  • ignore countries in findLocationsByCoordinates so the first city will be returned.

This has to be analysed much more, and also tested.

Let's see after the current release.

Last edited 5 years ago by toub (previous) (diff)

comment:10 Changed 5 years ago by shevek

I created a new ticket for the issue reported in comment 9 see #1989.

comment:11 Changed 5 years ago by shevek

The one member in Batchelor still doesn't show up. That might be due to a problem with the fact that he didn't login for more than 6 months.

Searching for the username directly finds the person in Batchelor.

Using Batchelor, Australia finds the same member as well.

Last edited 5 years ago by shevek (previous) (diff)

comment:12 Changed 5 years ago by shevek

I'd suggest to write new tickets for the different faults.

comment:13 Changed 5 years ago by shevek

  • Description modified (diff)
  • Status changed from to_alpha to testing

I guess that the problem with Batchelor turns out to be the same as for ticket #1989 so I add that info there.

comment:14 follow-up: Changed 5 years ago by midsch

Well first of all, I don't understand how the search/geolocation stuff works. So it's just poking around (Alpha, Chromium under Kubuntu)

  • Alice Springs (1) - Works for me.
  • Barrow Creek (1) - Works for me.
  • Batchelor (1) - DIDN'T WORK for me.
  • Darwin (12) - Works for me.

Trying to find a similar setup with http://alpha.bewelcome.org/places/US/New%20Hampshire compared to map search (without other restrictions)

  • Browse countries / Map search
  • Berlin (1) / only as "Berlin, New Hampshire" (simply Berlin -> German capital)
  • Concord (1) / OK
  • Durham (1) / returns 4
  • Laconia (1) / OK
  • Manchester (1) / only as "Manchester, New Hampshire" (simply Manchester -> british city)
  • Nashua (1) / OK
  • North Stratford (1) / OK
  • Portsmouth (1) / only as "Portsmouth, New Hampshire" (simply Portsmouth -> british city)
  • Tilton (1) / OK

BUT:

  • New Hampshire (9) / returns only one!

Another example:

  • Browse countries shows 95 results, mapsearch for Schleswig-Holstein (northern-most region of Germany), no other restrictions, returns only two results. But if you zoom in the map for one stop and search with the map boundaries you'll get nearly one hundred users. As far as I can see, most of them are located in Schleswig-Holstein.

We have a problem with regions / states here.

Last edited 5 years ago by midsch (previous) (diff)

comment:15 in reply to: ↑ 3 Changed 5 years ago by crumbking

Replying to sitatara:

Members in Curacao cannot be found. There is at least one member: http://www.bewelcome.org/members/arkadip

Can't find him on alpha. Also seems not to show up on browse countries.

Regions doesn't work but as far as I know this was before the same...

comment:16 in reply to: ↑ 14 Changed 5 years ago by shevek

Well first of all, I don't understand how the search/geolocation stuff works. So it's just poking around (Alpha, Chromium under Kubuntu)

No one does...

Trying to find a similar setup with http://alpha.bewelcome.org/places/US/New%20Hampshire compared to map search (without other restrictions)

  • Browse countries / Map search
  • Durham (1) / returns 4

Which is nearer to the real numbers than what the damin unit tells you. There are actually 5 members. The problem with map search without alteration is that it will only show 'Yes' and 'Maybe' members.

I deal with the mismatch between admin units display and places in 1.7.

comment:17 Changed 5 years ago by toub

In fact, we will have to completely rewrite the search to solve all problems.

Just a partial fix here.

comment:18 Changed 5 years ago by shevek

That's exactly the plan :)

comment:19 Changed 5 years ago by midsch

Trying to find a similar setup with http://alpha.bewelcome.org/places/US/New%20Hampshire compared to map search (without other restrictions)

  • Browse countries / Map search
  • Durham (1) / returns 4

Which is nearer to the real numbers than what the damin unit tells you. There are actually 5 members. The problem with map search without alteration is that it will only show 'Yes' and 'Maybe' members.

Hmm. But map search is even restricted more than the browse country pages. Anyway, it you think it's better to rewrite it, it's also better to stop testing here and do it with the new search.

comment:20 Changed 5 years ago by sitatara

So, what do we do with this ticket? Leave it open but release the changes since they are an improvement? Btw, still no results for Tokyo (search using map boundaries finds 40, browse countries finds 28 - but the map probably includes some other places too), nor for Bangkok, nor for Santiago de Chile. Probably a lot more places still don't show any members, although there are plenty, unless you click on "Search using map boundaries". As long as this is a problem, should we maybe add a little text box on the search page that there is a bug and people should try to search with the button in the map if they get no results otherwise?

comment:21 Changed 5 years ago by shevek

  • Milestone changed from 1.6 to 1.7
  • Status changed from testing to needs_work

We accept the improvement and move the ticket to 1.7.

With the now location 'engine' all the remaining problems should be solved.

comment:22 Changed 5 years ago by shevek

  • Owner set to shevek
  • Status changed from needs_work to assigned

comment:23 Changed 5 years ago by shevek

  • Milestone changed from 1.7 to unassigned

comment:24 Changed 5 years ago by shevek

  • Milestone changed from unassigned to 1.9

Add to milestone 1.9.

comment:25 Changed 5 years ago by shevek

  • Milestone changed from 1.9 to 1.10

Postponed to 1.10.

comment:26 Changed 5 years ago by sitatara

  • Description modified (diff)

comment:27 Changed 4 years ago by sitatara

  • Status changed from assigned to to_alpha

comment:28 Changed 4 years ago by sitatara

  • Status changed from to_alpha to testing

comment:29 Changed 4 years ago by sitatara

I tested the examples given in this ticket. Finding the location and getting the correct results is no problem anymore. Some of the examples mentioned do not yield any results though because profiles which have never been edited and therefore have the max. no. of guests 0 were completely excluded from the results. So, for example, "Batchelor, Northern Territory, Austalia" shows no results.

The only problem I encountered is when I make several searches one after the other. Sometimes the page does not load the new location. This happens when I see a list of results, the enter a new location in the textfield above and do not wait for the drop-down list but click on "search" instead.

comment:30 Changed 4 years ago by shevek

I updated one javascript file. It should now be possible to search several times without problems. (The page needs a hard reload! CTRL+SHIFT+R on Chrome).

comment:31 Changed 4 years ago by sitatara

  • Resolution set to fixed
  • Status changed from testing to closed

Yes, that works now.

Note: See TracTickets for help on using tickets.