From e55d421d6365de4da37718a99a32fb9268b21059 Mon Sep 17 00:00:00 2001 From: Benjamin Gross Date: Wed, 25 May 2016 16:09:20 -0600 Subject: [PATCH] Don't put the cart before the horse (min_score) --- es.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/es.js b/es.js index fb1eb0d..61aa241 100644 --- a/es.js +++ b/es.js @@ -302,10 +302,6 @@ function elasticSearchQuery(params) { ftq = {"match_all" : {}} } - if (min_score) { - qs['min_score'] = min_score; - } - // if there are filter constraints (filter_must) then we create a filtered query, // otherwise make a normal query var qs = undefined; @@ -315,7 +311,11 @@ function elasticSearchQuery(params) { } else { qs = {"query" : ftq} } - + + if (min_score) { + qs['min_score'] = min_score; + } + // sort order and direction options.sort && options.sort.length > 0 ? qs['sort'] = options.sort : "";