search-kit 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,7 +14,7 @@ module SearchKit
14
14
  end
15
15
 
16
16
  def messages
17
- @messages ||= Messages.new
17
+ @messages ||= SearchKit::Messages.new
18
18
  end
19
19
  end
20
20
 
@@ -14,7 +14,7 @@ module SearchKit
14
14
  end
15
15
 
16
16
  def messages
17
- @messages ||= Messages.new
17
+ @messages ||= SearchKit::Messages.new
18
18
  end
19
19
  end
20
20
 
@@ -10,11 +10,11 @@ module SearchKit
10
10
 
11
11
  no_commands do
12
12
  def client
13
- @client ||= Search.new
13
+ @client ||= SearchKit::Clients::Search.new
14
14
  end
15
15
 
16
16
  def messages
17
- @messages ||= Messages.new
17
+ @messages ||= SearchKit::Messages.new
18
18
  end
19
19
  end
20
20
 
@@ -38,7 +38,7 @@ module SearchKit
38
38
  end
39
39
  end
40
40
 
41
- lines.each(&messages.method(:info))
41
+ lines.each { |line| messages.info(line) }
42
42
  rescue Errors::Unauthorized
43
43
  messages.unauthorized
44
44
  rescue Errors::IndexNotFound
@@ -14,7 +14,7 @@ module SearchKit
14
14
  end
15
15
 
16
16
  def messages
17
- @messages ||= Messages.new
17
+ @messages ||= SearchKit::Messages.new
18
18
  end
19
19
  end
20
20
 
@@ -10,12 +10,10 @@ module SearchKit
10
10
  attribute :score
11
11
 
12
12
  def initialize(document_data = {})
13
- attributes = document_data.fetch(:attributes, {})
14
-
15
13
  super(
16
- source: attributes,
17
- id: attributes.fetch(:id, nil),
18
- score: attributes.fetch(:score, nil)
14
+ source: document_data.fetch(:source, {}),
15
+ id: document_data.fetch(:id, nil),
16
+ score: document_data.fetch(:score, nil)
19
17
  )
20
18
  end
21
19
 
@@ -12,7 +12,7 @@ module SearchKit
12
12
  module VERSION
13
13
  MAJOR = 0
14
14
  MINOR = 0
15
- TINY = 6
15
+ TINY = 7
16
16
  PRE = nil
17
17
 
18
18
  STRING = [ MAJOR, MINOR, TINY, PRE ].compact.join(".")
@@ -9,3 +9,45 @@ I, [2015-11-30T12:44:12.543484 #93023] INFO -- :
9
9
  I, [2015-11-30T12:44:20.067541 #93023] INFO -- : Set app_token: 0c72ddb87e73b5d5bf895065117065a1
10
10
  I, [2015-11-30T12:44:20.067684 #93023] INFO -- : Alright! Your search-kit install has been set up.
11
11
  I, [2015-11-30T12:50:25.446874 #93385] INFO -- : {}
12
+ I, [2015-11-30T13:14:31.722347 #93975] INFO -- : "Searching `videos` for titles matching `burri`:"
13
+
14
+ I, [2015-11-30T13:14:31.722639 #93975] INFO -- : " - Found %{search.results} titles in %{search.time}ms"
15
+
16
+ I, [2015-11-30T13:14:31.722700 #93975] INFO -- : -- | score:
17
+ I, [2015-11-30T13:40:46.204993 #94572] INFO -- : Setting up a new SearchKit account
18
+ I, [2015-11-30T13:40:46.205362 #94572] INFO -- :
19
+ I, [2015-11-30T13:40:51.274297 #94572] INFO -- : Set app_token: 562555ba596bfb8df5b5b7ea718d15e0
20
+ I, [2015-11-30T13:40:51.274423 #94572] INFO -- : Alright! Your search-kit install has been set up.
21
+ I, [2015-11-30T13:41:17.316686 #94604] INFO -- : {}
22
+ I, [2015-11-30T13:41:25.861851 #94629] INFO -- : "Searching `videos` for titles matching `burrito`:"
23
+
24
+ I, [2015-11-30T13:41:25.861968 #94629] INFO -- : " - Found %{search.results} titles in %{search.time}ms"
25
+
26
+ I, [2015-11-30T13:41:25.862032 #94629] INFO -- : -- | score:
27
+ I, [2015-11-30T13:42:05.164464 #94658] INFO -- : Searching `videos` for titles matching `burrito`:
28
+ I, [2015-11-30T13:42:05.164854 #94658] INFO -- : - Found %{search.results} titles in %{search.time}ms
29
+ I, [2015-11-30T13:42:05.164913 #94658] INFO -- : -- | score:
30
+ I, [2015-11-30T13:43:01.005288 #94687] INFO -- : Searching `videos` for titles matching `burrito`:
31
+ I, [2015-11-30T13:43:01.005673 #94687] INFO -- : - Found %{search.results} titles in %{search.time}ms
32
+ I, [2015-11-30T13:43:01.005738 #94687] INFO -- : -- | score:
33
+ I, [2015-11-30T13:43:29.839746 #94716] INFO -- : Searching `videos` for titles matching `burrito`:
34
+ I, [2015-11-30T13:43:29.840344 #94716] INFO -- : - Found %{search.results} titles in %{search.time}ms
35
+ I, [2015-11-30T13:43:29.840564 #94716] INFO -- : -- | score:
36
+ I, [2015-11-30T13:44:53.682104 #94805] INFO -- : Searching `videos` for titles matching `burrito`:
37
+ I, [2015-11-30T13:44:53.682824 #94805] INFO -- : - Found %{search.results} titles in %{search.time}ms
38
+ I, [2015-11-30T13:44:53.683036 #94805] INFO -- : -- 1 | score: 0.8637942
39
+ I, [2015-11-30T13:45:22.525705 #94833] INFO -- : Searching `videos` for titles matching `burrito`:
40
+ I, [2015-11-30T13:45:22.525820 #94833] INFO -- : - Found 1 titles in 4ms
41
+ I, [2015-11-30T13:45:22.525883 #94833] INFO -- : -- 1 | score: 0.8637942
42
+ I, [2015-11-30T13:45:52.580542 #94910] INFO -- : Searching `videos` for titles matching `burrito`:
43
+ I, [2015-11-30T13:45:52.580673 #94910] INFO -- : - Found 1 titles in 8ms
44
+ I, [2015-11-30T13:45:52.580728 #94910] INFO -- : -- Burrito | score: 0.8637942
45
+ I, [2015-11-30T13:46:00.825985 #94936] INFO -- : Searching `videos` for titles matching `Burrito`:
46
+ I, [2015-11-30T13:46:00.826089 #94936] INFO -- : - Found 1 titles in 9ms
47
+ I, [2015-11-30T13:46:00.826145 #94936] INFO -- : -- Burrito | score: 0.39854166
48
+ I, [2015-11-30T13:46:07.510553 #94961] INFO -- : Searching `videos` for titles matching `Bur`:
49
+ I, [2015-11-30T13:46:07.510673 #94961] INFO -- : - Found 1 titles in 2ms
50
+ I, [2015-11-30T13:46:07.510739 #94961] INFO -- : -- Burrito | score: 0.13215704
51
+ I, [2015-11-30T13:46:11.740365 #94986] INFO -- : Searching `videos` for titles matching `burrito`:
52
+ I, [2015-11-30T13:46:11.740465 #94986] INFO -- : - Found 1 titles in 9ms
53
+ I, [2015-11-30T13:46:11.740546 #94986] INFO -- : -- Burrito | score: 0.8637942
@@ -0,0 +1,74 @@
1
+ # Logfile created on 2015-11-30 13:35:33 -0600 by logger.rb/47272
2
+ I, [2015-11-30T13:35:33.757050 #94368] INFO -- : {}
3
+ I, [2015-11-30T13:35:33.765156 #94368] INFO -- : {}
4
+ I, [2015-11-30T13:35:33.771959 #94368] INFO -- : {}
5
+ I, [2015-11-30T13:35:33.775924 #94368] INFO -- : {}
6
+ I, [2015-11-30T13:35:33.784072 #94368] INFO -- : {}
7
+ I, [2015-11-30T13:35:33.785258 #94368] INFO -- : {}
8
+ I, [2015-11-30T13:35:33.791445 #94368] INFO -- : Event 1 completed
9
+ I, [2015-11-30T13:35:33.796590 #94368] INFO -- : No pending events found for channel `colon:separated:values`
10
+ I, [2015-11-30T13:35:33.797384 #94368] INFO -- : No pending events found
11
+ I, [2015-11-30T13:35:33.801793 #94368] INFO -- : Event published, check status with this command:
12
+
13
+ search-kit events status
14
+
15
+ Or look at use this command to to see this event and all neighboring events:
16
+
17
+ search-kit events pending colon:separated:values
18
+
19
+ I, [2015-11-30T13:35:33.802531 #94368] INFO -- : Event published, check status with this command:
20
+
21
+ search-kit events status
22
+
23
+ Or look at use this command to to see this event and all neighboring events:
24
+
25
+ search-kit events pending colon:separated:values
26
+
27
+ I, [2015-11-30T13:35:33.808096 #94368] INFO -- : Event 1 status:
28
+ I, [2015-11-30T13:35:33.811421 #94368] INFO -- : {}
29
+ I, [2015-11-30T13:35:33.815325 #94368] INFO -- : {}
30
+ I, [2015-11-30T13:35:33.833877 #94368] INFO -- : {}
31
+ I, [2015-11-30T13:35:33.838317 #94368] INFO -- : {}
32
+ I, [2015-11-30T13:35:33.845929 #94368] INFO -- : "Searching `an-index-slug` for titles matching `Michael Jackson`:"
33
+
34
+ I, [2015-11-30T13:35:33.845992 #94368] INFO -- : " - Found %{search.results} titles in %{search.time}ms"
35
+
36
+ I, [2015-11-30T13:35:33.852173 #94368] INFO -- : "#<SearchKit::Models::Subscriber:0x007fae3a7e4d80>"
37
+ I, [2015-11-30T13:35:33.855986 #94368] INFO -- : "#<SearchKit::Models::Subscriber:0x007fae3b432600>"
38
+ I, [2015-11-30T13:36:48.767734 #94400] INFO -- : {}
39
+ I, [2015-11-30T13:36:48.769078 #94400] INFO -- : {}
40
+ I, [2015-11-30T13:36:48.775567 #94400] INFO -- : {}
41
+ I, [2015-11-30T13:36:48.778330 #94400] INFO -- : {}
42
+ I, [2015-11-30T13:36:48.791352 #94400] INFO -- : {}
43
+ I, [2015-11-30T13:36:48.792686 #94400] INFO -- : {}
44
+ I, [2015-11-30T13:36:48.799821 #94400] INFO -- : Event 1 completed
45
+ I, [2015-11-30T13:36:48.804617 #94400] INFO -- : No pending events found for channel `colon:separated:values`
46
+ I, [2015-11-30T13:36:48.805380 #94400] INFO -- : No pending events found
47
+ I, [2015-11-30T13:36:48.809836 #94400] INFO -- : Event published, check status with this command:
48
+
49
+ search-kit events status
50
+
51
+ Or look at use this command to to see this event and all neighboring events:
52
+
53
+ search-kit events pending colon:separated:values
54
+
55
+ I, [2015-11-30T13:36:48.810562 #94400] INFO -- : Event published, check status with this command:
56
+
57
+ search-kit events status
58
+
59
+ Or look at use this command to to see this event and all neighboring events:
60
+
61
+ search-kit events pending colon:separated:values
62
+
63
+ I, [2015-11-30T13:36:48.816103 #94400] INFO -- : Event 1 status:
64
+ I, [2015-11-30T13:36:48.819127 #94400] INFO -- : {}
65
+ I, [2015-11-30T13:36:48.822551 #94400] INFO -- : {}
66
+ I, [2015-11-30T13:36:48.826241 #94400] INFO -- : {}
67
+ I, [2015-11-30T13:36:48.829982 #94400] INFO -- : {}
68
+ I, [2015-11-30T13:36:48.837899 #94400] INFO -- : {}
69
+ I, [2015-11-30T13:36:48.848678 #94400] INFO -- : "Searching `an-index-slug` for titles matching `Michael Jackson`:"
70
+
71
+ I, [2015-11-30T13:36:48.848745 #94400] INFO -- : " - Found %{search.results} titles in %{search.time}ms"
72
+
73
+ I, [2015-11-30T13:36:48.854482 #94400] INFO -- : "#<SearchKit::Models::Subscriber:0x007fb95a4c63d0>"
74
+ I, [2015-11-30T13:36:48.858466 #94400] INFO -- : "#<SearchKit::Models::Subscriber:0x007fb9599d1858>"
Binary file
@@ -104,66 +104,6 @@ describe SearchKit::CLI::Indices do
104
104
  end
105
105
  end
106
106
 
107
- describe '#scaffold' do
108
- let(:documents) { [{ title: "Yep", id: 1 }] }
109
- let(:documents_json) { documents.to_json }
110
- let(:name) { "Index Name" }
111
-
112
- before { allow(cli.client).to receive(:scaffold).and_return(response) }
113
-
114
- subject { cli.scaffold(name, documents_json) }
115
-
116
- it "calls client.create with the index name" do
117
- expect(cli.client).to receive(:scaffold).with(name, documents)
118
- subject
119
- end
120
-
121
- it "reports on its results" do
122
- expect(cli.messages).to receive(:info).with(an_instance_of(String))
123
- subject
124
- end
125
-
126
- context 'error handling' do
127
- before { allow(cli.client).to receive(:scaffold).and_raise(*error) }
128
-
129
- context 'unauthorized error' do
130
- let(:error) { SearchKit::Errors::Unauthorized }
131
-
132
- it do
133
- expect(cli.messages).to receive(:unauthorized)
134
- subject
135
- end
136
- end
137
-
138
- context 'unprocessable error' do
139
- let(:error) { SearchKit::Errors::Unprocessable }
140
-
141
- it do
142
- expect(cli.messages).to receive(:unprocessable)
143
- subject
144
- end
145
- end
146
-
147
- context 'json error' do
148
- let(:error) { JSON::ParserError }
149
-
150
- it do
151
- expect(cli.messages).to receive(:json_parse_error)
152
- subject
153
- end
154
- end
155
-
156
- context 'no service error' do
157
- let(:error) { [Faraday::ConnectionFailed, "Message"] }
158
-
159
- it do
160
- expect(cli.messages).to receive(:no_service)
161
- subject
162
- end
163
- end
164
- end
165
- end
166
-
167
107
  describe '#show' do
168
108
  before { allow(cli.client).to receive(:show).and_return(response) }
169
109
 
@@ -0,0 +1,70 @@
1
+ require 'spec_helper'
2
+
3
+ describe SearchKit::CLI::Scaffolds do
4
+ let(:cli) { described_class.new }
5
+ let(:json) { response.to_json }
6
+ let(:response) { {} }
7
+ let(:slug) { "an-index-slug" }
8
+
9
+ subject { cli }
10
+
11
+ describe '#create' do
12
+ let(:documents) { [{ title: "Yep", id: 1 }] }
13
+ let(:documents_json) { documents.to_json }
14
+ let(:name) { "Index Name" }
15
+
16
+ before { allow(cli.client).to receive(:create).and_return(response) }
17
+
18
+ subject { cli.create(name, documents_json) }
19
+
20
+ it "calls client.create with the index name" do
21
+ expect(cli.client).to receive(:create).with(name, documents)
22
+ subject
23
+ end
24
+
25
+ it "reports on its results" do
26
+ expect(cli.messages).to receive(:info).with(an_instance_of(String))
27
+ subject
28
+ end
29
+
30
+ context 'error handling' do
31
+ before { allow(cli.client).to receive(:create).and_raise(*error) }
32
+
33
+ context 'unauthorized error' do
34
+ let(:error) { SearchKit::Errors::Unauthorized }
35
+
36
+ it do
37
+ expect(cli.messages).to receive(:unauthorized)
38
+ subject
39
+ end
40
+ end
41
+
42
+ context 'unprocessable error' do
43
+ let(:error) { SearchKit::Errors::Unprocessable }
44
+
45
+ it do
46
+ expect(cli.messages).to receive(:unprocessable)
47
+ subject
48
+ end
49
+ end
50
+
51
+ context 'json error' do
52
+ let(:error) { JSON::ParserError }
53
+
54
+ it do
55
+ expect(cli.messages).to receive(:json_parse_error)
56
+ subject
57
+ end
58
+ end
59
+
60
+ context 'no service error' do
61
+ let(:error) { [Faraday::ConnectionFailed, "Message"] }
62
+
63
+ it do
64
+ expect(cli.messages).to receive(:no_service)
65
+ subject
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: search-kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joseph McCormick
@@ -286,17 +286,20 @@ files:
286
286
  - lib/search_kit/thor.rb
287
287
  - lib/search_kit/version.rb
288
288
  - log/search-kit-development.log
289
+ - log/search-kit-test.log
289
290
  - log/service-layer-development.log
290
291
  - log/service-layer-test.log
291
292
  - pkg/search-kit-0.0.3.gem
292
293
  - pkg/search-kit-0.0.4.gem
293
294
  - pkg/search-kit-0.0.5.gem
295
+ - pkg/search-kit-0.0.6.gem
294
296
  - scripts/console
295
297
  - search-kit.gemspec
296
298
  - spec/integrations/subscriber_model_spec.rb
297
299
  - spec/search_kit/cli/documents_spec.rb
298
300
  - spec/search_kit/cli/events_spec.rb
299
301
  - spec/search_kit/cli/indices_spec.rb
302
+ - spec/search_kit/cli/scaffolds_spec.rb
300
303
  - spec/search_kit/cli/search_spec.rb
301
304
  - spec/search_kit/cli/subscribers_spec.rb
302
305
  - spec/search_kit/clients/documents_spec.rb
@@ -351,6 +354,7 @@ test_files:
351
354
  - spec/search_kit/cli/documents_spec.rb
352
355
  - spec/search_kit/cli/events_spec.rb
353
356
  - spec/search_kit/cli/indices_spec.rb
357
+ - spec/search_kit/cli/scaffolds_spec.rb
354
358
  - spec/search_kit/cli/search_spec.rb
355
359
  - spec/search_kit/cli/subscribers_spec.rb
356
360
  - spec/search_kit/clients/documents_spec.rb