cloudsearchable 0.0.2 → 0.0.3
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/README.md +24 -10
- data/cloudsearchable.gemspec +1 -0
- data/lib/cloudsearchable.rb +1 -0
- data/lib/cloudsearchable/domain.rb +12 -4
- data/lib/cloudsearchable/query_chain.rb +58 -21
- data/lib/cloudsearchable/version.rb +1 -1
- data/spec/cloudsearchable/cloudsearchable_spec.rb +3 -3
- data/spec/cloudsearchable/query_chain_spec.rb +100 -60
- data/spec/test_classes/cloud_searchable_test_class.rb +5 -5
- metadata +18 -2
data/README.md
CHANGED
@@ -14,12 +14,6 @@ class Customer
|
|
14
14
|
|
15
15
|
# This is the default index. You probably only need one.
|
16
16
|
index_in_cloudsearch do |idx|
|
17
|
-
literal :id, :searchable => true
|
18
|
-
end
|
19
|
-
|
20
|
-
# A named index.
|
21
|
-
index_in_cloudsearch :test_index do |idx|
|
22
|
-
|
23
17
|
# Fetch the customer_id field from customer
|
24
18
|
literal :customer_id, :returnable => true, :searchable => true, :source => Proc.new { customer }
|
25
19
|
|
@@ -29,6 +23,11 @@ class Customer
|
|
29
23
|
# uint fields can be used in result ranking functions
|
30
24
|
uint :helpfulness, :returnable => true, :searchable => false do; 1234 end
|
31
25
|
end
|
26
|
+
|
27
|
+
# A named index.
|
28
|
+
index_in_cloudsearch :test_index do |idx|
|
29
|
+
literal :id, :searchable => true
|
30
|
+
end
|
32
31
|
end
|
33
32
|
```
|
34
33
|
### 2. Index some objects
|
@@ -82,6 +81,24 @@ Supported Options
|
|
82
81
|
* config.fatal_warnings - raises WarningInQueryResult exception on warning. Defaults to false.
|
83
82
|
* config.logger - a custom logger, defaults to Rails if defined.
|
84
83
|
|
84
|
+
### ActiveSupport Notifications
|
85
|
+
|
86
|
+
Requests to AWS cloudsearch are instrumented using [ActiveSupport Notifications](http://api.rubyonrails.org/classes/ActiveSupport/Notifications.html). To consume these instrumented events register a subscriber in your Application. For example, to register for getting notifications for search requests:
|
87
|
+
|
88
|
+
```ruby
|
89
|
+
ActiveSupport::Notifications.subscribe('cloudsearchable.execute_query') do |*args|
|
90
|
+
event = ActiveSupport::Notifications::Event.new(*args)
|
91
|
+
# Your code here ...
|
92
|
+
end
|
93
|
+
```
|
94
|
+
|
95
|
+
#### Instrumented events:
|
96
|
+
|
97
|
+
1. cloudsearchable.execute_query - Instruments search requests
|
98
|
+
2. cloudsearchable.post_record - Instruments record addition
|
99
|
+
3. cloudsearchable.delete_record - Instruments record deletion
|
100
|
+
4. cloudsearchable.describe_domains - Instruments request for getting domains information
|
101
|
+
|
85
102
|
### Other Features
|
86
103
|
|
87
104
|
Cloudsearchable provides access the underlying AWS client objects, such as '''CloudSearch.client''' and '''class.cloudsearch_domains'''. For example here is how to drop domains associated with Customer class:
|
@@ -97,9 +114,6 @@ Cloudsearchable provides access the underlying AWS client objects, such as '''Cl
|
|
97
114
|
|
98
115
|
See spec tests and source code for more information.
|
99
116
|
|
100
|
-
## TODO:
|
101
|
-
- use ActiveSupport instrumentation: http://edgeguides.rubyonrails.org/active_support_instrumentation.html#creating-custom-events
|
102
|
-
|
103
117
|
## Credits
|
104
118
|
|
105
119
|
* [Logan Bowers](https://github.com/loganb)
|
@@ -116,4 +130,4 @@ MIT License
|
|
116
130
|
3. Run the tests (`rake spec`)
|
117
131
|
4. Commit your changes (`git commit -am 'Add some feature'`)
|
118
132
|
5. Push to the branch (`git push origin my-new-feature`)
|
119
|
-
6. Create new Pull Request
|
133
|
+
6. Create new Pull Request
|
data/cloudsearchable.gemspec
CHANGED
data/lib/cloudsearchable.rb
CHANGED
@@ -76,19 +76,25 @@ module Cloudsearchable
|
|
76
76
|
|
77
77
|
# Add or replace the CloudSearch document for a particular version of a record
|
78
78
|
def post_record record, record_id, version
|
79
|
-
|
79
|
+
ActiveSupport::Notifications.instrument('cloudsearchable.post_record') do
|
80
|
+
CloudSearch.post_sdf doc_endpoint, addition_sdf(record, record_id, version)
|
81
|
+
end
|
80
82
|
end
|
81
83
|
|
82
84
|
# Delete the CloudSearch document for a particular record (version must be greater than the last version pushed)
|
83
85
|
def delete_record record_id, version
|
84
|
-
|
86
|
+
ActiveSupport::Notifications.instrument('cloudsearchable.delete_record') do
|
87
|
+
CloudSearch.post_sdf doc_endpoint, deletion_sdf(record_id, version)
|
88
|
+
end
|
85
89
|
end
|
86
90
|
|
87
91
|
def execute_query(params)
|
88
92
|
uri = URI("http://#{search_endpoint}/#{CloudSearch::API_VERSION}/search")
|
89
93
|
uri.query = URI.encode_www_form(params)
|
90
94
|
Cloudsearchable.logger.info "CloudSearch execute: #{uri.to_s}"
|
91
|
-
res =
|
95
|
+
res = ActiveSupport::Notifications.instrument('cloudsearchable.execute_query') do
|
96
|
+
Net::HTTP.get_response(uri).body
|
97
|
+
end
|
92
98
|
JSON.parse(res)
|
93
99
|
end
|
94
100
|
|
@@ -124,7 +130,9 @@ module Cloudsearchable
|
|
124
130
|
#
|
125
131
|
def cloudsearch_domain(force_reload = false)
|
126
132
|
if(force_reload || !@domain)
|
127
|
-
@domain =
|
133
|
+
@domain = ActiveSupport::Notifications.instrument('cloudsearchable.describe_domains') do
|
134
|
+
CloudSearch.client.describe_domains(:domain_names => [name])
|
135
|
+
end
|
128
136
|
else
|
129
137
|
@domain
|
130
138
|
end
|
@@ -36,6 +36,9 @@ module Cloudsearchable
|
|
36
36
|
#
|
37
37
|
# Collection.search.where(:customer_id, :==, 12345)
|
38
38
|
#
|
39
|
+
# The value you provide must be of the same type as the field. For text and literal
|
40
|
+
# values, provide a string value. For uint fields, provide a numeric value.
|
41
|
+
#
|
39
42
|
# To search for any of several possible values for a field, use the :any operator:
|
40
43
|
#
|
41
44
|
# Collection.search.where(:product_group, :any, %w{gl_kitchen gl_grocery})
|
@@ -52,26 +55,10 @@ module Cloudsearchable
|
|
52
55
|
where(k, :==, v)
|
53
56
|
end
|
54
57
|
elsif field_or_hash.is_a? Symbol
|
55
|
-
field = field_or_hash
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
"#{field}:'#{value.to_s}'"
|
60
|
-
elsif op == :any
|
61
|
-
'(or ' + value.map { |v| "#{field}:'#{v.to_s}'" }.join(' ') + ')'
|
62
|
-
elsif op == :!=
|
63
|
-
"(not #{field}:'#{value.to_s}')"
|
64
|
-
elsif op == :> && value.is_a?(Integer)
|
65
|
-
"#{field}:#{value+1}.."
|
66
|
-
elsif op == :< && value.is_a?(Integer)
|
67
|
-
"#{field}:..#{value-1}"
|
68
|
-
elsif op == :>= && value.is_a?(Integer)
|
69
|
-
"#{field}:#{value}.."
|
70
|
-
elsif op == :<= && value.is_a?(Integer)
|
71
|
-
"#{field}:..#{value}"
|
72
|
-
else
|
73
|
-
raise "op #{op} is unrecognized"
|
74
|
-
end
|
58
|
+
if (field = domain.fields[field_or_hash.to_sym]).nil?
|
59
|
+
raise "cannot query on field '#{field_or_hash}' because it is not a member of this index"
|
60
|
+
end
|
61
|
+
@clauses << clause_for(field_or_hash, field.type, op, value)
|
75
62
|
else
|
76
63
|
raise "field_or_hash must be a Hash or Symbol, not a #{field_or_hash.class}"
|
77
64
|
end
|
@@ -204,7 +191,7 @@ module Cloudsearchable
|
|
204
191
|
def to_q
|
205
192
|
raise NoClausesError, "no search terms were specified" if (@clauses.nil? || @clauses.empty?) && (@q.nil? || @q.empty?)
|
206
193
|
|
207
|
-
bq = (@clauses.count >
|
194
|
+
bq = (@clauses.count > 1) ? "(and #{@clauses.join(' ')})" : @clauses.first
|
208
195
|
{
|
209
196
|
q: @q,
|
210
197
|
bq: bq,
|
@@ -214,5 +201,55 @@ module Cloudsearchable
|
|
214
201
|
:'return-fields' => @fields.reduce("") { |s,f| s << f.to_s }
|
215
202
|
}
|
216
203
|
end
|
204
|
+
|
205
|
+
private
|
206
|
+
|
207
|
+
def clause_for(field, type, op, value)
|
208
|
+
# Operations for which 'value' is not a scalar
|
209
|
+
if op == :any
|
210
|
+
'(or ' + value.map { |v| "#{field}:#{query_clause_value(type, v)}" }.join(' ') + ')'
|
211
|
+
elsif op == :within_range && type == :uint
|
212
|
+
"#{field}:#{value.to_s}"
|
213
|
+
else
|
214
|
+
value = query_clause_value(type, value)
|
215
|
+
|
216
|
+
# Some operations are applicable to all types.
|
217
|
+
case op
|
218
|
+
when :==, :eq
|
219
|
+
"#{field}:#{value}"
|
220
|
+
when :!=
|
221
|
+
"(not #{field}:#{value})"
|
222
|
+
else
|
223
|
+
# Operation-specific, type-specific operations on scalars
|
224
|
+
case type
|
225
|
+
when :uint
|
226
|
+
case op
|
227
|
+
when :>
|
228
|
+
"#{field}:#{value+1}.."
|
229
|
+
when :<
|
230
|
+
"#{field}:..#{value-1}"
|
231
|
+
when :>=
|
232
|
+
"#{field}:#{value}.."
|
233
|
+
when :<=
|
234
|
+
"#{field}:..#{value}"
|
235
|
+
else
|
236
|
+
raise "op #{op} is unrecognized for value #{value} of type #{type}"
|
237
|
+
end
|
238
|
+
else
|
239
|
+
raise "op #{op} is unrecognized for value #{value} of type #{type}"
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
def query_clause_value(type, value)
|
246
|
+
if type == :uint
|
247
|
+
Integer(value)
|
248
|
+
elsif !value.nil?
|
249
|
+
"'#{value.to_s}'"
|
250
|
+
else
|
251
|
+
raise "Value #{value} cannot be converted to query string on type #{type}"
|
252
|
+
end
|
253
|
+
end
|
217
254
|
end
|
218
255
|
end
|
@@ -5,7 +5,7 @@ describe Cloudsearchable do
|
|
5
5
|
let(:clazz){ CloudSearchableSampleClassFactory.call }
|
6
6
|
|
7
7
|
it 'can describe an index that returns ids for the class type' do
|
8
|
-
test_index = clazz.cloudsearch_index
|
8
|
+
test_index = clazz.cloudsearch_index
|
9
9
|
test_index.should be_kind_of(Cloudsearchable::Domain)
|
10
10
|
test_index.fields.should have(4).items #3 explicit + 1 for the id of the object
|
11
11
|
end
|
@@ -33,7 +33,7 @@ describe Cloudsearchable do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'supplies the right values to the fields' do
|
36
|
-
test_index = clazz.cloudsearch_index
|
36
|
+
test_index = clazz.cloudsearch_index
|
37
37
|
test_index.fields[:test_class_id].value_for(inst).should be(inst.id)
|
38
38
|
test_index.fields[:customer_id].value_for(inst).should be(inst.customer)
|
39
39
|
test_index.fields[:test_name].value_for(inst).should be(inst.name)
|
@@ -47,7 +47,7 @@ describe Cloudsearchable do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'generates a sensible addition sdf document' do
|
50
|
-
sdf = clazz.cloudsearch_index
|
50
|
+
sdf = clazz.cloudsearch_index.send :addition_sdf, inst, inst.id, inst.lock_version
|
51
51
|
sdf[:fields][:helpfulness].should be(1234)
|
52
52
|
end
|
53
53
|
end
|
@@ -4,26 +4,6 @@ require 'test_classes/cloud_searchable_test_class'
|
|
4
4
|
describe Cloudsearchable::Query do
|
5
5
|
let(:clazz){ CloudSearchableSampleClassFactory.call }
|
6
6
|
|
7
|
-
it 'can build a simple search query' do
|
8
|
-
clazz.search.where(:customer_id, :eq, 12345).query.to_q[:bq].should =~ /customer_id:'12345'/
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'chains' do
|
12
|
-
query = clazz.search.where(customer_id: 12345).where(helpfulness: 42).query.to_q[:bq]
|
13
|
-
query.should =~ /customer_id:'12345'/
|
14
|
-
query.should =~ /helpfulness:'42'/
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'can build a query with "not equal to" condition' do
|
18
|
-
query = clazz.search.where(:customer_id, :!=, 1234).query.to_q[:bq].should =~ /\(not customer_id:'1234'\)/
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'can build a query from a hash' do
|
22
|
-
query = clazz.search.where(customer_id: 12345, helpfulness: 42).query.to_q[:bq]
|
23
|
-
query.should =~ /customer_id:'12345'/
|
24
|
-
query.should =~ /helpfulness:'42'/
|
25
|
-
end
|
26
|
-
|
27
7
|
it "doesn't build queries without a query term" do
|
28
8
|
expect do
|
29
9
|
query = clazz.search.limit(10).query.to_q
|
@@ -31,40 +11,100 @@ describe Cloudsearchable::Query do
|
|
31
11
|
end
|
32
12
|
|
33
13
|
describe '#where' do
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
clazz.search.where(:helpfulness, :within_range, "0..#{123}").query.to_q[:bq].should =~ /helpfulness:0..123/
|
38
|
-
end
|
14
|
+
it 'can build a simple search query' do
|
15
|
+
clazz.search.where(:customer_id, :eq, 'A1234').query.to_q[:bq].should =~ /customer_id:'A1234'/
|
16
|
+
end
|
39
17
|
|
40
|
-
|
41
|
-
|
42
|
-
|
18
|
+
it 'rejects field names that were not defined in the index' do
|
19
|
+
expect { clazz.search.where(:mispeled_field, :eq, 12345) }.to raise_exception
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'chains' do
|
23
|
+
query = clazz.search.where(customer_id: 'A1234').where(helpfulness: 42).query.to_q[:bq]
|
24
|
+
query.should =~ /customer_id:'A1234'/
|
25
|
+
query.should =~ /helpfulness:42/
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'can build a query with "not equal to" condition' do
|
29
|
+
query = clazz.search.where(:customer_id, :!=, 'A1234').query.to_q[:bq].should =~ /\(not customer_id:'A1234'\)/
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'can build a query from a hash' do
|
33
|
+
query = clazz.search.where(customer_id: 'A1234', helpfulness: 42).query.to_q[:bq]
|
34
|
+
query.should =~ /customer_id:'A1234'/
|
35
|
+
query.should =~ /helpfulness:42/
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'literal data type' do
|
39
|
+
it 'supports equality' do
|
40
|
+
clazz.search.where(:customer_id, :==, 'ABC').query.to_q[:bq].should eq "customer_id:'ABC'"
|
43
41
|
end
|
44
42
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
end
|
43
|
+
it 'supports :any' do
|
44
|
+
clazz.search.where(:customer_id, :any, ['ABC', 'DEF']).query.to_q[:bq].should eq "(or customer_id:'ABC' customer_id:'DEF')"
|
45
|
+
end
|
49
46
|
|
50
|
-
|
51
|
-
|
52
|
-
|
47
|
+
it 'accepts a value as an integer' do
|
48
|
+
clazz.search.where(customer_id: 123).query.to_q[:bq].should =~ /customer_id:'123'/
|
49
|
+
end
|
53
50
|
|
54
|
-
|
55
|
-
|
56
|
-
|
51
|
+
it 'rejects nil value' do
|
52
|
+
expect { clazz.search.where(customer_id: nil) }.to raise_exception
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context 'uint data type' do
|
57
|
+
it 'supports range query' do
|
58
|
+
clazz.search.where(:helpfulness, :within_range, "0..#{123}").query.to_q[:bq].should =~ /helpfulness:0..123/
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'supports range query using a ruby range' do
|
62
|
+
clazz.search.where(:helpfulness, :within_range, 0..123).query.to_q[:bq].should =~ /helpfulness:0..123/
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'supports equality' do
|
66
|
+
clazz.search.where(:helpfulness, :==, 123).query.to_q[:bq].should eq 'helpfulness:123'
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'supports not-equality' do
|
70
|
+
clazz.search.where(:helpfulness, :!=, 123).query.to_q[:bq].should eq '(not helpfulness:123)'
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'supports greater-than' do
|
74
|
+
clazz.search.where(:helpfulness, :>, 123).query.to_q[:bq].should =~ /helpfulness:124../
|
75
|
+
end
|
57
76
|
|
58
|
-
|
59
|
-
|
77
|
+
it 'supports greater-than-or-equal-to' do
|
78
|
+
clazz.search.where(:helpfulness, :>=, 123).query.to_q[:bq].should =~ /helpfulness:123../
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'supports less-than' do
|
82
|
+
clazz.search.where(:helpfulness, :<, 123).query.to_q[:bq].should =~ /helpfulness:..122/
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'supports less-than-or-equal-to' do
|
86
|
+
clazz.search.where(:helpfulness, :<=, 123).query.to_q[:bq].should =~ /helpfulness:..123/
|
87
|
+
end
|
88
|
+
|
89
|
+
it 'supports :any' do
|
90
|
+
clazz.search.where(:helpfulness, :any, [123, 456]).query.to_q[:bq].should eq '(or helpfulness:123 helpfulness:456)'
|
91
|
+
end
|
92
|
+
|
93
|
+
it 'accepts a value as a string' do
|
94
|
+
clazz.search.where(helpfulness: '123').query.to_q[:bq].should =~ /helpfulness:123/
|
95
|
+
end
|
96
|
+
|
97
|
+
[Object.new, nil, '123a'].each do |v|
|
98
|
+
it "rejects value #{v} of type #{v.class}" do
|
99
|
+
expect { clazz.search.where(helpfulness: v) }.to raise_exception
|
60
100
|
end
|
101
|
+
end
|
102
|
+
end
|
61
103
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
end
|
67
|
-
end
|
104
|
+
[:>, :>=, :<, :<=].each do |op|
|
105
|
+
[Object.new, nil, '123a'].each do |v|
|
106
|
+
it "does not permit op #{op} on value #{v} of type #{v.class}" do
|
107
|
+
expect { clazz.search.where(:helpfulness, op, v).query.to_q[:bq] }.to raise_error
|
68
108
|
end
|
69
109
|
end
|
70
110
|
end
|
@@ -72,7 +112,7 @@ describe Cloudsearchable::Query do
|
|
72
112
|
|
73
113
|
|
74
114
|
it 'supports querying for any of several values of a field' do
|
75
|
-
clazz.search.where(:
|
115
|
+
clazz.search.where(:test_name, :any, %w{big small}).query.to_q[:bq].should include("(or test_name:'big' test_name:'small')")
|
76
116
|
end
|
77
117
|
|
78
118
|
it 'supports text method' do
|
@@ -81,9 +121,9 @@ describe Cloudsearchable::Query do
|
|
81
121
|
end
|
82
122
|
|
83
123
|
it 'supports chaining text and where clauses together' do
|
84
|
-
query = clazz.search.text('test').where(:
|
124
|
+
query = clazz.search.text('test').where(:helpfulness, :==, 123).query
|
85
125
|
query.to_q[:q].should =~ /test/
|
86
|
-
query.to_q[:bq].should =~ /
|
126
|
+
query.to_q[:bq].should =~ /helpfulness:123/
|
87
127
|
end
|
88
128
|
|
89
129
|
it 'supports ordering with a rank expression' do
|
@@ -123,16 +163,16 @@ describe Cloudsearchable::Query do
|
|
123
163
|
"found" => 285,
|
124
164
|
"start" => 0,
|
125
165
|
"hit" => [
|
126
|
-
{"id" => "40bdd5072b6dbae6245fe4ee837d22e3","data" => {"
|
127
|
-
{"id" => "00af8f5f96aa1db7aff77be5651b3bb1","data" => {"
|
128
|
-
{"id" => "00b6ac84e3ae402e7698959bf692a53e","data" => {"
|
129
|
-
{"id" => "018fdee653bff74abd12ac30152a2837","data" => {"
|
130
|
-
{"id" => "01d062d24c389906eea2d16b8193eb56","data" => {"
|
131
|
-
{"id" => "01e3ee5d848a30385a4e90eb851b094d","data" => {"
|
132
|
-
{"id" => "01fca44cc596adb295ca6ee9f9f36499","data" => {"
|
133
|
-
{"id" => "02b85c9835b5045065ee389954a60c5f","data" => {"
|
134
|
-
{"id" => "040c01be434552a1d9e99eef9db87bdd","data" => {"
|
135
|
-
{"id" => "048567c755e30d6d64d757508f1feaa0","data" => {"
|
166
|
+
{"id" => "40bdd5072b6dbae6245fe4ee837d22e3","data" => {"test_class_id" => ["PCxSz65GIcZTtc0UpRdT-i--w-1365550370"]}},
|
167
|
+
{"id" => "00af8f5f96aa1db7aff77be5651b3bb1","data" => {"test_class_id" => ["PCxhksJTLRYnoGXvwZik82Fkw-1365020313"]}},
|
168
|
+
{"id" => "00b6ac84e3ae402e7698959bf692a53e","data" => {"test_class_id" => ["PCxs-fIVZnBcTzZ4MtfDguS1A-1365020274"]}},
|
169
|
+
{"id" => "018fdee653bff74abd12ac30152a2837","data" => {"test_class_id" => ["PCxmAGHFtAgyqUrgI3HgM_P6Q-1365548349"]}},
|
170
|
+
{"id" => "01d062d24c389906eea2d16b8193eb56","data" => {"test_class_id" => ["PCxqjaTmwydKM82NqymbryNfg-1365470479"]}},
|
171
|
+
{"id" => "01e3ee5d848a30385a4e90eb851b094d","data" => {"test_class_id" => ["PCxSz65GIcZTtc0UpRdT-i--w-1365550369"]}},
|
172
|
+
{"id" => "01fca44cc596adb295ca6ee9f9f36499","data" => {"test_class_id" => ["PCx7XKbKwOVf1VvEWvTl5c1Eg-1365020176"]}},
|
173
|
+
{"id" => "02b85c9835b5045065ee389954a60c5f","data" => {"test_class_id" => ["PCxp_xid_WeTfTmb5MySEfxhQ-1365115565"]}},
|
174
|
+
{"id" => "040c01be434552a1d9e99eef9db87bdd","data" => {"test_class_id" => ["PCxLOYzA4bCt7-bP6wsZnl-ow-1365020297"]}},
|
175
|
+
{"id" => "048567c755e30d6d64d757508f1feaa0","data" => {"test_class_id" => ["PCxJhhnpYkeSKrOxteQo5Jckw-1365115667"]}}
|
136
176
|
]
|
137
177
|
},
|
138
178
|
"info" => {
|
@@ -161,7 +201,7 @@ describe Cloudsearchable::Query do
|
|
161
201
|
|
162
202
|
q = query
|
163
203
|
q.query.instance_variable_set(:@fatal_warnings, false)
|
164
|
-
lambda{ q.to_a }.should_not raise_error
|
204
|
+
lambda{ q.to_a }.should_not raise_error
|
165
205
|
end
|
166
206
|
end
|
167
207
|
|
@@ -24,11 +24,6 @@ CloudSearchableSampleClassFactory = Proc.new do
|
|
24
24
|
|
25
25
|
# This is the default index. You probably only need one.
|
26
26
|
index_in_cloudsearch do |idx|
|
27
|
-
literal :id, :searchable => true
|
28
|
-
end
|
29
|
-
|
30
|
-
# A named index.
|
31
|
-
index_in_cloudsearch :test_index do |idx|
|
32
27
|
# Fetch the customer_id field from customer
|
33
28
|
literal :customer_id, :returnable => true, :searchable => true, :source => Proc.new { customer }
|
34
29
|
|
@@ -38,5 +33,10 @@ CloudSearchableSampleClassFactory = Proc.new do
|
|
38
33
|
# uint fields can be used in result ranking functions
|
39
34
|
uint :helpfulness, :returnable => true, :searchable => false do; 1234 end
|
40
35
|
end
|
36
|
+
|
37
|
+
# A named index.
|
38
|
+
index_in_cloudsearch :test_index do |idx|
|
39
|
+
literal :id, :searchable => true
|
40
|
+
end
|
41
41
|
end
|
42
42
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudsearchable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
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: 2013-
|
12
|
+
date: 2013-10-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -43,6 +43,22 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: yard
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
46
62
|
- !ruby/object:Gem::Dependency
|
47
63
|
name: aws-sdk
|
48
64
|
requirement: !ruby/object:Gem::Requirement
|