api icon indicating copy to clipboard operation
api copied to clipboard

autocomplete: cannot find place using its label

Open missinglink opened this issue 4 years ago • 7 comments

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 avatar Nov 21 '19 17:11 missinglink

@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?

missinglink avatar Apr 30 '20 12:04 missinglink

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.

orangejulius avatar Apr 30 '20 13:04 orangejulius

@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"

vipyoung avatar Feb 15 '21 12:02 vipyoung

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 avatar Jan 12 '23 06:01 meezaan

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?

meezaan avatar Jan 12 '23 06:01 meezaan

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

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

missinglink avatar Jan 12 '23 18:01 missinglink

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

meezaan avatar Jan 13 '23 02:01 meezaan