From 29ef42e29032e2f14791c6a9b966de23ffa9fd0a Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Wed, 29 Jul 2015 10:24:57 +0200 Subject: [PATCH] boost phrase matching --- query/search.js | 5 +++-- test/unit/query/search.js | 15 ++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/query/search.js b/query/search.js index 49945534..cb4deb17 100644 --- a/query/search.js +++ b/query/search.js @@ -100,7 +100,7 @@ function generate( params ){ } // add search condition to distance query - query.query.filtered.query.bool.must.push({ + query.query.filtered.query.bool.must.push({ 'match': { 'name.default': { 'query': input, @@ -117,7 +117,8 @@ function generate( params ){ 'query': input, 'analyzer': 'peliasPhrase', 'type': 'phrase', - 'slop': 2 + 'slop': 2, + 'boost': 2 } } }); diff --git a/test/unit/query/search.js b/test/unit/query/search.js index d3dccce9..5bba7762 100644 --- a/test/unit/query/search.js +++ b/test/unit/query/search.js @@ -92,7 +92,8 @@ var expected = { 'query': 'test', 'analyzer': 'peliasPhrase', 'type': 'phrase', - 'slop': 2 + 'slop': 2, + 'boost': 2 } } }] @@ -182,7 +183,8 @@ module.exports.tests.query = function(test, common) { 'query': 'test', 'analyzer': 'peliasPhrase', 'type': 'phrase', - 'slop': 2 + 'slop': 2, + 'boost': 2 } } }] @@ -230,7 +232,8 @@ module.exports.tests.query = function(test, common) { 'query': 'test', 'analyzer': 'peliasPhrase', 'type': 'phrase', - 'slop': 2 + 'slop': 2, + 'boost': 2 } } }] @@ -323,7 +326,8 @@ module.exports.tests.query = function(test, common) { 'query': '123 main st', 'analyzer': 'peliasPhrase', 'type': 'phrase', - 'slop': 2 + 'slop': 2, + 'boost': 2 } } } @@ -480,7 +484,8 @@ module.exports.tests.query = function(test, common) { 'query': 'soho grand', 'analyzer': 'peliasPhrase', 'type': 'phrase', - 'slop': 2 + 'slop': 2, + 'boost': 2 } } }