has_searcher 0.0.91 → 0.0.92

Sign up to get free protection for your applications and to get access to all the features.
@@ -79,4 +79,16 @@ class Searcher::Configuration
79
79
  group(name)
80
80
  end
81
81
  end
82
+
83
+ def more_like_this(*args)
84
+ @more_like_this = args
85
+ end
86
+
87
+ def more_like_this?
88
+ !!@more_like_this
89
+ end
90
+
91
+ def more_like_this_params
92
+ @more_like_this
93
+ end
82
94
  end
@@ -15,7 +15,11 @@ class Searcher
15
15
  end
16
16
 
17
17
  def sunspot
18
- @sunspot ||= Sunspot.new_search configuration.search_models
18
+ @sunspot ||= if configuration.more_like_this?
19
+ Sunspot.new_more_like_this *configuration.more_like_this_params
20
+ else
21
+ Sunspot.new_search configuration.search_models
22
+ end
19
23
  end
20
24
 
21
25
  def each(&block)
@@ -60,6 +64,11 @@ class Searcher
60
64
  end
61
65
  end
62
66
 
67
+ def more_like_this(object, *types, &block)
68
+ configuration.more_like_this(object, *types, &block)
69
+ self
70
+ end
71
+
63
72
  def execute
64
73
  unless @executed
65
74
  build_query
@@ -1,3 +1,3 @@
1
1
  module HasSearcher
2
- VERSION = "0.0.91"
2
+ VERSION = "0.0.92"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_searcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.91
4
+ version: 0.0.92
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-21 00:00:00.000000000 Z
12
+ date: 2012-09-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -146,7 +146,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
146
146
  version: '0'
147
147
  segments:
148
148
  - 0
149
- hash: -292320068447473491
149
+ hash: 1317227550788914086
150
150
  required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  none: false
152
152
  requirements:
@@ -155,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
155
  version: '0'
156
156
  segments:
157
157
  - 0
158
- hash: -292320068447473491
158
+ hash: 1317227550788914086
159
159
  requirements: []
160
160
  rubyforge_project:
161
161
  rubygems_version: 1.8.24