yoomee-mongosphinx 0.1.4 → 0.1.5

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/lib/mixins/indexer.rb +12 -2
  2. data/mongosphinx.rb +1 -1
  3. metadata +4 -4
@@ -103,6 +103,9 @@ module MongoMapper # :nodoc:
103
103
  cattr_accessor :fulltext_keys
104
104
  cattr_accessor :fulltext_opts
105
105
  cattr_accessor :has_delta_index
106
+
107
+ attr_accessor :skip_delta_index
108
+ alias_method :skip_delta_index?, :skip_delta_index
106
109
 
107
110
  self.has_delta_index = opts[:delta] || false
108
111
 
@@ -124,8 +127,7 @@ module MongoMapper # :nodoc:
124
127
  after_save :rebuild_delta_index
125
128
  key :delta, Boolean, :default => true
126
129
  define_method(:rebuild_delta_index) do
127
- Rails.logger.info("rebuild_delta_index = #{self.class.to_s.underscore}_delta")
128
- Process.fork {`rake mongosphinx:rebuild index=#{self.class.to_s.underscore}_delta`}
130
+ self.class::reindex_delta unless self.skip_delta_index?
129
131
  end
130
132
  define_method(:set_delta) do
131
133
  self.delta = true
@@ -136,10 +138,18 @@ module MongoMapper # :nodoc:
136
138
  define_method :xml_for_sphinx_core do
137
139
  puts MongoSphinx::Indexer::XMLDocset.new(self.all(:fields => keys << "sphinx_id")).to_s
138
140
  end
141
+ define_method :reindex_core do
142
+ Rails.logger.info("reindexing #{self.to_s.underscore}_core")
143
+ Process.fork {`rake mongosphinx:rebuild index=#{self.to_s.underscore}_core`}
144
+ end
139
145
  if opts[:delta]
140
146
  define_method :xml_for_sphinx_delta do
141
147
  puts MongoSphinx::Indexer::XMLDocset.new(self.all(:fields => keys << "sphinx_id", :delta => true)).to_s
142
148
  end
149
+ define_method :reindex_delta do
150
+ Rails.logger.info("reindexing #{self.to_s.underscore}_delta")
151
+ Process.fork {`rake mongosphinx:rebuild index=#{self.to_s.underscore}_delta`}
152
+ end
143
153
  end
144
154
  end
145
155
 
data/mongosphinx.rb CHANGED
@@ -11,7 +11,7 @@ require 'mongo_mapper'
11
11
  require 'riddle'
12
12
 
13
13
  module MongoSphinx
14
- if (match = __FILE__.match(/yoomee-mongosphinx-([0-9.-]*)/))
14
+ if (match = __FILE__.match(/mongosphinx-([0-9.-]*)/))
15
15
  VERSION = match[1]
16
16
  else
17
17
  VERSION = 'unknown'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yoomee-mongosphinx
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 4
10
- version: 0.1.4
9
+ - 5
10
+ version: 0.1.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matt Atkins
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-17 00:00:00 +01:00
18
+ date: 2010-08-20 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies: []
21
21