mm-search 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  = mm-search
2
2
 
3
- * http://github.com/#{github_username}/#{project_name}
3
+ * http://github.com/dcu/mm-files
4
4
 
5
5
  == DESCRIPTION:
6
6
 
@@ -45,4 +45,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
45
45
  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
46
46
  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
47
47
  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
48
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
48
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -14,7 +14,7 @@ $hoe = Hoe.spec 'mm-search' do
14
14
  self.developer 'David Cuadrado', 'krawek@gmail.com'
15
15
  # self.post_install_message = 'PostInstall.txt'
16
16
  self.rubyforge_name = "mm-plugins"
17
- self.extra_deps = [['mongomapper','>= 0.3.1']]
17
+ self.extra_deps = [['mongo_mapper','>= 0.5.0']]
18
18
 
19
19
  end
20
20
 
@@ -2,9 +2,9 @@ $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
4
  module MmSearch
5
- VERSION = '0.0.2'
5
+ VERSION = '0.0.3'
6
6
  end
7
7
 
8
8
 
9
- require 'mongomapper'
9
+ require 'mongo_mapper'
10
10
  require 'mm-search/search'
@@ -29,13 +29,24 @@ module MongoMapper
29
29
  q = query.downcase.split.map do |k|
30
30
  Regexp.escape(k)
31
31
  end.join("|")
32
- self.find(:all, opts.deep_merge(:conditions => {:_keywords => /^(#{q}).*/ }))
32
+ if opts[:per_page]
33
+ self.paginate(opts.deep_merge(:conditions => {:_keywords => /^(#{q}).*/ }))
34
+ else
35
+ self.find(:all, opts.deep_merge(:conditions => {:_keywords => /^(#{q}).*/ }))
36
+ end
33
37
  end
34
38
  end
35
39
 
36
40
  protected
37
41
  def _update_keywords
38
- s = Lingua::Stemmer.new(:language => self.class.language)
42
+ lang = self.class.language
43
+ if lang.kind_of?(Symbol)
44
+ lang = send(lang)
45
+ elsif lang.kind_of?(Proc)
46
+ lang = lang.call(self)
47
+ end
48
+
49
+ s = Lingua::Stemmer.new(:language => lang)
39
50
 
40
51
  self._keywords = []
41
52
  self.class.searchable_keys.each do |key|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mm-search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cuadrado
@@ -9,18 +9,18 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-18 00:00:00 -05:00
12
+ date: 2009-10-07 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: mongomapper
16
+ name: mongo_mapper
17
17
  type: :runtime
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.3.1
23
+ version: 0.5.0
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: hoe
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 2.3.2
33
+ version: 2.3.3
34
34
  version:
35
35
  description: FIX (describe your package)
36
36
  email:
@@ -54,7 +54,7 @@ files:
54
54
  - test/test_helper.rb
55
55
  - test/test_mm-search.rb
56
56
  has_rdoc: true
57
- homepage: http://github.com/#{github_username}/#{project_name}
57
+ homepage: http://github.com/dcu/mm-files
58
58
  licenses: []
59
59
 
60
60
  post_install_message: