pelias / api

HTTP API for Pelias Geocoder
http://pelias.io
MIT License
219 stars 162 forks source link

autocomplete: cannot find place using its label #1395

Open missinglink opened 4 years ago

missinglink commented 4 years ago

the document openstreetmap:venue:node/3691534194 has the following label:

"label": "Koh Lanta, Gothenburg, Sweden"

however, when searching for the same record using this label no results are returned:

/v1/autocomplete?text=Koh Lanta, Gothenburg, Sweden
no features

it's not clear why this is the case, requires some investigation.

note: this works correctly for /v1/search

missinglink commented 4 years ago

@orangejulius this test case seems to be fixed by what you've current got running on the staging server: https://pelias.github.io/compare/#/v1/autocomplete?text=Koh+Lanta%2C+Gothenburg%2C+Sweden&debug=1

Can you remind me what you changed which may have fixed this?

orangejulius commented 4 years ago

This is the branch: https://github.com/pelias/api/tree/disable-parser

There are two notable changes: the first is removing most of the parser logic to always return subject (as a test), and second, some of the query logic is changed. The primary must query is changed from a match_phrase to a match, and then the match_phrase query is duplicated, as a should.

I believe that second change is something we should probably merge close to straight away, as it helps reduce overly strict requirements for matching. Removing the parser logic is probably too extreme, although we might look at effectively disabling it for very short inputs.

vipyoung commented 3 years ago

@orangejulius thank you for hinting into the "disable-parser" branch. Most of the geo-coding in Qatar is done by providing a venue name (e.g., Qatar Foundation | Al Nasr Tower | The Pearl | Villagio | etc.) and the search endpoint was unable to correctly resolve them because of the parser. I looked everywhere on how to disable it until I checked the branch you mentioned. In case someone who uses the docker version of pelias needs to do the same, you can simply download this file https://github.com/pelias/api/blob/master/sanitizer/_text_pelias_parser.js and mount it as a volume under the api service in docker-compose.yml as follows:

volumes:
    - "./sanitizer/_text_pelias_parser.js:/home/pelias/sanitizer/_text_pelias_parser.js"
meezaan commented 1 year ago

Hi folks,

I seem to have a similar issue. I'm run the latest docker build, and for me autocomplete is always empty but search always works.

So, for instance, v1/search?text=london returns a lot of results, but v1/autocomplete?text=london returns nothing.

I've just checked the logs now before pressing submit, and it appears that the autocomplete endpoint is unable to connect to elastic search, but the search one works just fine. For autocomplete I can see the following in the logs:

Elasticsearch WARNING: 2023-01-12T06:10:37Z
  Unable to revive connection: http://elasticsearch:9200/

Elasticsearch WARNING: 2023-01-12T06:10:37Z
  No living connections

Which is strange. I'll have a look at the setup and post back.

meezaan commented 1 year ago

I don't see anything odd in my docker compose file. And obviously the search endpoint from the api container can connect just fine to the elastic endpoint, but the autocomplete one cannot, so it must be somewhere in the code?

missinglink commented 1 year ago

Hi @meezaan, you issue is different from the one mentioned.

Can you please open a new issue and post your pelias.json file.

meezaan commented 1 year ago

Thanks @missinglink. I may have found the problem, but if I have not I'll open another issue.