xapian_db 0.5.8 → 0.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.
Files changed (3) hide show
  1. data/CHANGELOG.md +6 -0
  2. data/lib/xapian_db.rb +9 -7
  3. metadata +3 -3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ##0.5.9 (March 25th, 2011)
2
+
3
+ Fixes:
4
+
5
+ - indexing was broken in 0.5.8
6
+
1
7
  ##0.5.8 (March 22th, 2011)
2
8
 
3
9
  Fixes:
data/lib/xapian_db.rb CHANGED
@@ -88,13 +88,15 @@ module XapianDb
88
88
  # Update an object in the index
89
89
  # @param [Object] obj An instance of a class with a blueprint configuration
90
90
  def self.index(obj)
91
- @writer.index obj
91
+ writer = @transactional_writer || XapianDb::Config.writer
92
+ writer.index obj
92
93
  end
93
94
 
94
95
  # Remove an object from the index
95
96
  # @param [Object] obj An instance of a class with a blueprint configuration
96
97
  def self.unindex(obj)
97
- @writer.unindex obj
98
+ writer = @transactional_writer || XapianDb::Config.writer
99
+ writer.unindex obj
98
100
  end
99
101
 
100
102
  # Reindex all objects of a given class
@@ -102,7 +104,7 @@ module XapianDb
102
104
  # @param [Hash] options Options for reindexing
103
105
  # @option options [Boolean] :verbose (false) Should the reindexing give status informations?
104
106
  def self.reindex_class(klass, options={})
105
- @writer.reindex_class klass, options
107
+ XapianDb::Config.writer.reindex_class klass, options
106
108
  end
107
109
 
108
110
  # Rebuild the xapian index for all configured blueprints
@@ -121,10 +123,10 @@ module XapianDb
121
123
  # Execute a block as a transaction
122
124
  def self.transaction(&block)
123
125
  # Temporarily use the transactional writer
124
- @writer = XapianDb::IndexWriters::TransactionalWriter.new
126
+ @transactional_writer = XapianDb::IndexWriters::TransactionalWriter.new
125
127
  begin
126
128
  block.call
127
- @writer.commit_using XapianDb::Config.writer
129
+ @transactional_writer.commit_using XapianDb::Config.writer
128
130
  rescue Exception => ex
129
131
  msg = "error in XapianDb transaction block: #{ex}, transaction aborted"
130
132
  if defined?(Rails)
@@ -133,8 +135,8 @@ module XapianDb
133
135
  puts msg
134
136
  end
135
137
  ensure
136
- # switch back to the configured writer
137
- @writer = XapianDb::Config.writer
138
+ # release the transactional writer
139
+ @transactional_writer = nil
138
140
  end
139
141
  end
140
142
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 8
9
- version: 0.5.8
8
+ - 9
9
+ version: 0.5.9
10
10
  platform: ruby
11
11
  authors:
12
12
  - Gernot Kogler
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-03-23 00:00:00 +01:00
17
+ date: 2011-03-25 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency