xapian_db 0.5.13 → 0.5.14

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.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ##0.5.14 (July 7th, 2011)
2
+
3
+ Fixes:
4
+
5
+ - fixed an issue in the beanstalk worker (delete task could not retrieve the xapian id from an already deleted object)
6
+
1
7
  ##0.5.13 (June 20th, 2011)
2
8
 
3
9
  Fixes:
@@ -43,13 +43,13 @@ module XapianDb
43
43
  if blueprint.should_index?(self)
44
44
  XapianDb.index(self)
45
45
  else
46
- XapianDb.unindex(self)
46
+ XapianDb.delete_doc_with(self.xapian_id)
47
47
  end
48
48
  end
49
49
 
50
50
  # add the after destroy logic
51
51
  after_destroy do
52
- XapianDb.unindex(self)
52
+ XapianDb.delete_doc_with(self.xapian_id)
53
53
  end
54
54
 
55
55
  # Add a method to reindex all models of this class
@@ -42,13 +42,13 @@ module XapianDb
42
42
  if blueprint.should_index?(self)
43
43
  XapianDb.index(self)
44
44
  else
45
- XapianDb.unindex(self)
45
+ XapianDb.delete_doc_with(self.xapian_id)
46
46
  end
47
47
  end
48
48
 
49
49
  # add the after destroy logic
50
50
  after :destroy do
51
- XapianDb.unindex(self)
51
+ XapianDb.delete_doc_with(self.xapian_id)
52
52
  end
53
53
 
54
54
  # Add a method to reindex all models of this class
@@ -16,10 +16,8 @@ module XapianDb
16
16
  DirectWriter.index obj
17
17
  end
18
18
 
19
- def unindex_task(options)
20
- klass = constantize options[:class]
21
- obj = klass.respond_to?(:get) ? klass.get(options[:id].to_i) : klass.find(options[:id].to_i)
22
- DirectWriter.unindex obj
19
+ def delete_doc_task(options)
20
+ DirectWriter.delete_doc_with options[:xapian_id]
23
21
  end
24
22
 
25
23
  def reindex_class_task(options)
@@ -18,19 +18,19 @@ module XapianDb
18
18
  # Update an object in the index
19
19
  # @param [Object] obj An instance of a class with a blueprint configuration
20
20
  def index(obj)
21
- beanstalk.put({:task => "index_task", :class => obj.class.name, :id => obj.id}.to_yaml)
21
+ beanstalk.put( {:task => "index_task", :class => obj.class.name, :id => obj.id }.to_yaml )
22
22
  end
23
23
 
24
24
  # Remove an object from the index
25
- # @param [Object] obj An instance of a class with a blueprint configuration
26
- def unindex(obj)
27
- beanstalk.put({:task => "unindex_task", :class => obj.class.name, :id => obj.id}.to_yaml)
25
+ # @param [String] xapian_id The document id
26
+ def delete_doc_with(xapian_id)
27
+ beanstalk.put( { :task => "delete_doc_task", :xapian_id => xapian_id }.to_yaml )
28
28
  end
29
29
 
30
30
  # Reindex all objects of a given class
31
31
  # @param [Class] klass The class to reindex
32
32
  def reindex_class(klass, options={})
33
- beanstalk.put({:task => "reindex_class_task", :class => klass.name}.to_yaml)
33
+ beanstalk.put( { :task => "reindex_class_task", :class => klass.name }.to_yaml )
34
34
  end
35
35
 
36
36
  private
@@ -25,9 +25,9 @@ module XapianDb
25
25
  end
26
26
 
27
27
  # Remove an object from the index
28
- # @param [Object] obj An instance of a class with a blueprint configuration
29
- def unindex(obj)
30
- XapianDb.database.delete_doc_with_unique_term(obj.xapian_id)
28
+ # @param [String] xapian_id The document id of an object
29
+ def delete_doc_with(xapian_id)
30
+ XapianDb.database.delete_doc_with_unique_term xapian_id
31
31
  XapianDb.database.commit
32
32
  end
33
33
 
@@ -13,8 +13,8 @@ module XapianDb
13
13
  def index(obj); end
14
14
 
15
15
  # Remove an object from the index
16
- # @param [Object] obj An instance of a class with a blueprint configuration
17
- def unindex(obj); end
16
+ # @param [String] xapian_id The document id
17
+ def delete_doc_with(xapian_id); end
18
18
 
19
19
  # Reindex all objects of a given class
20
20
  # @param [Class] klass The class to reindex
@@ -10,12 +10,12 @@ module XapianDb
10
10
 
11
11
  class TransactionalWriter
12
12
 
13
- attr_reader :index_requests, :unindex_requests
13
+ attr_reader :index_requests, :delete_requests
14
14
 
15
15
  # Constructor
16
16
  def initialize
17
- @index_requests = []
18
- @unindex_requests = []
17
+ @index_requests = []
18
+ @delete_requests = []
19
19
  end
20
20
 
21
21
  # Update an object in the index
@@ -24,10 +24,10 @@ module XapianDb
24
24
  @index_requests << obj
25
25
  end
26
26
 
27
- # Remove an object from the index
28
- # @param [Object] obj An instance of a class with a blueprint configuration
29
- def unindex(obj)
30
- @unindex_requests << obj
27
+ # Remove a document from the index
28
+ # @param [String] xapian_id The document id
29
+ def delete_doc_with(xapian_id)
30
+ @delete_requests << xapian_id
31
31
  end
32
32
 
33
33
  # Reindex all objects of a given class
@@ -42,7 +42,7 @@ module XapianDb
42
42
  # @param [DirectWriter, BeanstalkWriter] writer The writer to use
43
43
  def commit_using(writer)
44
44
  @index_requests.each { |obj| writer.index obj }
45
- @unindex_requests.each { |obj| writer.unindex obj }
45
+ @delete_requests.each { |xapian_id| writer.delete_doc_with xapian_id }
46
46
  end
47
47
 
48
48
  end
data/lib/xapian_db.rb CHANGED
@@ -92,11 +92,11 @@ module XapianDb
92
92
  writer.index obj
93
93
  end
94
94
 
95
- # Remove an object from the index
96
- # @param [Object] obj An instance of a class with a blueprint configuration
97
- def self.unindex(obj)
95
+ # Remove a document from the index
96
+ # @param [String] xapian_id The document id
97
+ def self.delete_doc_with(xapian_id)
98
98
  writer = @block_writer || XapianDb::Config.writer
99
- writer.unindex obj
99
+ writer.delete_doc_with xapian_id
100
100
  end
101
101
 
102
102
  # Reindex all objects of a given class
metadata CHANGED
@@ -1,71 +1,69 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: xapian_db
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.14
4
5
  prerelease:
5
- version: 0.5.13
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Gernot Kogler
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-06-20 00:00:00 +02:00
12
+ date: 2011-07-07 00:00:00.000000000 +02:00
14
13
  default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
17
16
  name: daemons
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: &2153636500 !ruby/object:Gem::Requirement
20
18
  none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
24
22
  version: 1.0.10
25
23
  type: :runtime
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: rspec
29
24
  prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
25
+ version_requirements: *2153636500
26
+ - !ruby/object:Gem::Dependency
27
+ name: rspec
28
+ requirement: &2153627300 !ruby/object:Gem::Requirement
31
29
  none: false
32
- requirements:
33
- - - ">="
34
- - !ruby/object:Gem::Version
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
35
33
  version: 2.3.1
36
34
  type: :development
37
- version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
39
- name: simplecov
40
35
  prerelease: false
41
- requirement: &id003 !ruby/object:Gem::Requirement
36
+ version_requirements: *2153627300
37
+ - !ruby/object:Gem::Dependency
38
+ name: simplecov
39
+ requirement: &2153626840 !ruby/object:Gem::Requirement
42
40
  none: false
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
46
44
  version: 0.3.7
47
45
  type: :development
48
- version_requirements: *id003
49
- - !ruby/object:Gem::Dependency
50
- name: beanstalk-client
51
46
  prerelease: false
52
- requirement: &id004 !ruby/object:Gem::Requirement
47
+ version_requirements: *2153626840
48
+ - !ruby/object:Gem::Dependency
49
+ name: beanstalk-client
50
+ requirement: &2153626180 !ruby/object:Gem::Requirement
53
51
  none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
57
55
  version: 1.1.0
58
56
  type: :development
59
- version_requirements: *id004
60
- description: XapianDb is a ruby gem that combines features of nosql databases and fulltext indexing. It is based on Xapian, an efficient and powerful indexing library
57
+ prerelease: false
58
+ version_requirements: *2153626180
59
+ description: XapianDb is a ruby gem that combines features of nosql databases and
60
+ fulltext indexing. It is based on Xapian, an efficient and powerful indexing library
61
61
  email: gernot.kogler (at) garaio (dot) com
62
62
  executables: []
63
-
64
- extensions:
63
+ extensions:
65
64
  - Rakefile
66
65
  extra_rdoc_files: []
67
-
68
- files:
66
+ files:
69
67
  - lib/generators/install_generator.rb
70
68
  - lib/generators/templates/beanstalk_worker
71
69
  - lib/xapian_db/adapters/active_record_adapter.rb
@@ -113,35 +111,33 @@ files:
113
111
  has_rdoc: true
114
112
  homepage: https://github.com/garaio/xapian_db
115
113
  licenses: []
116
-
117
114
  post_install_message:
118
- rdoc_options:
115
+ rdoc_options:
119
116
  - --line-numbers
120
117
  - --inline-source
121
118
  - --title
122
119
  - Xapian-DB
123
120
  - --main
124
121
  - README.rdoc
125
- require_paths:
122
+ require_paths:
126
123
  - lib
127
- required_ruby_version: !ruby/object:Gem::Requirement
124
+ required_ruby_version: !ruby/object:Gem::Requirement
128
125
  none: false
129
- requirements:
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- version: "0"
133
- required_rubygems_version: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ! '>='
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ required_rubygems_version: !ruby/object:Gem::Requirement
134
131
  none: false
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
132
+ requirements:
133
+ - - ! '>='
134
+ - !ruby/object:Gem::Version
138
135
  version: 1.3.6
139
136
  requirements: []
140
-
141
137
  rubyforge_project:
142
138
  rubygems_version: 1.6.2
143
139
  signing_key:
144
140
  specification_version: 3
145
- summary: Ruby library to use a Xapian db as a key/value store with high performance fulltext search
141
+ summary: Ruby library to use a Xapian db as a key/value store with high performance
142
+ fulltext search
146
143
  test_files: []
147
-