Browse code

[CTI] BM-14947 Fix: Autcomplete query now values matching the requested pattern

Mehdi Rande authored on 08/07/2019 13:35:32
Showing 1 changed files
... ...
@@ -68,13 +68,14 @@ net.bluemind.ui.cti.PhoneMatcher.prototype.requestMatchingRows = function(token,
68 68
     'Accept' : 'application/json'
69 69
   }));
70 70
   var client = new net.bluemind.addressbook.api.AddressBooksClient(rpc, '');
71
+  var escapedToken = token.replace(/([:+\-!\(\){}\[\]^"~*?\\]|[&\|]{2})/g,  "\\$1");
71 72
   var query = {
72 73
     'from' : 0,
73 74
     'size' : 10,
74
-    'escapeQuery' : true,
75
+    'escapeQuery' : false,
75 76
     'query' : '_exists_: value.communications.tels.value ' + //
76
-    ' AND ( value.identification.formatedName.value:' + token + //
77
-    ' OR value.communications.tels.value:' + token + ' )'
77
+    ' AND ( value.identification.formatedName.value:' + escapedToken + //
78
+    ' OR value.communications.tels.value:' + escapedToken + ' )'
78 79
   };
79 80
 
80 81
   client.search(query).then(function(res) {