From 56591abe97674c97b0b3e7c24349e598a6f14f02 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Wed, 7 Oct 2015 11:29:08 +0200 Subject: [PATCH] remove all references to tiebreaking groovy scripts --- query/search.js | 5 ---- test/unit/fixture/search_linguistic_bbox.js | 4 +-- test/unit/fixture/search_linguistic_focus.js | 4 +-- .../fixture/search_linguistic_focus_bbox.js | 4 +-- .../search_linguistic_focus_null_island.js | 2 +- test/unit/fixture/sort_default.js | 25 ------------------- test/unit/query/search.js | 11 -------- 7 files changed, 7 insertions(+), 48 deletions(-) delete mode 100644 test/unit/fixture/sort_default.js diff --git a/query/search.js b/query/search.js index a3787535..ab13e5e9 100644 --- a/query/search.js +++ b/query/search.js @@ -36,11 +36,6 @@ query.score( peliasQuery.view.admin('neighborhood') ); query.filter( peliasQuery.view.boundary_circle ); query.filter( peliasQuery.view.boundary_rect ); -// groovy scripts used to handle tie-breaking -query.sort( peliasQuery.view.sort_numeric_script('admin_boost') ); -query.sort( peliasQuery.view.sort_numeric_script('popularity') ); -query.sort( peliasQuery.view.sort_numeric_script('population') ); - // -------------------------------- /** diff --git a/test/unit/fixture/search_linguistic_bbox.js b/test/unit/fixture/search_linguistic_bbox.js index 6c98b010..f2059541 100644 --- a/test/unit/fixture/search_linguistic_bbox.js +++ b/test/unit/fixture/search_linguistic_bbox.js @@ -86,7 +86,7 @@ module.exports = { } } }, - 'sort': [ '_sort' ], + 'sort': [ '_score' ], 'size': 10, 'track_scores': true -}; \ No newline at end of file +}; diff --git a/test/unit/fixture/search_linguistic_focus.js b/test/unit/fixture/search_linguistic_focus.js index 072bca64..888944ca 100644 --- a/test/unit/fixture/search_linguistic_focus.js +++ b/test/unit/fixture/search_linguistic_focus.js @@ -99,7 +99,7 @@ module.exports = { } } }, - 'sort': [ '_sort' ], + 'sort': [ '_score' ], 'size': 10, 'track_scores': true -}; \ No newline at end of file +}; diff --git a/test/unit/fixture/search_linguistic_focus_bbox.js b/test/unit/fixture/search_linguistic_focus_bbox.js index e6a04824..0ca37848 100644 --- a/test/unit/fixture/search_linguistic_focus_bbox.js +++ b/test/unit/fixture/search_linguistic_focus_bbox.js @@ -115,7 +115,7 @@ module.exports = { } } }, - 'sort': [ '_sort' ], + 'sort': [ '_score' ], 'size': 10, 'track_scores': true -}; \ No newline at end of file +}; diff --git a/test/unit/fixture/search_linguistic_focus_null_island.js b/test/unit/fixture/search_linguistic_focus_null_island.js index 832aa9f7..54c3cae2 100644 --- a/test/unit/fixture/search_linguistic_focus_null_island.js +++ b/test/unit/fixture/search_linguistic_focus_null_island.js @@ -99,7 +99,7 @@ module.exports = { } } }, - 'sort': [ '_sort' ], + 'sort': [ '_score' ], 'size': 10, 'track_scores': true }; diff --git a/test/unit/fixture/sort_default.js b/test/unit/fixture/sort_default.js deleted file mode 100644 index fa3edf36..00000000 --- a/test/unit/fixture/sort_default.js +++ /dev/null @@ -1,25 +0,0 @@ - -module.exports = [ - '_score', - { - '_script': { - 'file': 'admin_boost', - 'type': 'number', - 'order': 'desc' - } - }, - { - '_script': { - 'file': 'popularity', - 'type': 'number', - 'order': 'desc' - } - }, - { - '_script': { - 'file': 'population', - 'type': 'number', - 'order': 'desc' - } - } -]; \ No newline at end of file diff --git a/test/unit/query/search.js b/test/unit/query/search.js index e236eaa7..e3db9287 100644 --- a/test/unit/query/search.js +++ b/test/unit/query/search.js @@ -10,8 +10,6 @@ module.exports.tests.interface = function(test, common) { }); }; -var sort = require('../fixture/sort_default'); - module.exports.tests.query = function(test, common) { test('valid search + focus + bbox', function(t) { var query = generate({ @@ -26,7 +24,6 @@ module.exports.tests.query = function(test, common) { var compiled = JSON.parse( JSON.stringify( query ) ); var expected = require('../fixture/search_linguistic_focus_bbox'); - expected.sort = sort; t.deepEqual(compiled, expected, 'valid search query'); t.end(); @@ -44,7 +41,6 @@ module.exports.tests.query = function(test, common) { var compiled = JSON.parse( JSON.stringify( query ) ); var expected = require('../fixture/search_linguistic_bbox'); - expected.sort = sort; t.deepEqual(compiled, expected, 'valid search query'); t.end(); @@ -58,7 +54,6 @@ module.exports.tests.query = function(test, common) { var compiled = JSON.parse( JSON.stringify( query ) ); var expected = require('../fixture/search_linguistic_only'); - expected.sort = sort; t.deepEqual(compiled, expected, 'valid search query'); t.end(); @@ -73,7 +68,6 @@ module.exports.tests.query = function(test, common) { var compiled = JSON.parse( JSON.stringify( query ) ); var expected = require('../fixture/search_linguistic_focus'); - expected.sort = sort; t.deepEqual(compiled, expected, 'valid search query'); t.end(); @@ -88,7 +82,6 @@ module.exports.tests.query = function(test, common) { var compiled = JSON.parse( JSON.stringify( query ) ); var expected = require('../fixture/search_linguistic_focus_null_island'); - expected.sort = sort; t.deepEqual(compiled, expected, 'valid search query'); t.end(); @@ -105,7 +98,6 @@ module.exports.tests.query = function(test, common) { var compiled = JSON.parse( JSON.stringify( query ) ); var expected = require('../fixture/search_full_address'); - expected.sort = sort; t.deepEqual(compiled, expected, 'valid search query'); t.end(); @@ -122,7 +114,6 @@ module.exports.tests.query = function(test, common) { var compiled = JSON.parse( JSON.stringify( query ) ); var expected = require('../fixture/search_partial_address'); - expected.sort = sort; t.deepEqual(compiled, expected, 'valid search query'); t.end(); @@ -139,7 +130,6 @@ module.exports.tests.query = function(test, common) { var compiled = JSON.parse( JSON.stringify( query ) ); var expected = require('../fixture/search_regions_address'); - expected.sort = sort; t.deepEqual(compiled, expected, 'valid search query'); t.end(); @@ -154,7 +144,6 @@ module.exports.tests.query = function(test, common) { var compiled = JSON.parse( JSON.stringify( query ) ); var expected = require('../fixture/search_boundary_country'); - expected.sort = sort; t.deepEqual(compiled, expected, 'valid boundary.country query'); t.end();