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

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -