-
Notifications
You must be signed in to change notification settings - Fork 48
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
Encode and Decode Placemark.relevance #157
Conversation
8cf37ad
to
d312bf4
Compare
MapboxGeocoder/MBPlacemark.swift
Outdated
@@ -486,6 +491,8 @@ open class GeocodedPlacemark: Placemark { | |||
return properties?.maki | |||
} | |||
|
|||
open var relevance: Double? |
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.
Should we expose this property to Obj-C and workaround bridgability with a -1 constant?
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.
Yes, but I’m uncertain what the magic number should be – whether it should be –1 or whether it should be Double.max
to avoid a collision with a legitimate value.
d312bf4
to
848f4db
Compare
MapboxGeocoder/MBPlacemark.swift
Outdated
how well each returned feature matches the query. You can use the this | ||
property to remove results that don’t fully match the query. | ||
*/ | ||
open var relevance: Double? |
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.
Make this property non-optional so that Objective-C code can access it. Use −1 to mark the absence of a relevance
in the API response. According to the documentation and this line in Carmen, we can count on a present value to never dip below 0.
MapboxGeocoder/MBPlacemark.swift
Outdated
@@ -486,6 +491,13 @@ open class GeocodedPlacemark: Placemark { | |||
return properties?.maki | |||
} | |||
|
|||
/** | |||
A numerical score from 0 (least relevant) to 0.99 (most relevant) measuring | |||
how well each returned feature matches the query. You can use the this |
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.
You can use the this
Use this
MapboxGeocoder/MBPlacemark.swift
Outdated
how well each returned feature matches the query. You can use the this | ||
property to remove results that don’t fully match the query. | ||
*/ | ||
open var relevance: Double? |
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.
Float would probably have sufficient precision, but I guess there’s no harm in using double here.
848f4db
to
9f5ea74
Compare
Fixes #156 Add relevance property to GeocodedPlacemark
cc @1ec5