Skip to content

Commit

Permalink
feat(focus.point): use exponential instead of linear scoring
Browse files Browse the repository at this point in the history
Linear scoring, by design, gives all records the same score past a
certain point.

This has the disadvantage that identical records that are very far away
cannot be sorted by distance.

By using exponential scoring, we can achieve decent sorting of even very
far away records. This is very helpful for cities and postalcodes.

Connects #1206
  • Loading branch information
orangejulius committed Nov 8, 2018
1 parent 963eece commit 84dd9b6
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion query/autocomplete_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = _.merge({}, peliasQuery.defaults, {
'phrase:boost': 1,
'phrase:slop': 3,

'focus:function': 'linear',
'focus:function': 'exp',
'focus:offset': '0km',
'focus:scale': '250km',
'focus:decay': 0.5,
Expand Down
2 changes: 1 addition & 1 deletion query/search_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = _.merge({}, peliasQuery.defaults, {
'phrase:boost': 1,
'phrase:slop': 2,

'focus:function': 'linear',
'focus:function': 'exp',
'focus:offset': '0km',
'focus:scale': '50km',
'focus:decay': 0.5,
Expand Down
2 changes: 1 addition & 1 deletion test/unit/fixture/autocomplete_linguistic_focus.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = {
}
},
'functions': [{
'linear': {
'exp': {
'center_point': {
'origin': {
'lat': 29.49136,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = {
}
},
'functions': [{
'linear': {
'exp': {
'center_point': {
'origin': {
'lat': 0,
Expand Down
2 changes: 1 addition & 1 deletion test/unit/fixture/search_linguistic_focus.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module.exports = {
'functions': [
{
'weight': 2,
'linear': {
'exp': {
'center_point': {
'origin': {
'lat': 29.49136,
Expand Down
2 changes: 1 addition & 1 deletion test/unit/fixture/search_linguistic_focus_bbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ module.exports = {
'functions': [
{
'weight': 2,
'linear': {
'exp': {
'center_point': {
'origin': {
'lat': 29.49136,
Expand Down
2 changes: 1 addition & 1 deletion test/unit/fixture/search_linguistic_focus_bbox_original.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = {
}
},
'functions': [{
'linear': {
'exp': {
'center_point': {
'origin': {
'lat': 29.49136,
Expand Down
2 changes: 1 addition & 1 deletion test/unit/fixture/search_linguistic_focus_null_island.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module.exports = {
'functions': [
{
'weight': 2,
'linear': {
'exp': {
'center_point': {
'origin': {
'lat': 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = {
}
},
'functions': [{
'linear': {
'exp': {
'center_point': {
'origin': {
'lat': 0,
Expand Down
2 changes: 1 addition & 1 deletion test/unit/fixture/search_linguistic_focus_original.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = {
}
},
'functions': [{
'linear': {
'exp': {
'center_point': {
'origin': {
'lat': 29.49136,
Expand Down

0 comments on commit 84dd9b6

Please sign in to comment.