xapian_db 0.5.11 → 0.5.12

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.12 (April 28th, 2011)
2
+
3
+ Fixes:
4
+
5
+ - avoid stale blueprint setups when an indexed class is reloaded
6
+
1
7
  ##0.5.11 (April 21st, 2011)
2
8
 
3
9
  Features:
data/README.rdoc CHANGED
@@ -284,7 +284,8 @@ The easiest way is to use macports or homebrew:
284
284
  sudo apt-get -t lenny-backports install libevent-1.4-2
285
285
  sudo apt-get -t lenny-backports install libevent-dev
286
286
  cd /tmp
287
- curl http://xph.us/dist/beanstalkd/beanstalkd-1.4.6.tar.gz | tar zx
287
+ wget --no-check-certificate https://github.com/downloads/kr/beanstalkd/beanstalkd-1.4.6.tar.gz
288
+ tar xvf beanstalkd-1.4.6.tar.gz
288
289
  cd beanstalkd-1.4.6/
289
290
  ./configure
290
291
  make
@@ -297,7 +298,7 @@ The easiest way is to use macports or homebrew:
297
298
 
298
299
  === 3. Install the beanstalk worker script
299
300
 
300
- rails generate xapian:db install
301
+ rails generate xapian_db:install
301
302
 
302
303
  === 4. Configure your production environment in config/xapian_db.yml
303
304
 
@@ -35,6 +35,8 @@ module XapianDb
35
35
  @blueprints ||= {}
36
36
  blueprint = DocumentBlueprint.new
37
37
  yield blueprint if block_given? # configure the blueprint through the block
38
+ # Remove a previously loaded blueprint for this class to avoid stale blueprint definitions
39
+ @blueprints.delete_if { |key, blueprint| key.name == klass.name }
38
40
  @blueprints[klass] = blueprint
39
41
  @_adapter = blueprint._adapter || XapianDb::Config.adapter || Adapters::GenericAdapter
40
42
  @_adapter.add_class_helper_methods_to klass
@@ -65,14 +67,10 @@ module XapianDb
65
67
  # @return [Array<String>] All searchable prefixes
66
68
  def searchable_prefixes
67
69
  return [] unless @blueprints
68
- return @searchable_prefixes unless @searchable_prefixes.nil?
69
- prefixes = []
70
- @blueprints.values.each do |blueprint|
71
- prefixes << blueprint.searchable_prefixes
72
- end
73
- @searchable_prefixes = prefixes.flatten.compact.uniq
70
+ @searchable_prefixes ||= @blueprints.values.map { |blueprint| blueprint.searchable_prefixes }.flatten.compact.uniq
74
71
  # We can always do a field search on the name of the indexed class
75
72
  @searchable_prefixes << "indexed_class"
73
+ @searchable_prefixes
76
74
  end
77
75
 
78
76
  end
@@ -206,7 +204,6 @@ module XapianDb
206
204
  # end
207
205
  # end
208
206
  # end
209
- # @todo Make sure the name does not collide with a method name of Xapian::Document
210
207
  def attribute(name, options={}, &block)
211
208
  raise ArgumentError.new("You cannot use #{name} as an attribute name since it is a reserved method name of Xapian::Document") if reserved_method_name?(name)
212
209
  opts = {:index => true}.merge(options)
@@ -221,7 +218,6 @@ module XapianDb
221
218
  # Add a list of attributes to the blueprint. Attributes will be stored in the xapian documents ans
222
219
  # can be accessed from a search result.
223
220
  # @param [Array] attributes An array of method names that deliver the values for the attributes
224
- # @todo Make sure the name does not collide with a method name of Xapian::Document
225
221
  def attributes(*attributes)
226
222
  attributes.each do |attr|
227
223
  raise ArgumentError.new("You cannot use #{attr} as an attribute name since it is a reserved method name of Xapian::Document") if reserved_method_name?(attr)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 11
9
- version: 0.5.11
8
+ - 12
9
+ version: 0.5.12
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-04-21 00:00:00 +02:00
17
+ date: 2011-05-02 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency