global-search is not ignored if radius is set
retrocausal opened this issue · comments
The documentation states, that global-search is ignored if radius is set.
but this is what I see in the source code
if (!this.globalSearch) {
var bounds = this.map.getBounds();
} else if (this.radius) {
var radius = this.radius;
var location = this.location ? this.location : this.map.getCenter();
}
shouldn't it be
if (this.radius) {
var radius = this.radius;
var location = this.location ? this.location : this.map.getCenter();
} else {
if (!this.globalSearch) {
var bounds = this.map.getBounds();
}
else{
//do something if global search is true
}
}
I think they achieve the same thing but yours is easier to read. If you're not doing a global search, restrict to the map bounds. If you are and radius is set, use the radius instead.
I made the corrections you mentioned in the PR #310
One small thing tho
What happens, if,
1 Radius isn't set
and
2 Global search is set?
I feel that use case isn't handled
Haven't verified, but bounds
will be undefined
and I assume the API will search the entire world? Pretty sure this hasn't changed from before.