From 5580485fd947941323849665cb94baea5881fd11 Mon Sep 17 00:00:00 2001 From: Harish Krishna Date: Wed, 17 Sep 2014 17:49:28 -0400 Subject: [PATCH] making full text search location aware --- query/search.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/query/search.js b/query/search.js index db3fc737..e17d0838 100644 --- a/query/search.js +++ b/query/search.js @@ -4,11 +4,22 @@ var logger = require('../src/logger'); function generate( params ){ var cmd = { - "query": { - "query_string": { - "query": params.input, - "fields": ['name.default'], - "default_operator": 'OR' + "query":{ + "filtered" : { + "query" : { + "match" : { + "name.default": params.input + } + }, + "filter" : { + "geo_distance" : { + "distance" : "200km", + "center_point" : { + "lat": params.lat, + "lon": params.lon + } + } + } } }, "size": 30