de 0.0.1 → 0.0.2
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/lib/de/de.rb +3 -1
- data/lib/de/sunspot_solr/search.rb +14 -2
- data/lib/de/version.rb +1 -1
- metadata +4 -4
data/lib/de/de.rb
CHANGED
@@ -79,13 +79,15 @@ module De
|
|
79
79
|
#
|
80
80
|
# === Input
|
81
81
|
#
|
82
|
+
# params<Hash>:: optional paramters hash
|
83
|
+
#
|
82
84
|
# no input
|
83
85
|
#
|
84
86
|
# === Output
|
85
87
|
#
|
86
88
|
# true
|
87
89
|
#
|
88
|
-
def evaluate
|
90
|
+
def evaluate(params = nil)
|
89
91
|
raise Error::InvalidExpressionError unless valid?
|
90
92
|
true
|
91
93
|
end
|
@@ -69,7 +69,8 @@ module De
|
|
69
69
|
# :name => {:type => :string, :dynamic => false},
|
70
70
|
# :price => {:type => :integer, :dynamic => true}
|
71
71
|
# },
|
72
|
-
# :dynamics => {:integer => :int_params, :string => :string_params, :time => :time_params, :text => :string_params}
|
72
|
+
# :dynamics => {:integer => :int_params, :string => :string_params, :time => :time_params, :text => :string_params},
|
73
|
+
# :per_page => 30
|
73
74
|
# })
|
74
75
|
#
|
75
76
|
def initialize(name, klass, options = {}, operands = nil)
|
@@ -160,16 +161,27 @@ module De
|
|
160
161
|
#
|
161
162
|
# Evaluator
|
162
163
|
#
|
164
|
+
# params<Hash>:: optional parameters hash
|
165
|
+
# Supported hash keys:
|
166
|
+
# :page - gives page for paging.
|
167
|
+
# Number of results per page is defined by @option[:per_page] parameter
|
168
|
+
# Default values: page - 1, per_page - 10000
|
169
|
+
#
|
163
170
|
# === Output
|
164
171
|
#
|
165
172
|
# Sunspot Search object
|
166
173
|
# built on its current tree operators and operands
|
167
174
|
#
|
168
|
-
def evaluate
|
175
|
+
def evaluate(params = nil)
|
169
176
|
super
|
170
177
|
|
178
|
+
page = params && params[:page] ? params[:page] : 1
|
179
|
+
per_page = @options[:per_page] || 10000
|
180
|
+
|
171
181
|
search_string = "Sunspot.search(#{Kernel.const_get(@klass)}) do
|
172
182
|
#{children.map {|child| child.evaluate + "\n" } }
|
183
|
+
|
184
|
+
paginate(:page => #{page}, :per_page => #{per_page})
|
173
185
|
end"
|
174
186
|
|
175
187
|
instance_eval search_string
|
data/lib/de/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: de
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Olga Gorun
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-08-
|
18
|
+
date: 2011-08-31 00:00:00 +03:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|