Sha256: a760e606288eed6c41fef709a62486eaac7c9ff799cd2447ef98b80cd7bb79e0

Contents?: true

Size: 732 Bytes

Versions: 10

Compression:

Stored size: 732 Bytes

Contents

# Blacklight-cql

require 'blacklight_cql/blacklight_to_solr'

require 'blacklight_cql/version'
require 'blacklight_cql/engine'

module BlacklightCql
mattr_accessor :cql_search_field_key
  self.cql_search_field_key = "cql"

  # Escape single or double quote marks with backslash
  def self.escape_quotes(input)
    input.gsub("'", "\\\'").gsub('"', "\\\"")
  end

  # Escapes value for Solr LocalParam. Will wrap in
  # quotes only if needed (if not needed, and the value
  # turns out to have been a $param, then quotes will mess
  # things up!), and escapes value inside quotes. 
  def self.solr_param_quote(val)
    unless val =~ /^[a-zA-Z$_\-\^]+$/
      val = "'" + escape_quotes(val) + "'"
    end
    return val
  end
  
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
blacklight_cql-2.0.1 lib/blacklight_cql.rb
blacklight_cql-2.0.0 lib/blacklight_cql.rb
blacklight_cql-1.2.1 lib/blacklight_cql.rb
blacklight_cql-1.2.0 lib/blacklight_cql.rb
blacklight_cql-1.1.0 lib/blacklight_cql.rb
blacklight_cql-1.0.1 lib/blacklight_cql.rb
blacklight_cql-1.0.0 lib/blacklight_cql.rb
blacklight_cql-1.0.0pre3 lib/blacklight_cql.rb
blacklight_cql-1.0.0pre2 lib/blacklight_cql.rb
blacklight_cql-1.0.0pre1 lib/blacklight_cql.rb