Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Escape forward slashes

In Solr 4.0, you can use regular expressions in queries by delimiting them using slashes. This means that any parameters that contain a forward slash need to be surrounded in quotes (or escaped).

  • Loading branch information...
commit cf8e4d21823f75a7b49c26dde5a19a694c800a92 1 parent f7a7820
@Daniel15 authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 core/Parameter.js
4 core/Parameter.js
@@ -170,9 +170,9 @@ AjaxSolr.Parameter = AjaxSolr.Class.extend(
* @returns {String} The escaped value.
AjaxSolr.Parameter.escapeValue = function (value) {
- // If the field value has a space or a colon in it, wrap it in quotes,
+ // If the field value has a space, colon or forward slash in it, wrap it in quotes,
// unless it is a range query or it is already wrapped in quotes.
- if (value.match(/[ :]/) && !value.match(/[\[\{]\S+ TO \S+[\]\}]/) && !value.match(/^["\(].*["\)]$/)) {
+ if (value.match(/[ :\/]/) && !value.match(/[\[\{]\S+ TO \S+[\]\}]/) && !value.match(/^["\(].*["\)]$/)) {
return '"' + value + '"';
return value;

0 comments on commit cf8e4d2

Please sign in to comment.
Something went wrong with that request. Please try again.