From 4cd652d1c374d73a4857d9114455aa4421875b26 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Tue, 23 Oct 2018 07:37:08 +0200 Subject: [PATCH] add slop to multi_match query. #123 --- app/models/concerns/indexable.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/concerns/indexable.rb b/app/models/concerns/indexable.rb index 23fda7f7d..77f67343a 100644 --- a/app/models/concerns/indexable.rb +++ b/app/models/concerns/indexable.rb @@ -112,7 +112,7 @@ def query(query, options={}) end must = [] - must << { multi_match: { query: query, fields: query_fields, type: "phrase_prefix", max_expansions: 50 }} if query.present? + must << { multi_match: { query: query, fields: query_fields, type: "phrase_prefix", slop: 3, max_expansions: 10 }} if query.present? must << { term: { aasm_state: options[:state] }} if options[:state].present? must << { term: { resource_type_id: options[:resource_type_id] }} if options[:resource_type_id].present? must << { terms: { provider_id: options[:provider_id].split(",") }} if options[:provider_id].present?