Opened 8 years ago

Last modified 20 months ago

#11349 new enhancement

addr:street autocompletion is broken

Reported by: daganzdaanda Owned by: team
Priority: normal Milestone:
Component: Core Version: tested
Keywords: autocompletion address street name Cc:


in my opinion, the auto-completion for addr:street suggests too many "names".
It would be better if it would only take values from addr:street and names from highway-objects into account.
Would that be possible?

Attachments (0)

Change History (12)

comment:1 Changed 6 years ago by daganzdaanda

Hi again,
does anybody know if this is possible? If it's too complicated to do, then let's close the ticket.

comment:2 Changed 2 years ago by daganzdaanda

Summary: addr:street autocompletion should be more picky about suggestionsaddr:street autocompletion is broken
Type: enhancementdefect

After finding it looks as if this already was working once. Now it's not working any more, so I changed the ticket to "defect" and changed the name accordingly.

comment:3 Changed 2 years ago by daganzdaanda

To reproduce:
Make a new node in a city center. Bring up the "add tag" box (with Alt-A). Type addr:street for the key and switch to the value field. If you press the down arrow without typing anything, you'll get a huge list of names, most of which are not Street names in the vincinity. If you type a letter, the autocomplete options are filtered, but the choices are always from anything that has a "name" tag.

Maybe it has to do with caching, too: I started JOSM and downloaded a small part of a city center. The autocomplete list seems to contain many more names than I believe are in that area. So it may be some leftovers from previous mapping sessions in the cache?? But nevertheless, the names are clearly not only from streets as they should be.

comment:4 Changed 2 years ago by daganzdaanda

OK, I found that disabling the "name suggestion index" preset removes a lot of the wrong entries from the addr:street autocompletion. Now, I only see names that are existing in the downloaded area, but there are still all the names of the shops, doctors, offices etc included.

comment:5 Changed 2 years ago by skyper

Keywords: address street name added
Type: defectenhancement

r4300 solving #6306 does not filter the name values. It never worked the way you like it to do.

comment:6 Changed 2 years ago by GerdP

I think r4300 claims that only street names are used for auto completion, but that really doesn't seem to work. If offers all matching names.

comment:7 Changed 2 years ago by daganzdaanda

Hm, looking at the discussion and the two patches in #6306, maybe it was working at first only with "name" values from streets and "addr:street" values, and with the second patch which was trying to fix #5804 it opened the search to all names??

The main difference I can see is in "src/org/openstreetmap/josm/gui/dialogs/properties/"

static List<String> getAutocompletionKeys(String key) {
   if ("name".equals(key) || "addr:street".equals(key)) {
      return Arrays.asList("addr:street", "name");
   } else {
      return Arrays.asList(key);

The original patch only has

   if ("addr:street".equals(key)) {

Could this be to blame?
And why is the autocomplete accessing the list of names from the "Name suggestion index" plugin?

comment:8 Changed 2 years ago by GerdP

No, I think the problem is that all all name values are used, not only those of objects with a highway=* tag. No idea where this additional filtering could be done.

comment:9 Changed 2 years ago by skyper

Yes, I had the same impression looking at r4300. There is no filter for containing additional tags/keys.

Would be a useful filter, also for tagging presets.

Last edited 2 years ago by skyper (previous) (diff)

comment:10 Changed 20 months ago by gaben

Ticket #17957 has been marked as a duplicate of this ticket.

comment:11 Changed 20 months ago by marcello@…

The AutoCompletionManager only caches keys and their values but doesn't keep any records about key 'proximity'. So a query like: give me all values of key name on primitives that also have key highway cannot be satisfied by the AutoCompletionManager. OTOH storing all that information in the cache might easily degrade cache performance both in size and speed.

A different approach might work better: add an attribute autocomplete_template to the preset item, that uses the template engine and its syntax to find additional autocompletion values. On addr:street you would put:

  autocomplete_template="!{(highway:) (name:) inview '{name}'}"

comment:12 Changed 20 months ago by skyper

+1, for the new attribute

inview is nice but I sometimes need a bigger radius while zoomed in. Setting an explicit radius/bbox would be nice.

Modify Ticket

Change Properties
Set your email in Preferences
as new The owner will remain team.
as The resolution will be set.
to The owner will be changed from team to the specified user.
The owner will change to daganzdaanda
as duplicate The resolution will be set to duplicate.The specified ticket will be cross-referenced with this ticket
The owner will be changed from team to anonymous.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.