aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2020-02-29 22:24:32 +0100
committerChristian Weiske <cweiske@cweiske.de>2020-02-29 22:24:32 +0100
commit07889abdc92ce2e4696fd46b4a2a3bfb8c26ed29 (patch)
tree2dbafec8a5883e3d5d98436edcb867a6ef9d2d05
parentd3cdabcac7feb8c62451ac12a22256c0eff16873 (diff)
downloadphinde-07889abdc92ce2e4696fd46b4a2a3bfb8c26ed29.tar.gz
phinde-07889abdc92ce2e4696fd46b4a2a3bfb8c26ed29.zip
Do not break when searching for slashes
Resolves: https://github.com/cweiske/phinde/issues/36
-rw-r--r--src/phinde/Elasticsearch.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/phinde/Elasticsearch.php b/src/phinde/Elasticsearch.php
index 5ca2180..fd60f95 100644
--- a/src/phinde/Elasticsearch.php
+++ b/src/phinde/Elasticsearch.php
@@ -122,6 +122,11 @@ class Elasticsearch
);
}
+ if (strpos($query, '/') !== false && strpos($query, '"') === false) {
+ //add quotes when there is a slash and no quotes
+ // https://stackoverflow.com/questions/31963643/escaping-forward-slashes-in-elasticsearch
+ $query = '"' . $query . '"';
+ }
$qMust[] = array(
'query_string' => array(
'default_field' => '_all',