×

Welcome to TagMyCode

Please login or create account to add a snippet.
1
0
 
1
Language: Javascript
Posted by: Solr Trovaprezzi
Added: Mar 2, 2016 9:12 AM
Views: 9
https://github.com/medihack/querysolr
  1. function escapeLucene(value) {
  2.     var specials = ['+', '-', '&', '!', '(', ')', '{', '}', '[', ']', '^', '"', '~', '*', '?', ':', '\\'];
  3.     var regexp = new RegExp("(\\" + specials.join("|\\") + ")", "g");
  4.     return value.replace(regexp, "\\$1");
  5. }