Escaping Lucene Characters using Javascript Regex -


I am using elastic search in a nodesjs project, which by entering one of the lucene keywords in the search box Is breaking. The best way I am looking for a simple implementation to avoid my special characters is regex? I am now negligible with a little regdiction, and I felt like some others have already gone through this process.

Just Bella needs more.

  var escaped = query.replace (/ ([\! \ * \ + \ & Amp; \ | \ (\) \ [\] \ {\} \ ^ \ ~ \?  

Change all the places globally, lucene will yell about your escape version. / P>


Comments

Popular posts from this blog

c# - SignalR: "Protocol error: Unknown transport." when navigating to hub -

class - Kivy: how to instantiate a dynamic classes in python -

python - mayavi mapping a discrete colorbar on a surface -