Fixing distance calc
This commit is contained in:
parent
890659a771
commit
32329bcce4
@ -454,7 +454,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function modeClick(event, x, y) {
|
function modeClick(event, x, y) {
|
||||||
alert('mode clicked');
|
var mode = _data.mode === 'prod' ? 'dist' : 'prod';
|
||||||
|
updateState(_data.value, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.update = function(data, scale) {
|
this.update = function(data, scale) {
|
||||||
|
2
types.go
2
types.go
@ -50,7 +50,7 @@ type jsonQueryRequest struct {
|
|||||||
Geo *jsonGeoData `json:"geo"`
|
Geo *jsonGeoData `json:"geo"`
|
||||||
MaxResults int `json:"maxResults"`
|
MaxResults int `json:"maxResults"`
|
||||||
MinScore float64 `json:"minScore"`
|
MinScore float64 `json:"minScore"`
|
||||||
Modes map[string]string `json:"modeMap"`
|
Modes map[string]string `json:"modes"`
|
||||||
Profile featureMap `json:"profile"`
|
Profile featureMap `json:"profile"`
|
||||||
Resolution int `json:"resolution"`
|
Resolution int `json:"resolution"`
|
||||||
SortAsc bool `json:"sortAsc"`
|
SortAsc bool `json:"sortAsc"`
|
||||||
|
2
util.go
2
util.go
@ -82,7 +82,7 @@ func compare(features1 featureMap, features2 featureMap, modes modeMap) float64
|
|||||||
|
|
||||||
switch mode, _ := modes[key]; mode {
|
switch mode, _ := modes[key]; mode {
|
||||||
case ModeTypeDist:
|
case ModeTypeDist:
|
||||||
result += 1 - math.Abs(value1-value2)/2
|
result += 1 - math.Abs(value1-value2)
|
||||||
default:
|
default:
|
||||||
result += value1 * value2
|
result += value1 * value2
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user