stretcher 1.20.2 → 1.21.0.beta1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c44afba5a8d36239ef651adde9db165608da1e64
4
- data.tar.gz: 3ee97e2ebb82e903e98ac6915c7ece8c08f71ff9
3
+ metadata.gz: 0bd29c29360c6f877954a21a4e2dc59d9e54ffaf
4
+ data.tar.gz: 9483c1bdd153901d0da9992c5c5717760d939b3f
5
5
  SHA512:
6
- metadata.gz: c8c459b43fd4cd97e170c7077edef8f4559fc569357a15ba04dc53317aa325f9d87429d476b6b5ced51e1c42decd6049d250d9892ccbbd74932c967079afa939
7
- data.tar.gz: cc7ae1aedfe7d88eb0f81a973e8588b5e4313125ac32b8c2e01869351a72b21ffc04b7f35db5dd00b86dc0261ee47605afcd3f66d28a5597b370be30410d9b06
6
+ metadata.gz: 2440f80c955244239e3b4ad08bd0827c0f98c69ad694e5f9b7b885118b1ca209275b252ad0b2615725282661f3b1ac9ed30f6ab926fc224244b289ddc83438f0
7
+ data.tar.gz: ce5a0ece0c91eac96c0a9b66d9ec4ae7fd903870485494e7e0b0e21de1fcf6c54841edeba0c7c0cd444dda218459550a4e568813ccebcd19d62a7cdd6f4beca4
@@ -192,7 +192,14 @@ module Stretcher
192
192
  def bulk(data, options={})
193
193
  request(:post, "_bulk", options, data)
194
194
  end
195
-
195
+
196
+ # Takes the name, text, and completion options to craft a completion query.
197
+ # suggest("band_complete", "a", field: :suggest)
198
+ # Use the new completion suggest API per http://www.elasticsearch.org/guide/reference/api/search/completion-suggest/
199
+ def suggest(name, text, completion={})
200
+ request(:post, "_suggest", {name => {:text => text, :completion => completion}})
201
+ end
202
+
196
203
  # Full path to this index
197
204
  def path_uri(path="/")
198
205
  p = @server.path_uri("/#{name}")
@@ -1,3 +1,3 @@
1
1
  module Stretcher
2
- VERSION = "1.20.2"
2
+ VERSION = "1.21.0.beta1"
3
3
  end
@@ -120,32 +120,45 @@ describe Stretcher::Index do
120
120
  index.refresh
121
121
  res = index.mget(docs_meta).length.should == 0
122
122
  end
123
- end
123
+
124
+ it 'allows _routing to be set on bulk index documents' do
125
+ server.index(:with_routing).delete if server.index(:with_routing).exists?
126
+ server.index(:with_routing).create({
127
+ :settings => {
128
+ :number_of_shards => 1,
129
+ :number_of_replicas => 0
130
+ },
131
+ :mappings => {
132
+ :_default_ => {
133
+ :_routing => { :required => true }
134
+ }
135
+ }
136
+ })
137
+
138
+ lambda {server.index(:with_routing).bulk_index(corpus)}.should raise_exception
139
+ routed_corpus = corpus.map do |doc|
140
+ routed_doc = doc.clone
141
+ routed_doc['_routing'] = 'abc'
142
+ routed_doc
143
+ end
124
144
 
125
- it 'allows _routing to be set on bulk index documents' do
126
- server.index(:with_routing).delete if server.index(:with_routing).exists?
127
- server.index(:with_routing).create({
128
- :settings => {
129
- :number_of_shards => 1,
130
- :number_of_replicas => 0
131
- },
132
- :mappings => {
133
- :_default_ => {
134
- :_routing => { :required => true }
135
- }
136
- }
137
- })
145
+ server.index(:with_routing).bulk_index(routed_corpus)
138
146
 
139
- lambda {server.index(:with_routing).bulk_index(corpus)}.should raise_exception
140
- routed_corpus = corpus.map do |doc|
141
- routed_doc = doc.clone
142
- routed_doc['_routing'] = 'abc'
143
- routed_doc
147
+ server.index(:with_routing).delete
144
148
  end
149
+ end
145
150
 
146
- server.index(:with_routing).bulk_index(routed_corpus)
147
-
148
- server.index(:with_routing).delete
151
+ describe "suggestion" do
152
+ it "should correctly format the suggest request" do
153
+ expected = {
154
+ "sug-alias" => {
155
+ :text => "prefix",
156
+ :completion => {:field => "sug-field"}}}
157
+ index.
158
+ should_receive(:request).
159
+ with(:post, "_suggest", expected).once.and_return(:result)
160
+ index.suggest("sug-alias", "prefix", field: "sug-field").should == :result
161
+ end
149
162
  end
150
163
 
151
164
  it "should delete by query" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stretcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.20.2
4
+ version: 1.21.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Cholakian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-25 00:00:00.000000000 Z
11
+ date: 2013-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -213,9 +213,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
213
213
  version: '0'
214
214
  required_rubygems_version: !ruby/object:Gem::Requirement
215
215
  requirements:
216
- - - '>='
216
+ - - '>'
217
217
  - !ruby/object:Gem::Version
218
- version: '0'
218
+ version: 1.3.1
219
219
  requirements: []
220
220
  rubyforge_project:
221
221
  rubygems_version: 2.0.2