Module: Riddle

Defined in:
lib/riddle.rb,
lib/riddle/client.rb,
lib/riddle/controller.rb,
lib/riddle/client/filter.rb,
lib/riddle/configuration.rb,
lib/riddle/client/message.rb,
lib/riddle/client/response.rb,
lib/riddle/configuration/index.rb,
lib/riddle/configuration/common.rb,
lib/riddle/configuration/source.rb,
lib/riddle/configuration/searchd.rb,
lib/riddle/configuration/indexer.rb,
lib/riddle/configuration/section.rb,
lib/riddle/configuration/xml_source.rb,
lib/riddle/configuration/sql_source.rb,
lib/riddle/configuration/tsv_source.rb,
lib/riddle/configuration/remote_index.rb,
lib/riddle/0.9.9/configuration/searchd.rb,
lib/riddle/configuration/realtime_index.rb,
lib/riddle/configuration/index_settings.rb,
lib/riddle/configuration/template_index.rb,
lib/riddle/configuration/distributed_index.rb

Overview

:nodoc:

Defined Under Namespace

Modules: Query Classes: AutoVersion, Client, Configuration, ConnectionError, Controller, OutOfBoundsError, ResponseError, VersionError

Constant Summary collapse

@@mutex =
Mutex.new
@@escape_pattern =
/[\(\)\|\[email protected]~"&\/]/
@@use_encoding =
defined?(::Encoding) &&
::Encoding.respond_to?(:default_external)

Class Method Summary collapse

Class Method Details

.encode(data, encoding = @@use_encoding && ::Encoding.default_external) ⇒ Object


15
16
17
18
19
20
21
# File 'lib/riddle.rb', line 15

def self.encode(data, encoding = @@use_encoding && ::Encoding.default_external)
  if @@use_encoding
    data.force_encoding(encoding)
  else
    data
  end
end

.escape(string) ⇒ Object


37
38
39
# File 'lib/riddle.rb', line 37

def self.escape(string)
  string.gsub(escape_pattern) { |char| "\\#{char}" }
end

.escape_patternObject


27
28
29
# File 'lib/riddle.rb', line 27

def self.escape_pattern
  @@escape_pattern
end

.escape_pattern=(pattern) ⇒ Object


31
32
33
34
35
# File 'lib/riddle.rb', line 31

def self.escape_pattern=(pattern)
  mutex.synchronize do
    @@escape_pattern = pattern
  end
end

.loaded_versionObject


41
42
43
# File 'lib/riddle.rb', line 41

def self.loaded_version
  @@sphinx_version
end

.loaded_version=(version) ⇒ Object


45
46
47
# File 'lib/riddle.rb', line 45

def self.loaded_version=(version)
  @@sphinx_version = version
end

.mutexObject


23
24
25
# File 'lib/riddle.rb', line 23

def self.mutex
  @@mutex
end

.version_warningObject


49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/riddle.rb', line 49

def self.version_warning
  return if loaded_version

  STDERR.puts %Q{
Riddle cannot detect Sphinx on your machine, and so can't determine which
version of Sphinx you are planning on using. Please use one of the following
lines after "require 'riddle'" to avoid this warning.

require 'riddle/0.9.8'
# or
require 'riddle/0.9.9'
# or
require 'riddle/1.10'

  }
end