Sha256: dc39663ae2d5a2e9de9d3c7893163579c946f80b5162c1672f008dd1899cd4c7

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

module SimpleSolrClient

  ESCAPE_CHARS = '+-&|!(){}[]^"~*?:\\'
  ESCAPE_MAP   = ESCAPE_CHARS.split(//).each_with_object({}) {|x,h| h[x] = "\\" + x}
  ESCAPE_PAT   = Regexp.new('[' + Regexp.quote(ESCAPE_CHARS) + ']')

  # Escape those characters that need escaping to be valid lucene syntax.
  # Is *not* called internally, since how as I supposed to know if the parens/quotes are a
  # part of your string or there for legal lucene grouping?
  #
  def self.lucene_escape(str)
    esc = str.to_s.gsub(ESCAPE_PAT, ESCAPE_MAP)
  end


  # Where is the sample core configuration?
  SAMPLE_CORE_DIR = File.absolute_path File.join(File.dirname(__FILE__), '..', 'solr_sample_core')

end

require 'httpclient'
require 'forwardable'

# Choose a JSON-compatible json parser/producer
if defined? JRUBY_VERSION
  require 'json'
else
  require 'oj'
  Oj.mimic_JSON
end




require "simple_solr/version"

# Need to load core before client because of inter-dependencies resulting
# in 'require' recursion

require 'simple_solr/core'
require 'simple_solr/client'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_solr_client-0.1.0 lib/simple_solr.rb