-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added addr:housename to index #458
Conversation
This is intentional. |
If this is the case, I see only one other way of fixing this issue: When a search is performed, I think we can add a condition to check if
Even though the Let me know if this is the correct approach, or if I am missing something with regard to this. |
@@ -77,6 +77,9 @@ private String getLocalised(Map<String, Object> source, String fieldName, String | |||
return map.get(lang); | |||
} | |||
|
|||
if (!map.containsKey("default")) { | |||
return map.get(map.keySet().toArray()[0]); // Returning first value in the map |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We really should define an order here. Right now you might get a random localized name, if I understand the code right. I suggest: housename, int, loc, reg, alt, old
Also, note that again only NAME has other names than the default and localised ones. So a special handling of the name would be a good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latest commit handles the precedence order you suggested. This handling is only for the name field but in the same getLocalised()
function. (If a separate function is used, most of the code will be repeated, so I did not go for it)
if (map.containsKey(key)) | ||
return map.get(key); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But now 'default' is the falllback, while it was the first choice before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If default
needs to be the first preference, I see two ways of doing it:
- Add default as the first entry in the NAME_PRECEDENCE array.
- Change the
if
condition from(fieldName.equals("name"))
to(map.get("default") == null && fieldName.equals("name"))
.
Which option should I go for?
Implemented option 1 in the latest commit as you suggested @lonvia. |
For issue #448:
writeName
function to include housename infNames
.filterNames
function to setnames.get("housename")
as default ifnames
is not null andnames.get("name")
is null.Reason for including point 3 above:
Current implementation: In filterNames function, if the
names
map is notnull
, then names.get("name") is set as the default name. This fails if the map does not contain thename
key.Examples:
I noticed that many of the places with
addr:housename
do not havename
key. There should either be a hierarchy to select the"default"
or the point 3 above could be opted.