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/indexer.rb,
lib/riddle/configuration/searchd.rb,
lib/riddle/configuration/section.rb,
lib/riddle/configuration/sql_source.rb,
lib/riddle/configuration/tsv_source.rb,
lib/riddle/configuration/xml_source.rb,
lib/riddle/configuration/remote_index.rb,
lib/riddle/0.9.9/configuration/searchd.rb,
lib/riddle/configuration/index_settings.rb,
lib/riddle/configuration/realtime_index.rb,
lib/riddle/configuration/template_index.rb,
lib/riddle/configuration/distributed_index.rb

Overview

:nodoc:

Defined Under Namespace

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

Constant Summary collapse

NoConfigurationFileError =
Class.new StandardError
@@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


19
20
21
22
23
24
25
# File 'lib/riddle.rb', line 19

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

.escape(string) ⇒ Object


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

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

.escape_patternObject


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

def self.escape_pattern
  @@escape_pattern
end

.escape_pattern=(pattern) ⇒ Object


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

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

.loaded_versionObject


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

def self.loaded_version
  @@sphinx_version
end

.loaded_version=(version) ⇒ Object


49
50
51
# File 'lib/riddle.rb', line 49

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

.mutexObject


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

def self.mutex
  @@mutex
end

.version_warningObject


53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/riddle.rb', line 53

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