picky 2.7.0 → 3.0.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (213) hide show
  1. data/lib/picky/adapters/rack/base.rb +20 -16
  2. data/lib/picky/adapters/rack/live_parameters.rb +28 -24
  3. data/lib/picky/adapters/rack/search.rb +67 -0
  4. data/lib/picky/adapters/rack.rb +27 -23
  5. data/lib/picky/application.rb +246 -236
  6. data/lib/picky/backend/base.rb +115 -119
  7. data/lib/picky/backend/file/basic.rb +102 -98
  8. data/lib/picky/backend/file/json.rb +27 -23
  9. data/lib/picky/backend/file/marshal.rb +32 -28
  10. data/lib/picky/backend/file/text.rb +45 -41
  11. data/lib/picky/backend/files.rb +19 -15
  12. data/lib/picky/backend/redis/basic.rb +76 -72
  13. data/lib/picky/backend/redis/list_hash.rb +40 -36
  14. data/lib/picky/backend/redis/string_hash.rb +30 -26
  15. data/lib/picky/backend/redis.rb +32 -28
  16. data/lib/picky/bundle.rb +82 -57
  17. data/lib/{bundling.rb → picky/bundling.rb} +0 -0
  18. data/lib/picky/calculations/location.rb +51 -47
  19. data/lib/picky/categories.rb +60 -56
  20. data/lib/picky/categories_indexed.rb +73 -82
  21. data/lib/picky/categories_indexing.rb +12 -8
  22. data/lib/picky/category.rb +109 -120
  23. data/lib/picky/category_indexed.rb +39 -41
  24. data/lib/picky/category_indexing.rb +123 -125
  25. data/lib/picky/character_substituters/west_european.rb +32 -26
  26. data/lib/{constants.rb → picky/constants.rb} +0 -0
  27. data/lib/picky/cores.rb +96 -92
  28. data/lib/{deployment.rb → picky/deployment.rb} +0 -0
  29. data/lib/picky/frontend_adapters/rack.rb +133 -118
  30. data/lib/picky/generators/aliases.rb +5 -3
  31. data/lib/picky/generators/base.rb +11 -7
  32. data/lib/picky/generators/partial/default.rb +7 -3
  33. data/lib/picky/generators/partial/none.rb +24 -20
  34. data/lib/picky/generators/partial/strategy.rb +20 -16
  35. data/lib/picky/generators/partial/substring.rb +94 -90
  36. data/lib/picky/generators/partial_generator.rb +11 -7
  37. data/lib/picky/generators/similarity/default.rb +9 -5
  38. data/lib/picky/generators/similarity/double_metaphone.rb +20 -16
  39. data/lib/picky/generators/similarity/metaphone.rb +20 -16
  40. data/lib/picky/generators/similarity/none.rb +23 -19
  41. data/lib/picky/generators/similarity/phonetic.rb +49 -45
  42. data/lib/picky/generators/similarity/soundex.rb +20 -16
  43. data/lib/picky/generators/similarity/strategy.rb +10 -6
  44. data/lib/picky/generators/similarity_generator.rb +11 -7
  45. data/lib/picky/generators/strategy.rb +14 -10
  46. data/lib/picky/generators/weights/default.rb +9 -5
  47. data/lib/picky/generators/weights/logarithmic.rb +30 -26
  48. data/lib/picky/generators/weights/strategy.rb +10 -6
  49. data/lib/picky/generators/weights_generator.rb +11 -7
  50. data/lib/picky/helpers/measuring.rb +20 -16
  51. data/lib/picky/indexed/bundle/base.rb +39 -37
  52. data/lib/picky/indexed/bundle/memory.rb +68 -64
  53. data/lib/picky/indexed/bundle/redis.rb +73 -69
  54. data/lib/picky/indexed/wrappers/bundle/calculation.rb +26 -22
  55. data/lib/picky/indexed/wrappers/bundle/location.rb +30 -26
  56. data/lib/picky/indexed/wrappers/bundle/wrapper.rb +36 -32
  57. data/lib/picky/indexed/wrappers/category/location.rb +17 -13
  58. data/lib/picky/indexed/wrappers/exact_first.rb +46 -42
  59. data/lib/picky/indexers/base.rb +26 -22
  60. data/lib/picky/indexers/parallel.rb +62 -58
  61. data/lib/picky/indexers/serial.rb +41 -37
  62. data/lib/picky/indexes/index.rb +400 -0
  63. data/lib/picky/indexes/index_indexed.rb +24 -0
  64. data/lib/picky/indexes/index_indexing.rb +138 -0
  65. data/lib/picky/indexes/memory.rb +20 -0
  66. data/lib/picky/indexes/redis.rb +20 -0
  67. data/lib/picky/indexes.rb +68 -61
  68. data/lib/picky/indexes_indexed.rb +16 -12
  69. data/lib/picky/indexes_indexing.rb +41 -37
  70. data/lib/picky/indexing/bundle/base.rb +216 -205
  71. data/lib/picky/indexing/bundle/memory.rb +16 -11
  72. data/lib/picky/indexing/bundle/redis.rb +14 -12
  73. data/lib/picky/indexing/wrappers/category/location.rb +17 -13
  74. data/lib/picky/interfaces/live_parameters.rb +159 -154
  75. data/lib/picky/loader.rb +267 -304
  76. data/lib/picky/loggers/search.rb +20 -13
  77. data/lib/picky/no_source_specified_exception.rb +7 -3
  78. data/lib/picky/performant.rb +6 -2
  79. data/lib/picky/query/allocation.rb +71 -67
  80. data/lib/picky/query/allocations.rb +99 -94
  81. data/lib/picky/query/combination.rb +70 -66
  82. data/lib/picky/query/combinations/base.rb +56 -52
  83. data/lib/picky/query/combinations/memory.rb +36 -32
  84. data/lib/picky/query/combinations/redis.rb +66 -62
  85. data/lib/picky/query/indexes.rb +175 -160
  86. data/lib/picky/query/qualifier_category_mapper.rb +43 -0
  87. data/lib/picky/query/token.rb +165 -172
  88. data/lib/picky/query/tokens.rb +86 -82
  89. data/lib/picky/query/weights.rb +44 -48
  90. data/lib/picky/query.rb +5 -1
  91. data/lib/picky/rack/harakiri.rb +51 -47
  92. data/lib/picky/results.rb +81 -77
  93. data/lib/picky/search.rb +169 -158
  94. data/lib/picky/sinatra.rb +34 -0
  95. data/lib/picky/sources/base.rb +73 -70
  96. data/lib/picky/sources/couch.rb +61 -57
  97. data/lib/picky/sources/csv.rb +68 -64
  98. data/lib/picky/sources/db.rb +139 -135
  99. data/lib/picky/sources/delicious.rb +52 -48
  100. data/lib/picky/sources/mongo.rb +68 -63
  101. data/lib/picky/sources/wrappers/base.rb +20 -16
  102. data/lib/picky/sources/wrappers/location.rb +37 -33
  103. data/lib/picky/statistics.rb +46 -43
  104. data/lib/picky/tasks.rb +3 -0
  105. data/lib/picky/tokenizers/base.rb +192 -187
  106. data/lib/picky/tokenizers/index.rb +25 -21
  107. data/lib/picky/tokenizers/location.rb +33 -29
  108. data/lib/picky/tokenizers/query.rb +49 -43
  109. data/lib/picky.rb +21 -13
  110. data/lib/tasks/application.rake +1 -1
  111. data/lib/tasks/index.rake +3 -3
  112. data/lib/tasks/routes.rake +1 -1
  113. data/lib/tasks/server.rake +1 -1
  114. data/spec/lib/adapters/rack/base_spec.rb +1 -1
  115. data/spec/lib/adapters/rack/live_parameters_spec.rb +1 -1
  116. data/spec/lib/adapters/rack/query_spec.rb +1 -1
  117. data/spec/lib/application_spec.rb +39 -32
  118. data/spec/lib/backend/file/basic_spec.rb +2 -2
  119. data/spec/lib/backend/file/json_spec.rb +2 -2
  120. data/spec/lib/backend/file/marshal_spec.rb +2 -2
  121. data/spec/lib/backend/file/text_spec.rb +1 -1
  122. data/spec/lib/backend/files_spec.rb +14 -24
  123. data/spec/lib/backend/redis/basic_spec.rb +2 -2
  124. data/spec/lib/backend/redis/list_hash_spec.rb +3 -3
  125. data/spec/lib/backend/redis/string_hash_spec.rb +3 -3
  126. data/spec/lib/backend/redis_spec.rb +20 -13
  127. data/spec/lib/calculations/location_spec.rb +1 -1
  128. data/spec/lib/categories_indexed_spec.rb +16 -34
  129. data/spec/lib/category_indexed_spec.rb +9 -27
  130. data/spec/lib/category_indexing_spec.rb +2 -3
  131. data/spec/lib/category_spec.rb +10 -10
  132. data/spec/lib/character_substituters/west_european_spec.rb +6 -5
  133. data/spec/lib/cores_spec.rb +17 -17
  134. data/spec/lib/extensions/symbol_spec.rb +15 -1
  135. data/spec/lib/frontend_adapters/rack_spec.rb +20 -20
  136. data/spec/lib/generators/aliases_spec.rb +3 -3
  137. data/spec/lib/generators/cacher_strategy_spec.rb +1 -1
  138. data/spec/lib/generators/partial/default_spec.rb +3 -3
  139. data/spec/lib/generators/partial/none_spec.rb +2 -2
  140. data/spec/lib/generators/partial/substring_spec.rb +1 -1
  141. data/spec/lib/generators/partial_generator_spec.rb +3 -3
  142. data/spec/lib/generators/similarity/double_metaphone_spec.rb +1 -1
  143. data/spec/lib/generators/similarity/metaphone_spec.rb +1 -1
  144. data/spec/lib/generators/similarity/none_spec.rb +1 -1
  145. data/spec/lib/generators/similarity/phonetic_spec.rb +1 -1
  146. data/spec/lib/generators/similarity/soundex_spec.rb +1 -1
  147. data/spec/lib/generators/similarity_generator_spec.rb +2 -2
  148. data/spec/lib/generators/weights/logarithmic_spec.rb +1 -1
  149. data/spec/lib/generators/weights_generator_spec.rb +1 -1
  150. data/spec/lib/helpers/measuring_spec.rb +2 -2
  151. data/spec/lib/indexed/bundle/memory_spec.rb +6 -6
  152. data/spec/lib/indexed/bundle/redis_spec.rb +4 -4
  153. data/spec/lib/indexed/wrappers/bundle/calculation_spec.rb +2 -3
  154. data/spec/lib/indexed/wrappers/bundle/wrapper_spec.rb +2 -2
  155. data/spec/lib/indexed/wrappers/exact_first_spec.rb +5 -5
  156. data/spec/lib/indexers/base_spec.rb +1 -1
  157. data/spec/lib/indexers/parallel_spec.rb +1 -1
  158. data/spec/lib/indexers/serial_spec.rb +1 -1
  159. data/spec/lib/{index/base_indexed_spec.rb → indexes/index_indexed_spec.rb} +3 -3
  160. data/spec/lib/{index/base_indexing_spec.rb → indexes/index_indexing_spec.rb} +19 -2
  161. data/spec/lib/{index/base_spec.rb → indexes/index_spec.rb} +6 -25
  162. data/spec/lib/{index → indexes}/redis_spec.rb +1 -1
  163. data/spec/lib/indexes_class_spec.rb +2 -2
  164. data/spec/lib/indexes_indexed_spec.rb +1 -1
  165. data/spec/lib/indexes_indexing_spec.rb +1 -1
  166. data/spec/lib/indexes_spec.rb +1 -1
  167. data/spec/lib/indexing/bundle/base_spec.rb +7 -5
  168. data/spec/lib/indexing/bundle/memory_partial_generation_speed_spec.rb +4 -4
  169. data/spec/lib/indexing/bundle/memory_spec.rb +15 -15
  170. data/spec/lib/indexing/bundle/redis_spec.rb +9 -9
  171. data/spec/lib/interfaces/live_parameters_spec.rb +5 -5
  172. data/spec/lib/loader_spec.rb +17 -19
  173. data/spec/lib/loggers/search_spec.rb +2 -2
  174. data/spec/lib/query/allocation_spec.rb +1 -1
  175. data/spec/lib/query/allocations_spec.rb +1 -1
  176. data/spec/lib/query/combination_spec.rb +4 -4
  177. data/spec/lib/query/combinations/base_spec.rb +1 -1
  178. data/spec/lib/query/combinations/memory_spec.rb +1 -1
  179. data/spec/lib/query/combinations/redis_spec.rb +1 -1
  180. data/spec/lib/query/indexes_spec.rb +7 -2
  181. data/spec/lib/query/qualifier_category_mapper_spec.rb +34 -0
  182. data/spec/lib/query/token_spec.rb +32 -53
  183. data/spec/lib/query/tokens_spec.rb +30 -35
  184. data/spec/lib/query/weights_spec.rb +16 -16
  185. data/spec/lib/rack/harakiri_spec.rb +5 -5
  186. data/spec/lib/results_spec.rb +1 -1
  187. data/spec/lib/search_spec.rb +24 -22
  188. data/spec/lib/sinatra_spec.rb +36 -0
  189. data/spec/lib/sources/base_spec.rb +1 -1
  190. data/spec/lib/sources/couch_spec.rb +9 -9
  191. data/spec/lib/sources/csv_spec.rb +7 -7
  192. data/spec/lib/sources/db_spec.rb +2 -2
  193. data/spec/lib/sources/delicious_spec.rb +5 -5
  194. data/spec/lib/sources/mongo_spec.rb +7 -7
  195. data/spec/lib/sources/wrappers/base_spec.rb +2 -2
  196. data/spec/lib/sources/wrappers/location_spec.rb +1 -1
  197. data/spec/lib/statistics_spec.rb +1 -1
  198. data/spec/lib/tokenizers/base_spec.rb +2 -2
  199. data/spec/lib/tokenizers/index_spec.rb +1 -1
  200. data/spec/lib/tokenizers/query_spec.rb +1 -1
  201. metadata +30 -30
  202. data/lib/picky/adapters/rack/query.rb +0 -65
  203. data/lib/picky/index/base.rb +0 -409
  204. data/lib/picky/index/base_indexed.rb +0 -29
  205. data/lib/picky/index/base_indexing.rb +0 -127
  206. data/lib/picky/index/memory.rb +0 -16
  207. data/lib/picky/index/redis.rb +0 -16
  208. data/lib/picky/query/qualifiers.rb +0 -76
  209. data/lib/picky/query/solr.rb +0 -60
  210. data/lib/picky/signals.rb +0 -8
  211. data/lib/picky-tasks.rb +0 -6
  212. data/lib/tasks/spec.rake +0 -11
  213. data/spec/lib/query/qualifiers_spec.rb +0 -31
@@ -2,7 +2,7 @@
2
2
  #
3
3
  require 'spec_helper'
4
4
 
5
- describe Tokenizers::Base do
5
+ describe Picky::Tokenizers::Base do
6
6
 
7
7
  context 'with special instance' do
8
8
  let (:tokenizer) { described_class.new reject_token_if: lambda { |token| token.to_s.length < 2 || token == :hello }, case_sensitive: true }
@@ -65,7 +65,7 @@ EXPECTED
65
65
  expect { tokenizer.substitutes_characters_with Object.new }.to raise_error("The substitutes_characters_with option needs a character substituter, which responds to #substitute.")
66
66
  end
67
67
  it "uses the substituter to replace characters" do
68
- tokenizer.substitutes_characters_with CharacterSubstituters::WestEuropean.new
68
+ tokenizer.substitutes_characters_with Picky::CharacterSubstituters::WestEuropean.new
69
69
 
70
70
  tokenizer.substitute_characters('abcdefghijklmnopqrstuvwxyzäöü').should == 'abcdefghijklmnopqrstuvwxyzaeoeue'
71
71
  end
@@ -2,7 +2,7 @@
2
2
  #
3
3
  require 'spec_helper'
4
4
 
5
- describe Tokenizers::Index do
5
+ describe Picky::Tokenizers::Index do
6
6
 
7
7
  let(:tokenizer) { described_class.new }
8
8
 
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  require 'spec_helper'
3
3
 
4
- describe Tokenizers::Query do
4
+ describe Picky::Tokenizers::Query do
5
5
 
6
6
  let(:tokenizer) { described_class.new }
7
7
 
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: picky
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 2.7.0
4
+ prerelease: 6
5
+ version: 3.0.0.pre1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Florian Hanke
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-07-07 00:00:00 +10:00
13
+ date: 2011-08-07 00:00:00 +10:00
14
14
  default_executable: picky
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -32,7 +32,7 @@ dependencies:
32
32
  requirements:
33
33
  - - "="
34
34
  - !ruby/object:Gem::Version
35
- version: 2.7.0
35
+ version: 3.0.0.pre1
36
36
  type: :development
37
37
  version_requirements: *id002
38
38
  description: Fast Ruby semantic text search engine with comfortable single field interface.
@@ -45,12 +45,9 @@ extra_rdoc_files: []
45
45
 
46
46
  files:
47
47
  - aux/picky/cli.rb
48
- - lib/bundling.rb
49
- - lib/constants.rb
50
- - lib/deployment.rb
51
48
  - lib/picky/adapters/rack/base.rb
52
49
  - lib/picky/adapters/rack/live_parameters.rb
53
- - lib/picky/adapters/rack/query.rb
50
+ - lib/picky/adapters/rack/search.rb
54
51
  - lib/picky/adapters/rack.rb
55
52
  - lib/picky/analyzer.rb
56
53
  - lib/picky/application.rb
@@ -65,6 +62,7 @@ files:
65
62
  - lib/picky/backend/redis/string_hash.rb
66
63
  - lib/picky/backend/redis.rb
67
64
  - lib/picky/bundle.rb
65
+ - lib/picky/bundling.rb
68
66
  - lib/picky/calculations/location.rb
69
67
  - lib/picky/categories.rb
70
68
  - lib/picky/categories_indexed.rb
@@ -73,7 +71,9 @@ files:
73
71
  - lib/picky/category_indexed.rb
74
72
  - lib/picky/category_indexing.rb
75
73
  - lib/picky/character_substituters/west_european.rb
74
+ - lib/picky/constants.rb
76
75
  - lib/picky/cores.rb
76
+ - lib/picky/deployment.rb
77
77
  - lib/picky/ext/maybe_compile.rb
78
78
  - lib/picky/ext/ruby19/extconf.rb
79
79
  - lib/picky/extensions/array.rb
@@ -104,11 +104,6 @@ files:
104
104
  - lib/picky/generators/weights/strategy.rb
105
105
  - lib/picky/generators/weights_generator.rb
106
106
  - lib/picky/helpers/measuring.rb
107
- - lib/picky/index/base.rb
108
- - lib/picky/index/base_indexed.rb
109
- - lib/picky/index/base_indexing.rb
110
- - lib/picky/index/memory.rb
111
- - lib/picky/index/redis.rb
112
107
  - lib/picky/indexed/bundle/base.rb
113
108
  - lib/picky/indexed/bundle/memory.rb
114
109
  - lib/picky/indexed/bundle/redis.rb
@@ -120,6 +115,11 @@ files:
120
115
  - lib/picky/indexers/base.rb
121
116
  - lib/picky/indexers/parallel.rb
122
117
  - lib/picky/indexers/serial.rb
118
+ - lib/picky/indexes/index.rb
119
+ - lib/picky/indexes/index_indexed.rb
120
+ - lib/picky/indexes/index_indexing.rb
121
+ - lib/picky/indexes/memory.rb
122
+ - lib/picky/indexes/redis.rb
123
123
  - lib/picky/indexes.rb
124
124
  - lib/picky/indexes_indexed.rb
125
125
  - lib/picky/indexes_indexing.rb
@@ -139,8 +139,7 @@ files:
139
139
  - lib/picky/query/combinations/memory.rb
140
140
  - lib/picky/query/combinations/redis.rb
141
141
  - lib/picky/query/indexes.rb
142
- - lib/picky/query/qualifiers.rb
143
- - lib/picky/query/solr.rb
142
+ - lib/picky/query/qualifier_category_mapper.rb
144
143
  - lib/picky/query/token.rb
145
144
  - lib/picky/query/tokens.rb
146
145
  - lib/picky/query/weights.rb
@@ -148,7 +147,7 @@ files:
148
147
  - lib/picky/rack/harakiri.rb
149
148
  - lib/picky/results.rb
150
149
  - lib/picky/search.rb
151
- - lib/picky/signals.rb
150
+ - lib/picky/sinatra.rb
152
151
  - lib/picky/sources/base.rb
153
152
  - lib/picky/sources/couch.rb
154
153
  - lib/picky/sources/csv.rb
@@ -158,11 +157,11 @@ files:
158
157
  - lib/picky/sources/wrappers/base.rb
159
158
  - lib/picky/sources/wrappers/location.rb
160
159
  - lib/picky/statistics.rb
160
+ - lib/picky/tasks.rb
161
161
  - lib/picky/tokenizers/base.rb
162
162
  - lib/picky/tokenizers/index.rb
163
163
  - lib/picky/tokenizers/location.rb
164
164
  - lib/picky/tokenizers/query.rb
165
- - lib/picky-tasks.rb
166
165
  - lib/picky.rb
167
166
  - lib/tasks/application.rake
168
167
  - lib/tasks/checks.rake
@@ -170,7 +169,6 @@ files:
170
169
  - lib/tasks/index.rake
171
170
  - lib/tasks/routes.rake
172
171
  - lib/tasks/server.rake
173
- - lib/tasks/spec.rake
174
172
  - lib/tasks/statistics.rake
175
173
  - lib/tasks/todo.rake
176
174
  - lib/tasks/try.rake
@@ -220,10 +218,6 @@ files:
220
218
  - spec/lib/generators/weights/logarithmic_spec.rb
221
219
  - spec/lib/generators/weights_generator_spec.rb
222
220
  - spec/lib/helpers/measuring_spec.rb
223
- - spec/lib/index/base_indexed_spec.rb
224
- - spec/lib/index/base_indexing_spec.rb
225
- - spec/lib/index/base_spec.rb
226
- - spec/lib/index/redis_spec.rb
227
221
  - spec/lib/indexed/bundle/memory_spec.rb
228
222
  - spec/lib/indexed/bundle/redis_spec.rb
229
223
  - spec/lib/indexed/wrappers/bundle/calculation_spec.rb
@@ -232,6 +226,10 @@ files:
232
226
  - spec/lib/indexers/base_spec.rb
233
227
  - spec/lib/indexers/parallel_spec.rb
234
228
  - spec/lib/indexers/serial_spec.rb
229
+ - spec/lib/indexes/index_indexed_spec.rb
230
+ - spec/lib/indexes/index_indexing_spec.rb
231
+ - spec/lib/indexes/index_spec.rb
232
+ - spec/lib/indexes/redis_spec.rb
235
233
  - spec/lib/indexes_class_spec.rb
236
234
  - spec/lib/indexes_indexed_spec.rb
237
235
  - spec/lib/indexes_indexing_spec.rb
@@ -250,7 +248,7 @@ files:
250
248
  - spec/lib/query/combinations/memory_spec.rb
251
249
  - spec/lib/query/combinations/redis_spec.rb
252
250
  - spec/lib/query/indexes_spec.rb
253
- - spec/lib/query/qualifiers_spec.rb
251
+ - spec/lib/query/qualifier_category_mapper_spec.rb
254
252
  - spec/lib/query/solr_spec.rb
255
253
  - spec/lib/query/token_spec.rb
256
254
  - spec/lib/query/tokens_spec.rb
@@ -258,6 +256,7 @@ files:
258
256
  - spec/lib/rack/harakiri_spec.rb
259
257
  - spec/lib/results_spec.rb
260
258
  - spec/lib/search_spec.rb
259
+ - spec/lib/sinatra_spec.rb
261
260
  - spec/lib/solr/schema_generator_spec.rb
262
261
  - spec/lib/sources/base_spec.rb
263
262
  - spec/lib/sources/couch_spec.rb
@@ -291,9 +290,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
291
290
  required_rubygems_version: !ruby/object:Gem::Requirement
292
291
  none: false
293
292
  requirements:
294
- - - ">="
293
+ - - ">"
295
294
  - !ruby/object:Gem::Version
296
- version: "0"
295
+ version: 1.3.1
297
296
  requirements: []
298
297
 
299
298
  rubyforge_project: http://rubyforge.org/projects/picky
@@ -347,10 +346,6 @@ test_files:
347
346
  - spec/lib/generators/weights/logarithmic_spec.rb
348
347
  - spec/lib/generators/weights_generator_spec.rb
349
348
  - spec/lib/helpers/measuring_spec.rb
350
- - spec/lib/index/base_indexed_spec.rb
351
- - spec/lib/index/base_indexing_spec.rb
352
- - spec/lib/index/base_spec.rb
353
- - spec/lib/index/redis_spec.rb
354
349
  - spec/lib/indexed/bundle/memory_spec.rb
355
350
  - spec/lib/indexed/bundle/redis_spec.rb
356
351
  - spec/lib/indexed/wrappers/bundle/calculation_spec.rb
@@ -359,6 +354,10 @@ test_files:
359
354
  - spec/lib/indexers/base_spec.rb
360
355
  - spec/lib/indexers/parallel_spec.rb
361
356
  - spec/lib/indexers/serial_spec.rb
357
+ - spec/lib/indexes/index_indexed_spec.rb
358
+ - spec/lib/indexes/index_indexing_spec.rb
359
+ - spec/lib/indexes/index_spec.rb
360
+ - spec/lib/indexes/redis_spec.rb
362
361
  - spec/lib/indexes_class_spec.rb
363
362
  - spec/lib/indexes_indexed_spec.rb
364
363
  - spec/lib/indexes_indexing_spec.rb
@@ -377,7 +376,7 @@ test_files:
377
376
  - spec/lib/query/combinations/memory_spec.rb
378
377
  - spec/lib/query/combinations/redis_spec.rb
379
378
  - spec/lib/query/indexes_spec.rb
380
- - spec/lib/query/qualifiers_spec.rb
379
+ - spec/lib/query/qualifier_category_mapper_spec.rb
381
380
  - spec/lib/query/solr_spec.rb
382
381
  - spec/lib/query/token_spec.rb
383
382
  - spec/lib/query/tokens_spec.rb
@@ -385,6 +384,7 @@ test_files:
385
384
  - spec/lib/rack/harakiri_spec.rb
386
385
  - spec/lib/results_spec.rb
387
386
  - spec/lib/search_spec.rb
387
+ - spec/lib/sinatra_spec.rb
388
388
  - spec/lib/solr/schema_generator_spec.rb
389
389
  - spec/lib/sources/base_spec.rb
390
390
  - spec/lib/sources/couch_spec.rb
@@ -1,65 +0,0 @@
1
- module Adapters
2
- # This is an adapter that is plugged into a Rack outlet.
3
- #
4
- # It looks at what is given to it and generate an appropriate
5
- # adapter for it.
6
- #
7
- # For example, if you give it a query, it will extract the query param etc.
8
- # and call search_with_text on it if it is called by Rack.
9
- #
10
- module Rack
11
-
12
- # TODO Rename to Search.
13
- #
14
- class Query < Base
15
-
16
- @@defaults = {
17
- query_key: 'query'.freeze,
18
- ids_key: 'ids'.freeze,
19
- offset_key: 'offset'.freeze,
20
- content_type: 'application/json'.freeze
21
- }
22
-
23
- def initialize query
24
- @query = query
25
- @defaults = @@defaults.dup
26
- end
27
-
28
- def to_app options = {}
29
- # For capturing in the lambda.
30
- #
31
- query = @query
32
- query_key = options[:query_key] || @defaults[:query_key]
33
- content_type = options[:content_type] || @defaults[:content_type]
34
-
35
- lambda do |env|
36
- params = ::Rack::Request.new(env).params
37
-
38
- results = query.search_with_text *extracted(params)
39
-
40
- PickyLog.log results.to_log(params[query_key])
41
-
42
- respond_with results.to_response, content_type
43
- end
44
- end
45
-
46
- # Helper method to extract the params
47
- #
48
- # Defaults are 20 ids, offset 0.
49
- #
50
- UTF8_STRING = 'UTF-8'.freeze
51
- def extracted params
52
- [
53
- # query is encoded in ASCII
54
- #
55
- params[@defaults[:query_key]] && params[@defaults[:query_key]].force_encoding(UTF8_STRING),
56
- params[@defaults[:ids_key]] && params[@defaults[:ids_key]].to_i || 20,
57
- params[@defaults[:offset_key]] && params[@defaults[:offset_key]].to_i || 0
58
- ]
59
- end
60
-
61
- end
62
-
63
- end
64
-
65
- end