riddle 1.5.8 → 1.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ data.tar.gz: 510b7c51b1422b3fee8d37bb3e569b218c3fafba
4
+ metadata.gz: 892c35de7bb285404d93abb4fc52e3c4356fa5ad
5
+ SHA512:
6
+ data.tar.gz: da219c1e7647d916b1719ea4b422072b4e16626227c29dd1df51aac11d5a329b5fc6101adc2f753a84c0395f92beb90b2cfb01be4dd605d9e27ee891f3bbc745
7
+ metadata.gz: abfd8ca976c29a26220402525827e623803356e67c3f11247b09473bc6c5b38e51104a3093eade7478c15a2d747c793f5d99a41eeaf3ba06a5de2de0a76c5c74
data/HISTORY CHANGED
@@ -1,3 +1,8 @@
1
+ 1.5.9 - October 20th 2013
2
+ - Adding all known Sphinx settings to configuration classes as of Sphinx 2.1.2, including JSON settings.
3
+ - Convert date objects in INSERT/REPLACE queries to timestamps, just like time objects.
4
+ - Don't escape references to id in SphinxQL INSERT/REPLACE queries.
5
+
1
6
  1.5.8 - August 26th 2013
2
7
  - Reworked escaping to be consistent and always query-safe (Demian Ferreiro).
3
8
  - Escape column names in SphinxQL WHERE, INSERT, ORDER BY and GROUP BY clauses and statements (Jason Rust).
@@ -13,7 +13,9 @@ module Riddle
13
13
  :html_index_attrs, :html_remove_elements, :preopen, :ondisk_dict,
14
14
  :inplace_enable, :inplace_hit_gap, :inplace_docinfo_gap,
15
15
  :inplace_reloc_factor, :inplace_write_factor, :index_exact_words,
16
- :overshort_step, :stopwords_step, :hitless_words
16
+ :overshort_step, :stopwords_step, :hitless_words, :ha_strategy,
17
+ :bigram_freq_words, :bigram_index, :index_field_lengths,
18
+ :regexp_filter, :stopwords_unstemmed, :global_idf
17
19
  ]
18
20
  end
19
21
 
@@ -28,7 +30,9 @@ module Riddle
28
30
  :html_remove_element_tags, :preopen, :ondisk_dict, :inplace_enable,
29
31
  :inplace_hit_gap, :inplace_docinfo_gap, :inplace_reloc_factor,
30
32
  :inplace_write_factor, :index_exact_words, :overshort_step,
31
- :stopwords_step, :hitless_words
33
+ :stopwords_step, :hitless_words, :ha_strategy, :bigram_freq_words,
34
+ :bigram_index, :index_field_lengths, :regexp_filter,
35
+ :stopwords_unstemmed, :global_idf
32
36
 
33
37
  def initialize_settings
34
38
  @morphologies = []
@@ -41,6 +45,7 @@ module Riddle
41
45
  @ngram_characters = []
42
46
  @phrase_boundaries = []
43
47
  @html_remove_element_tags = []
48
+ @regexp_filter = []
44
49
  end
45
50
 
46
51
  def morphology
@@ -2,17 +2,19 @@ module Riddle
2
2
  class Configuration
3
3
  class Indexer < Riddle::Configuration::Section
4
4
  def self.settings
5
- [
5
+ [
6
6
  :mem_limit, :max_iops, :max_iosize, :max_xmlpipe2_field,
7
- :write_buffer, :max_file_field_buffer, :lemmatizer_base, :lemmatizer_cache
7
+ :write_buffer, :max_file_field_buffer, :on_file_field_error,
8
+ :lemmatizer_base, :lemmatizer_cache, :json_autoconv_numbers,
9
+ :on_json_attr_error
8
10
  ]
9
11
  end
10
-
12
+
11
13
  attr_accessor *self.settings
12
-
14
+
13
15
  def render
14
16
  raise ConfigurationError unless valid?
15
-
17
+
16
18
  (
17
19
  ["indexer", "{"] +
18
20
  settings_body +
@@ -7,13 +7,13 @@ module Riddle
7
7
  Riddle::Configuration::IndexSettings.settings + [
8
8
  :rt_mem_limit, :rt_field, :rt_attr_uint, :rt_attr_bigint,
9
9
  :rt_attr_float, :rt_attr_timestamp, :rt_attr_string, :rt_attr_multi,
10
- :rt_attr_multi_64
10
+ :rt_attr_multi_64, :rt_attr_bool, :rt_attr_json
11
11
  ]
12
12
  end
13
13
 
14
14
  attr_accessor :rt_mem_limit, :rt_field, :rt_attr_uint, :rt_attr_bigint,
15
15
  :rt_attr_float, :rt_attr_timestamp, :rt_attr_string, :rt_attr_multi,
16
- :rt_attr_multi_64
16
+ :rt_attr_multi_64, :rt_attr_bool, :rt_attr_json
17
17
 
18
18
  def initialize(name)
19
19
  @name = name
@@ -25,6 +25,8 @@ module Riddle
25
25
  @rt_attr_string = []
26
26
  @rt_attr_multi = []
27
27
  @rt_attr_multi_64 = []
28
+ @rt_attr_bool = []
29
+ @rt_attr_json = []
28
30
 
29
31
  initialize_settings
30
32
  end
@@ -6,30 +6,34 @@ module Riddle
6
6
  :listen, :address, :port, :log, :query_log,
7
7
  :query_log_format, :read_timeout, :client_timeout, :max_children,
8
8
  :pid_file, :max_matches, :seamless_rotate, :preopen_indexes,
9
- :unlink_old, :attr_flush_period, :ondisk_dict_default, :max_packet_size,
10
- :mva_updates_pool, :crash_log_path, :max_filters, :max_filter_values,
11
- :listen_backlog, :read_buffer, :read_unhinted, :max_batch_queries,
12
- :subtree_docs_cache, :subtree_hits_cache, :workers, :dist_threads,
13
- :binlog_path, :binlog_flush, :binlog_max_log_size, :collation_server,
9
+ :unlink_old, :attr_flush_period, :ondisk_dict_default,
10
+ :max_packet_size, :mva_updates_pool, :crash_log_path, :max_filters,
11
+ :max_filter_values, :listen_backlog, :read_buffer, :read_unhinted,
12
+ :max_batch_queries, :subtree_docs_cache, :subtree_hits_cache,
13
+ :workers, :dist_threads, :binlog_path, :binlog_flush,
14
+ :binlog_max_log_size, :snippets_file_prefix, :collation_server,
14
15
  :collation_libc_locale, :plugin_dir, :mysql_version_string,
15
16
  :rt_flush_period, :thread_stack, :expansion_limit,
16
- :compat_sphinxql_magics, :watchdog, :client_key
17
+ :compat_sphinxql_magics, :watchdog, :prefork_rotation_throttle,
18
+ :sphinxql_state, :ha_ping_interval, :ha_period_karma,
19
+ :persistent_connections_limit, :rt_merge_iops, :rt_merge_maxiosize,
20
+ :predicted_time_costs, :snippets_file_prefix, :client_key
17
21
  ]
18
22
  end
19
-
23
+
20
24
  attr_accessor *self.settings
21
25
  attr_accessor :mysql41
22
-
26
+
23
27
  def render
24
28
  raise ConfigurationError unless valid?
25
-
29
+
26
30
  (
27
31
  ["searchd", "{"] +
28
32
  settings_body +
29
33
  ["}", ""]
30
34
  ).join("\n")
31
35
  end
32
-
36
+
33
37
  def valid?
34
38
  !( @port.nil? || @pid_file.nil? )
35
39
  end
@@ -6,10 +6,11 @@ module Riddle
6
6
  :type, :sql_host, :sql_user, :sql_pass, :sql_db,
7
7
  :sql_port, :sql_sock, :mysql_connect_flags, :mysql_ssl_cert,
8
8
  :mysql_ssl_key, :mysql_ssl_ca, :odbc_dsn, :sql_query_pre, :sql_query,
9
- :sql_joined_field, :sql_file_field, :sql_query_range, :sql_range_step,
10
- :sql_query_killlist, :sql_attr_uint, :sql_attr_bool, :sql_attr_bigint,
11
- :sql_attr_timestamp, :sql_attr_str2ordinal, :sql_attr_float,
12
- :sql_attr_multi, :sql_attr_string, :sql_attr_str2wordcount,
9
+ :sql_joined_field, :sql_file_field, :sql_query_range,
10
+ :sql_range_step, :sql_query_killlist, :sql_attr_uint, :sql_attr_bool,
11
+ :sql_attr_bigint, :sql_attr_timestamp, :sql_attr_str2ordinal,
12
+ :sql_attr_float, :sql_attr_multi, :sql_attr_string,
13
+ :sql_attr_str2wordcount, :sql_attr_json,
13
14
  :sql_column_buffers, :sql_field_string, :sql_field_str2wordcount,
14
15
  :sql_query_post, :sql_query_post_index, :sql_ranged_throttle,
15
16
  :sql_query_info, :mssql_winauth, :mssql_unicode, :unpack_zlib,
@@ -35,6 +36,7 @@ module Riddle
35
36
  @sql_attr_multi = []
36
37
  @sql_attr_string = []
37
38
  @sql_attr_str2wordcount = []
39
+ @sql_attr_json = []
38
40
  @sql_field_string = []
39
41
  @sql_field_str2wordcount = []
40
42
  @sql_query_post = []
@@ -14,7 +14,7 @@ class Riddle::Query::Insert
14
14
  end
15
15
 
16
16
  def to_sql
17
- "#{command} INTO #{@index} (`#{columns_to_s}`) VALUES (#{values_to_s})"
17
+ "#{command} INTO #{@index} (#{columns_to_s}) VALUES (#{values_to_s})"
18
18
  end
19
19
 
20
20
  private
@@ -24,7 +24,10 @@ class Riddle::Query::Insert
24
24
  end
25
25
 
26
26
  def columns_to_s
27
- columns.join('`, `')
27
+ columns.collect { |column|
28
+ column.to_s == 'id' ? 'id' : "`#{column}`"
29
+ }.join(', ')
30
+
28
31
  end
29
32
 
30
33
  def values_to_s
@@ -43,6 +46,8 @@ class Riddle::Query::Insert
43
46
  value ? 1 : 0
44
47
  when Time
45
48
  value.to_i
49
+ when Date
50
+ value.to_time.to_i
46
51
  when Array
47
52
  "(#{value.join(',')})"
48
53
  else
data/riddle.gemspec CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path('../lib', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'riddle'
6
- s.version = '1.5.8'
6
+ s.version = '1.5.9'
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ['Pat Allan']
9
9
  s.email = ['pat@freelancing-gods.com']
@@ -3,23 +3,23 @@ require 'spec_helper'
3
3
  describe Riddle::Query::Insert do
4
4
  it 'handles inserts' do
5
5
  query = Riddle::Query::Insert.new('foo_core', [:id, :deleted], [4, false])
6
- query.to_sql.should == 'INSERT INTO foo_core (`id`, `deleted`) VALUES (4, 0)'
6
+ query.to_sql.should == 'INSERT INTO foo_core (id, `deleted`) VALUES (4, 0)'
7
7
  end
8
-
8
+
9
9
  it 'handles replaces' do
10
10
  query = Riddle::Query::Insert.new('foo_core', [:id, :deleted], [4, false])
11
11
  query.replace!
12
- query.to_sql.should == 'REPLACE INTO foo_core (`id`, `deleted`) VALUES (4, 0)'
12
+ query.to_sql.should == 'REPLACE INTO foo_core (id, `deleted`) VALUES (4, 0)'
13
13
  end
14
-
14
+
15
15
  it 'encloses strings in single quotes' do
16
16
  query = Riddle::Query::Insert.new('foo_core', [:id, :name], [4, 'bar'])
17
- query.to_sql.should == "INSERT INTO foo_core (`id`, `name`) VALUES (4, 'bar')"
17
+ query.to_sql.should == "INSERT INTO foo_core (id, `name`) VALUES (4, 'bar')"
18
18
  end
19
-
19
+
20
20
  it 'handles inserts with more than one set of values' do
21
21
  query = Riddle::Query::Insert.new 'foo_core', [:id, :name], [[4, 'bar'], [5, 'baz']]
22
22
  query.to_sql.
23
- should == "INSERT INTO foo_core (`id`, `name`) VALUES (4, 'bar'), (5, 'baz')"
23
+ should == "INSERT INTO foo_core (id, `name`) VALUES (4, 'bar'), (5, 'baz')"
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,13 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riddle
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
5
- prerelease:
6
- segments:
7
- - 1
8
- - 5
9
- - 8
10
- version: 1.5.8
4
+ version: 1.5.9
11
5
  platform: ruby
12
6
  authors:
13
7
  - Pat Allan
@@ -15,57 +9,38 @@ autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
11
 
18
- date: 2013-08-26 00:00:00 +10:00
19
- default_executable:
12
+ date: 2013-10-19 00:00:00 Z
20
13
  dependencies:
21
14
  - !ruby/object:Gem::Dependency
22
15
  requirement: &id001 !ruby/object:Gem::Requirement
23
- none: false
24
16
  requirements:
25
17
  - - ">="
26
18
  - !ruby/object:Gem::Version
27
- hash: 63
28
- segments:
29
- - 0
30
- - 9
31
- - 2
32
19
  version: 0.9.2
33
20
  version_requirements: *id001
34
- name: rake
35
- prerelease: false
36
21
  type: :development
22
+ prerelease: false
23
+ name: rake
37
24
  - !ruby/object:Gem::Dependency
38
25
  requirement: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
26
  requirements:
41
27
  - - ">="
42
28
  - !ruby/object:Gem::Version
43
- hash: 27
44
- segments:
45
- - 2
46
- - 5
47
- - 0
48
29
  version: 2.5.0
49
30
  version_requirements: *id002
50
- name: rspec
51
- prerelease: false
52
31
  type: :development
32
+ prerelease: false
33
+ name: rspec
53
34
  - !ruby/object:Gem::Dependency
54
35
  requirement: &id003 !ruby/object:Gem::Requirement
55
- none: false
56
36
  requirements:
57
37
  - - ">="
58
38
  - !ruby/object:Gem::Version
59
- hash: 7
60
- segments:
61
- - 0
62
- - 7
63
- - 2
64
39
  version: 0.7.2
65
40
  version_requirements: *id003
66
- name: yard
67
- prerelease: false
68
41
  type: :development
42
+ prerelease: false
43
+ name: yard
69
44
  description: A Ruby API and configuration helper for the Sphinx search service.
70
45
  email:
71
46
  - pat@freelancing-gods.com
@@ -277,39 +252,31 @@ files:
277
252
  - spec/unit/message_spec.rb
278
253
  - spec/unit/response_spec.rb
279
254
  - spec/unit/riddle_spec.rb
280
- has_rdoc: true
281
255
  homepage: http://pat.github.com/riddle/
282
256
  licenses: []
283
257
 
258
+ metadata: {}
259
+
284
260
  post_install_message:
285
261
  rdoc_options: []
286
262
 
287
263
  require_paths:
288
264
  - lib
289
265
  required_ruby_version: !ruby/object:Gem::Requirement
290
- none: false
291
266
  requirements:
292
- - - ">="
267
+ - &id004
268
+ - ">="
293
269
  - !ruby/object:Gem::Version
294
- hash: 3
295
- segments:
296
- - 0
297
270
  version: "0"
298
271
  required_rubygems_version: !ruby/object:Gem::Requirement
299
- none: false
300
272
  requirements:
301
- - - ">="
302
- - !ruby/object:Gem::Version
303
- hash: 3
304
- segments:
305
- - 0
306
- version: "0"
273
+ - *id004
307
274
  requirements: []
308
275
 
309
276
  rubyforge_project: riddle
310
- rubygems_version: 1.6.2
277
+ rubygems_version: 2.1.0
311
278
  signing_key:
312
- specification_version: 3
279
+ specification_version: 4
313
280
  summary: An API for Sphinx, written in and for Ruby.
314
281
  test_files:
315
282
  - spec/fixtures/.gitignore
@@ -471,3 +438,4 @@ test_files:
471
438
  - spec/unit/message_spec.rb
472
439
  - spec/unit/response_spec.rb
473
440
  - spec/unit/riddle_spec.rb
441
+ has_rdoc: