csdn-tire 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  module Tire
2
3
  class ClickLog
3
4
  include Utils
@@ -8,7 +8,7 @@ module Tire
8
8
  end
9
9
 
10
10
  def self.url(value=nil)
11
- @url = (value ? value.to_s.gsub(%r|/*$|, '') : nil) || @url || ENV['ELASTICSEARCH_URL'] || "http://localhost:9200"
11
+ @url = (value ? value.to_s.gsub(%r|/*$|, '') : nil) || @url || ENV['CSDNSEARCH_URL'] || "http://localhost:9200"
12
12
  end
13
13
 
14
14
  def self.client(klass=nil)
data/lib/tire/count.rb CHANGED
@@ -14,6 +14,9 @@ module Tire
14
14
  end
15
15
 
16
16
  @path = ['/', @indices.join(','), @types.join(','), '_count'].compact.join('/').squeeze('/')
17
+ if indices == 'blog'
18
+ @path += '?preference=_local'
19
+ end
17
20
  end
18
21
 
19
22
  def results
data/lib/tire/index.rb CHANGED
@@ -11,7 +11,7 @@ module Tire
11
11
  end
12
12
 
13
13
  def self.list
14
- url = "#{Configuration.url}/index"
14
+ url = "#{Configuration.url}/cluster/_index"
15
15
 
16
16
  @response = Configuration.client.get(url)
17
17
  if @response.failure?
data/lib/tire/search.rb CHANGED
@@ -16,6 +16,9 @@ module Tire
16
16
  end
17
17
 
18
18
  @path = ['/', @indices.join(','), @types.join(','), '_search'].compact.join('/').squeeze('/')
19
+ if indices == 'blog'
20
+ @path += '?preference=_local'
21
+ end
19
22
  end
20
23
 
21
24
  def results
data/lib/tire/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Tire
3
- VERSION = "0.6.0"
3
+ VERSION = "0.6.1"
4
4
  end
@@ -17,4 +17,4 @@ module Tire
17
17
  end
18
18
  end
19
19
  end
20
- end
20
+ end
@@ -20,4 +20,4 @@ module Tire
20
20
  end
21
21
  end
22
22
  end
23
- end
23
+ end
data/test/test_helper.rb CHANGED
@@ -8,7 +8,6 @@ require 'yajl'
8
8
  #require 'yajl/json_gem'
9
9
 
10
10
  require 'shoulda'
11
- require 'turn/autorun' unless defined?(RUBY_VERSION) && RUBY_VERSION < '1.9'
12
11
  require 'mocha'
13
12
 
14
13
  require 'tire'
@@ -27,7 +26,7 @@ module Test::Integration
27
26
  TYPE = "type_test"
28
27
 
29
28
  def setup
30
- ENV['ELASTICSEARCH_URL'] = URL
29
+ Tire::Configuration.url(URL)
31
30
  @index = Tire.index(INDEX)
32
31
  end
33
32
 
@@ -7,7 +7,7 @@ module Tire
7
7
 
8
8
  def teardown
9
9
  Tire::Configuration.reset
10
- ENV['ELASTICSEARCH_URL'] = nil
10
+ ENV['CSDNSEARCH_URL'] = nil
11
11
  end
12
12
 
13
13
  context "Configuration" do
@@ -25,7 +25,7 @@ module Tire
25
25
  end
26
26
 
27
27
  should "use environment variable, if present" do
28
- ENV['ELASTICSEARCH_URL'] = 'http://es.example.com'
28
+ ENV['CSDNSEARCH_URL'] = 'http://es.example.com'
29
29
  assert_equal 'http://es.example.com', Configuration.url
30
30
  end
31
31
 
metadata CHANGED
@@ -1,208 +1,218 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: csdn-tire
3
- version: !ruby/object:Gem::Version
4
- hash: 7
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.6.1
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 6
9
- - 0
10
- version: 0.6.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Hooopo
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-06-18 00:00:00 +08:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2012-06-20 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: rake
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
33
22
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: rest-client
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
39
25
  none: false
40
- requirements:
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rest-client
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
41
35
  - - ~>
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 1
46
- - 6
47
- version: "1.6"
36
+ - !ruby/object:Gem::Version
37
+ version: '1.6'
48
38
  type: :runtime
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
- name: multi_json
52
39
  prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
54
41
  none: false
55
- requirements:
42
+ requirements:
56
43
  - - ~>
57
- - !ruby/object:Gem::Version
58
- hash: 15
59
- segments:
60
- - 1
61
- - 0
62
- version: "1.0"
44
+ - !ruby/object:Gem::Version
45
+ version: '1.6'
46
+ - !ruby/object:Gem::Dependency
47
+ name: multi_json
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '1.0'
63
54
  type: :runtime
64
- version_requirements: *id003
65
- - !ruby/object:Gem::Dependency
66
- name: hashr
67
55
  prerelease: false
68
- requirement: &id004 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: hashr
64
+ requirement: !ruby/object:Gem::Requirement
69
65
  none: false
70
- requirements:
66
+ requirements:
71
67
  - - ~>
72
- - !ruby/object:Gem::Version
73
- hash: 57
74
- segments:
75
- - 0
76
- - 0
77
- - 19
68
+ - !ruby/object:Gem::Version
78
69
  version: 0.0.19
79
70
  type: :runtime
80
- version_requirements: *id004
81
- - !ruby/object:Gem::Dependency
82
- name: activesupport
83
71
  prerelease: false
84
- requirement: &id005 !ruby/object:Gem::Requirement
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 0.0.19
78
+ - !ruby/object:Gem::Dependency
79
+ name: activesupport
80
+ requirement: !ruby/object:Gem::Requirement
85
81
  none: false
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- hash: 5
90
- segments:
91
- - 2
92
- - 3
93
- version: "2.3"
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '2.3'
94
86
  type: :runtime
95
- version_requirements: *id005
96
- - !ruby/object:Gem::Dependency
97
- name: bundler
98
87
  prerelease: false
99
- requirement: &id006 !ruby/object:Gem::Requirement
88
+ version_requirements: !ruby/object:Gem::Requirement
100
89
  none: false
101
- requirements:
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '2.3'
94
+ - !ruby/object:Gem::Dependency
95
+ name: bundler
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
102
99
  - - ~>
103
- - !ruby/object:Gem::Version
104
- hash: 15
105
- segments:
106
- - 1
107
- - 0
108
- version: "1.0"
100
+ - !ruby/object:Gem::Version
101
+ version: '1.0'
109
102
  type: :development
110
- version_requirements: *id006
111
- - !ruby/object:Gem::Dependency
112
- name: yajl-ruby
113
103
  prerelease: false
114
- requirement: &id007 !ruby/object:Gem::Requirement
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '1.0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: yajl-ruby
112
+ requirement: !ruby/object:Gem::Requirement
115
113
  none: false
116
- requirements:
114
+ requirements:
117
115
  - - ~>
118
- - !ruby/object:Gem::Version
119
- hash: 15
120
- segments:
121
- - 1
122
- - 0
123
- version: "1.0"
116
+ - !ruby/object:Gem::Version
117
+ version: '1.0'
124
118
  type: :development
125
- version_requirements: *id007
126
- - !ruby/object:Gem::Dependency
127
- name: shoulda
128
119
  prerelease: false
129
- requirement: &id008 !ruby/object:Gem::Requirement
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: '1.0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: shoulda
128
+ requirement: !ruby/object:Gem::Requirement
130
129
  none: false
131
- requirements:
132
- - - ">="
133
- - !ruby/object:Gem::Version
134
- hash: 3
135
- segments:
136
- - 0
137
- version: "0"
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
138
134
  type: :development
139
- version_requirements: *id008
140
- - !ruby/object:Gem::Dependency
141
- name: mocha
142
135
  prerelease: false
143
- requirement: &id009 !ruby/object:Gem::Requirement
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ - !ruby/object:Gem::Dependency
143
+ name: mocha
144
+ requirement: !ruby/object:Gem::Requirement
144
145
  none: false
145
- requirements:
146
- - - ">="
147
- - !ruby/object:Gem::Version
148
- hash: 3
149
- segments:
150
- - 0
151
- version: "0"
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
152
150
  type: :development
153
- version_requirements: *id009
154
- - !ruby/object:Gem::Dependency
155
- name: bson_ext
156
151
  prerelease: false
157
- requirement: &id010 !ruby/object:Gem::Requirement
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ - !ruby/object:Gem::Dependency
159
+ name: bson_ext
160
+ requirement: !ruby/object:Gem::Requirement
158
161
  none: false
159
- requirements:
160
- - - ">="
161
- - !ruby/object:Gem::Version
162
- hash: 3
163
- segments:
164
- - 0
165
- version: "0"
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
166
  type: :development
167
- version_requirements: *id010
168
- - !ruby/object:Gem::Dependency
169
- name: curb
170
167
  prerelease: false
171
- requirement: &id011 !ruby/object:Gem::Requirement
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ - !ruby/object:Gem::Dependency
175
+ name: curb
176
+ requirement: !ruby/object:Gem::Requirement
172
177
  none: false
173
- requirements:
174
- - - ">="
175
- - !ruby/object:Gem::Version
176
- hash: 3
177
- segments:
178
- - 0
179
- version: "0"
178
+ requirements:
179
+ - - ! '>='
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
180
182
  type: :development
181
- version_requirements: *id011
182
- - !ruby/object:Gem::Dependency
183
- name: minitest
184
183
  prerelease: false
185
- requirement: &id012 !ruby/object:Gem::Requirement
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ - !ruby/object:Gem::Dependency
191
+ name: minitest
192
+ requirement: !ruby/object:Gem::Requirement
186
193
  none: false
187
- requirements:
188
- - - ">="
189
- - !ruby/object:Gem::Version
190
- hash: 3
191
- segments:
192
- - 0
193
- version: "0"
194
+ requirements:
195
+ - - ! '>='
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
194
198
  type: :development
195
- version_requirements: *id012
196
- description: " Tire is a Ruby client for the CSDNSearch search engine/database.\n"
199
+ prerelease: false
200
+ version_requirements: !ruby/object:Gem::Requirement
201
+ none: false
202
+ requirements:
203
+ - - ! '>='
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
206
+ description: ! ' Tire is a Ruby client for the CSDNSearch search engine/database.
207
+
208
+ '
197
209
  email: wangxz@csdn.net
198
210
  executables: []
199
-
200
211
  extensions: []
201
-
202
- extra_rdoc_files:
212
+ extra_rdoc_files:
203
213
  - README.markdown
204
214
  - MIT-LICENSE
205
- files:
215
+ files:
206
216
  - .gitignore
207
217
  - .travis.yml
208
218
  - Gemfile
@@ -236,41 +246,29 @@ files:
236
246
  - test/unit/http_response_test.rb
237
247
  - test/unit/logger_test.rb
238
248
  - tire.gemspec
239
- has_rdoc: true
240
249
  homepage: https://github.com/csdn-dev/tire
241
250
  licenses: []
242
-
243
251
  post_install_message:
244
- rdoc_options:
252
+ rdoc_options:
245
253
  - --charset=UTF-8
246
- require_paths:
254
+ require_paths:
247
255
  - lib
248
- required_ruby_version: !ruby/object:Gem::Requirement
256
+ required_ruby_version: !ruby/object:Gem::Requirement
249
257
  none: false
250
- requirements:
251
- - - ">="
252
- - !ruby/object:Gem::Version
253
- hash: 3
254
- segments:
255
- - 0
256
- version: "0"
257
- required_rubygems_version: !ruby/object:Gem::Requirement
258
+ requirements:
259
+ - - ! '>='
260
+ - !ruby/object:Gem::Version
261
+ version: '0'
262
+ required_rubygems_version: !ruby/object:Gem::Requirement
258
263
  none: false
259
- requirements:
260
- - - ">="
261
- - !ruby/object:Gem::Version
262
- hash: 23
263
- segments:
264
- - 1
265
- - 3
266
- - 6
264
+ requirements:
265
+ - - ! '>='
266
+ - !ruby/object:Gem::Version
267
267
  version: 1.3.6
268
268
  requirements: []
269
-
270
269
  rubyforge_project: tire
271
- rubygems_version: 1.3.9.4
270
+ rubygems_version: 1.8.24
272
271
  signing_key:
273
272
  specification_version: 3
274
273
  summary: Ruby client for CSDNSearch
275
274
  test_files: []
276
-