odba 1.0.8 → 1.0.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.
Files changed (5) hide show
  1. data/History.txt +7 -0
  2. data/lib/odba/storage.rb +43 -49
  3. data/lib/odba.rb +1 -1
  4. metadata +42 -56
  5. data/Manifest.txt +0 -39
data/History.txt CHANGED
@@ -1,3 +1,10 @@
1
+ === 1.0.9 / 15.03.2013
2
+
3
+ * Update dictionary to be suitable for new tsearch2
4
+ - generate_dictionary API is changed.
5
+ - generate_dictionary needs dict source files(dict, affix, stop)
6
+ into /usr/share/postgresql/tsearch_data.
7
+
1
8
  === 1.0.8 / 09.01.2012
2
9
 
3
10
  * Added exclusive control to update @accessed_by Hash variable in CacheEntry class using mutex (Patinfo-Invoice Error)
data/lib/odba/storage.rb CHANGED
@@ -112,22 +112,26 @@ CREATE TABLE collection (
112
112
  self.dbi.select_all(sql, id)
113
113
  end
114
114
  def create_dictionary_map(language)
115
- %w{lhword lpart_hword lword}.each { |token|
116
- self.dbi.do <<-SQL
117
- INSERT INTO pg_ts_cfgmap (ts_name, tok_alias, dict_name)
118
- VALUES ('default_#{language}', '#{token}',
119
- '{#{language}_ispell,#{language}_stem}')
120
- SQL
121
- }
122
- [ 'url', 'host', 'sfloat', 'uri', 'int', 'float', 'email',
123
- 'word', 'hword', 'nlword', 'nlpart_hword', 'part_hword',
124
- 'nlhword', 'file', 'uint', 'version'
125
- ].each { |token|
126
- self.dbi.do <<-SQL
127
- INSERT INTO pg_ts_cfgmap (ts_name, tok_alias, dict_name)
128
- VALUES ('default_#{language}', '#{token}', '{simple}')
129
- SQL
130
- }
115
+ self.dbi.do <<-SQL
116
+ ALTER TEXT SEARCH CONFIGURATION default_#{language}
117
+ ALTER MAPPING FOR
118
+ asciiword, asciihword, hword_asciipart,
119
+ word, hword, hword_part, hword_numpart,
120
+ numword, numhword
121
+ WITH #{language}_ispell, #{language}_stem;
122
+ SQL
123
+ self.dbi.do <<-SQL
124
+ ALTER TEXT SEARCH CONFIGURATION default_#{language}
125
+ ALTER MAPPING FOR
126
+ host, file, int, uint, version
127
+ WITH simple;
128
+ SQL
129
+ # drop from default setting
130
+ self.dbi.do <<-SQL
131
+ ALTER TEXT SEARCH CONFIGURATION default_#{language}
132
+ DROP MAPPING FOR
133
+ email, url, url_path, sfloat, float
134
+ SQL
131
135
  end
132
136
  def create_condition_index(table_name, definition)
133
137
  self.dbi.do <<-SQL
@@ -292,35 +296,32 @@ CREATE INDEX target_id_#{table_name} ON #{table_name}(target_id);
292
296
  SQL
293
297
  self.dbi.select_all(sql, origin_id)
294
298
  end
295
- def generate_dictionary(language, locale, dict_dir)
299
+ def generate_dictionary(language, data_path='/usr/share/postgresql/tsearch_data/', file='fulltext')
300
+ found = true
301
+ %w{dict affix stop}.each do |ext|
302
+ filename = "#{file}.#{ext}"
303
+ source = File.join(data_path, filename)
304
+ unless File.exists?(source)
305
+ puts "ERROR: \"#{filename}\" does not exist in #{data_path}."
306
+ found = false
307
+ end
308
+ end
309
+ return unless found
296
310
  # setup configuration
297
311
  self.dbi.do <<-SQL
298
- INSERT INTO pg_ts_cfg (ts_name, prs_name, locale)
299
- VALUES ('default_#{language}', 'default', '#{locale}');
300
- SQL
301
- # insert path to dictionary
302
- sql = <<-SQL
303
- INSERT INTO pg_ts_dict (
304
- SELECT '#{language}_ispell', dict_init, ?, dict_lexize
305
- FROM pg_ts_dict
306
- WHERE dict_name = 'ispell_template'
307
- );
312
+ CREATE TEXT SEARCH CONFIGURATION public.default_#{language} ( COPY = pg_catalog.#{language} );
308
313
  SQL
309
- prepath = File.expand_path("fulltext", dict_dir)
310
- path = %w{Aff Dict Stop}.collect { |type|
311
- sprintf('%sFile="%s.%s"', type, prepath, type.downcase)
312
- }.join(',')
313
- sth.do sql, path
314
- create_dictionary_map(language)
314
+ # ispell
315
315
  self.dbi.do <<-SQL
316
- INSERT INTO pg_ts_dict (
317
- dict_name, dict_init, dict_lexize
318
- )
319
- VALUES (
320
- '#{language}_stem', 'dinit_#{language}(internal)',
321
- 'snb_lexize(internal, internal, int4)'
316
+ CREATE TEXT SEARCH DICTIONARY #{language}_ispell (
317
+ TEMPLATE = ispell,
318
+ DictFile = #{file},
319
+ AffFile = #{file},
320
+ StopWords = #{file}
322
321
  );
323
322
  SQL
323
+ # stem is already there.
324
+ create_dictionary_map(language)
324
325
  end
325
326
  def index_delete_origin(index_name, odba_id, term)
326
327
  self.dbi.do <<-SQL, odba_id, term
@@ -412,18 +413,11 @@ CREATE INDEX target_id_#{table_name} ON #{table_name}(target_id);
412
413
  def remove_dictionary(language)
413
414
  # remove configuration
414
415
  self.dbi.do <<-SQL
415
- DELETE FROM pg_ts_cfg
416
- WHERE ts_name='default_#{language}'
417
- SQL
418
- # remove dictionaries
419
- self.dbi.do <<-SQL
420
- DELETE FROM pg_ts_dict
421
- WHERE dict_name IN ('#{language}_ispell', '#{language}_stem')
416
+ DROP TEXT SEARCH CONFIGURATION IF EXISTS default_#{language}
422
417
  SQL
423
- # remove tokens
418
+ # remove ispell dictionaries
424
419
  self.dbi.do <<-SQL
425
- DELETE FROM pg_ts_cfgmap
426
- WHERE ts_name='default_#{language}'
420
+ DROP TEXT SEARCH DICTIONARY IF EXISTS #{language}_ispell;
427
421
  SQL
428
422
  end
429
423
  def restore(odba_id)
data/lib/odba.rb CHANGED
@@ -11,5 +11,5 @@ require 'odba/index'
11
11
  require 'odba/odba'
12
12
 
13
13
  class Odba
14
- VERSION = '1.0.8'
14
+ VERSION = '1.0.9'
15
15
  end
metadata CHANGED
@@ -1,57 +1,52 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: odba
3
- version: !ruby/object:Gem::Version
4
- hash: 7
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.9
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- - 8
10
- version: 1.0.8
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Masaomi Hatakeyama, Zeno R.R. Davatz
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-01-09 00:00:00 +01:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- name: hoe
12
+ date: 2013-03-15 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rdoc
16
+ requirement: &5759020 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '3.10'
22
+ type: :development
23
23
  prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
24
+ version_requirements: *5759020
25
+ - !ruby/object:Gem::Dependency
26
+ name: hoe
27
+ requirement: &6140080 !ruby/object:Gem::Requirement
25
28
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 41
30
- segments:
31
- - 2
32
- - 9
33
- - 1
34
- version: 2.9.1
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: '2.13'
35
33
  type: :development
36
- version_requirements: *id001
34
+ prerelease: false
35
+ version_requirements: *6140080
37
36
  description: Object Database Access - Ruby Software for ODDB.org Memory Management
38
- email:
37
+ email:
39
38
  - mhatakeyama@ywesee.com, zdavatz@ywesee.com
40
39
  executables: []
41
-
42
40
  extensions: []
43
-
44
- extra_rdoc_files:
41
+ extra_rdoc_files:
45
42
  - Guide.txt
46
43
  - History.txt
47
44
  - LICENSE.txt
48
- - Manifest.txt
49
45
  - README.txt
50
- files:
46
+ files:
51
47
  - Guide.txt
52
48
  - History.txt
53
49
  - LICENSE.txt
54
- - Manifest.txt
55
50
  - README.txt
56
51
  - Rakefile
57
52
  - install.rb
@@ -88,42 +83,33 @@ files:
88
83
  - test/test_storage.rb
89
84
  - test/test_stub.rb
90
85
  - .gemtest
91
- has_rdoc: true
92
86
  homepage: http://scm.ywesee.com/?p=odba/.git;a=summary
93
87
  licenses: []
94
-
95
88
  post_install_message:
96
- rdoc_options:
89
+ rdoc_options:
97
90
  - --main
98
91
  - README.txt
99
- require_paths:
92
+ require_paths:
100
93
  - lib
101
- required_ruby_version: !ruby/object:Gem::Requirement
94
+ required_ruby_version: !ruby/object:Gem::Requirement
102
95
  none: false
103
- requirements:
104
- - - ">="
105
- - !ruby/object:Gem::Version
106
- hash: 3
107
- segments:
108
- - 0
109
- version: "0"
110
- required_rubygems_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ! '>='
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
111
101
  none: false
112
- requirements:
113
- - - ">="
114
- - !ruby/object:Gem::Version
115
- hash: 3
116
- segments:
117
- - 0
118
- version: "0"
102
+ requirements:
103
+ - - ! '>='
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
119
106
  requirements: []
120
-
121
107
  rubyforge_project: odba
122
- rubygems_version: 1.4.2
108
+ rubygems_version: 1.8.15
123
109
  signing_key:
124
110
  specification_version: 3
125
111
  summary: Object Database Access - Ruby Software for ODDB.org Memory Management
126
- test_files:
112
+ test_files:
127
113
  - test/test_array.rb
128
114
  - test/test_cache.rb
129
115
  - test/test_cache_entry.rb
data/Manifest.txt DELETED
@@ -1,39 +0,0 @@
1
- Guide.txt
2
- History.txt
3
- LICENSE.txt
4
- Manifest.txt
5
- README.txt
6
- Rakefile
7
- install.rb
8
- lib/odba.rb
9
- lib/odba/18_19_loading_compatibility.rb
10
- lib/odba/cache.rb
11
- lib/odba/cache_entry.rb
12
- lib/odba/connection_pool.rb
13
- lib/odba/drbwrapper.rb
14
- lib/odba/id_server.rb
15
- lib/odba/index.rb
16
- lib/odba/index_definition.rb
17
- lib/odba/marshal.rb
18
- lib/odba/odba.rb
19
- lib/odba/odba_error.rb
20
- lib/odba/persistable.rb
21
- lib/odba/storage.rb
22
- lib/odba/stub.rb
23
- sql/collection.sql
24
- sql/create_tables.sql
25
- sql/object.sql
26
- sql/object_connection.sql
27
- test/suite.rb
28
- test/test_array.rb
29
- test/test_cache.rb
30
- test/test_cache_entry.rb
31
- test/test_connection_pool.rb
32
- test/test_drbwrapper.rb
33
- test/test_hash.rb
34
- test/test_id_server.rb
35
- test/test_index.rb
36
- test/test_marshal.rb
37
- test/test_persistable.rb
38
- test/test_storage.rb
39
- test/test_stub.rb