From a230e0fab7af1f24a0fb4f21a1fa9b1d3986e68c Mon Sep 17 00:00:00 2001 From: Lex Date: Wed, 9 Jul 2014 15:47:07 -0700 Subject: [PATCH] switch from term query to match query Summary: Switch to the `match` query. The operator is set to `and` because it defaults to `or` which is likely to annoy users. We might want to consider using `query_string` to get booleans, wildcards, and other features. The only problem with `query_string` is that it can allow querying on other fields in the json document, and we may want to prevent that. That might even expose information we don't want to expose. Another option would be to parse booleans ourselves and translate them to the ES query DSL. fixes T5488 Test Plan: Try the `vpn`/`VPN` test case described in T5488. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: WikiChad, epriestley, Korvin Maniphest Tasks: T5488 Differential Revision: https://secure.phabricator.com/D9785 --- .../search/engine/PhabricatorSearchEngineElastic.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/applications/search/engine/PhabricatorSearchEngineElastic.php b/src/applications/search/engine/PhabricatorSearchEngineElastic.php index c17c4c2538..52b07bcaef 100644 --- a/src/applications/search/engine/PhabricatorSearchEngineElastic.php +++ b/src/applications/search/engine/PhabricatorSearchEngineElastic.php @@ -97,8 +97,11 @@ final class PhabricatorSearchEngineElastic extends PhabricatorSearchEngine { if (strlen($query->getParameter('query'))) { $spec[] = array( - 'term' => array( - 'field.corpus' => $query->getParameter('query'), + 'match' => array( + 'field.corpus' => array( + 'operator' => 'and', + 'query' => $query->getParameter('query'), + ), ), ); }