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.
- data/lib/picky/adapters/rack/base.rb +20 -16
- data/lib/picky/adapters/rack/live_parameters.rb +28 -24
- data/lib/picky/adapters/rack/search.rb +67 -0
- data/lib/picky/adapters/rack.rb +27 -23
- data/lib/picky/application.rb +246 -236
- data/lib/picky/backend/base.rb +115 -119
- data/lib/picky/backend/file/basic.rb +102 -98
- data/lib/picky/backend/file/json.rb +27 -23
- data/lib/picky/backend/file/marshal.rb +32 -28
- data/lib/picky/backend/file/text.rb +45 -41
- data/lib/picky/backend/files.rb +19 -15
- data/lib/picky/backend/redis/basic.rb +76 -72
- data/lib/picky/backend/redis/list_hash.rb +40 -36
- data/lib/picky/backend/redis/string_hash.rb +30 -26
- data/lib/picky/backend/redis.rb +32 -28
- data/lib/picky/bundle.rb +82 -57
- data/lib/{bundling.rb → picky/bundling.rb} +0 -0
- data/lib/picky/calculations/location.rb +51 -47
- data/lib/picky/categories.rb +60 -56
- data/lib/picky/categories_indexed.rb +73 -82
- data/lib/picky/categories_indexing.rb +12 -8
- data/lib/picky/category.rb +109 -120
- data/lib/picky/category_indexed.rb +39 -41
- data/lib/picky/category_indexing.rb +123 -125
- data/lib/picky/character_substituters/west_european.rb +32 -26
- data/lib/{constants.rb → picky/constants.rb} +0 -0
- data/lib/picky/cores.rb +96 -92
- data/lib/{deployment.rb → picky/deployment.rb} +0 -0
- data/lib/picky/frontend_adapters/rack.rb +133 -118
- data/lib/picky/generators/aliases.rb +5 -3
- data/lib/picky/generators/base.rb +11 -7
- data/lib/picky/generators/partial/default.rb +7 -3
- data/lib/picky/generators/partial/none.rb +24 -20
- data/lib/picky/generators/partial/strategy.rb +20 -16
- data/lib/picky/generators/partial/substring.rb +94 -90
- data/lib/picky/generators/partial_generator.rb +11 -7
- data/lib/picky/generators/similarity/default.rb +9 -5
- data/lib/picky/generators/similarity/double_metaphone.rb +20 -16
- data/lib/picky/generators/similarity/metaphone.rb +20 -16
- data/lib/picky/generators/similarity/none.rb +23 -19
- data/lib/picky/generators/similarity/phonetic.rb +49 -45
- data/lib/picky/generators/similarity/soundex.rb +20 -16
- data/lib/picky/generators/similarity/strategy.rb +10 -6
- data/lib/picky/generators/similarity_generator.rb +11 -7
- data/lib/picky/generators/strategy.rb +14 -10
- data/lib/picky/generators/weights/default.rb +9 -5
- data/lib/picky/generators/weights/logarithmic.rb +30 -26
- data/lib/picky/generators/weights/strategy.rb +10 -6
- data/lib/picky/generators/weights_generator.rb +11 -7
- data/lib/picky/helpers/measuring.rb +20 -16
- data/lib/picky/indexed/bundle/base.rb +39 -37
- data/lib/picky/indexed/bundle/memory.rb +68 -64
- data/lib/picky/indexed/bundle/redis.rb +73 -69
- data/lib/picky/indexed/wrappers/bundle/calculation.rb +26 -22
- data/lib/picky/indexed/wrappers/bundle/location.rb +30 -26
- data/lib/picky/indexed/wrappers/bundle/wrapper.rb +36 -32
- data/lib/picky/indexed/wrappers/category/location.rb +17 -13
- data/lib/picky/indexed/wrappers/exact_first.rb +46 -42
- data/lib/picky/indexers/base.rb +26 -22
- data/lib/picky/indexers/parallel.rb +62 -58
- data/lib/picky/indexers/serial.rb +41 -37
- data/lib/picky/indexes/index.rb +400 -0
- data/lib/picky/indexes/index_indexed.rb +24 -0
- data/lib/picky/indexes/index_indexing.rb +138 -0
- data/lib/picky/indexes/memory.rb +20 -0
- data/lib/picky/indexes/redis.rb +20 -0
- data/lib/picky/indexes.rb +68 -61
- data/lib/picky/indexes_indexed.rb +16 -12
- data/lib/picky/indexes_indexing.rb +41 -37
- data/lib/picky/indexing/bundle/base.rb +216 -205
- data/lib/picky/indexing/bundle/memory.rb +16 -11
- data/lib/picky/indexing/bundle/redis.rb +14 -12
- data/lib/picky/indexing/wrappers/category/location.rb +17 -13
- data/lib/picky/interfaces/live_parameters.rb +159 -154
- data/lib/picky/loader.rb +267 -304
- data/lib/picky/loggers/search.rb +20 -13
- data/lib/picky/no_source_specified_exception.rb +7 -3
- data/lib/picky/performant.rb +6 -2
- data/lib/picky/query/allocation.rb +71 -67
- data/lib/picky/query/allocations.rb +99 -94
- data/lib/picky/query/combination.rb +70 -66
- data/lib/picky/query/combinations/base.rb +56 -52
- data/lib/picky/query/combinations/memory.rb +36 -32
- data/lib/picky/query/combinations/redis.rb +66 -62
- data/lib/picky/query/indexes.rb +175 -160
- data/lib/picky/query/qualifier_category_mapper.rb +43 -0
- data/lib/picky/query/token.rb +165 -172
- data/lib/picky/query/tokens.rb +86 -82
- data/lib/picky/query/weights.rb +44 -48
- data/lib/picky/query.rb +5 -1
- data/lib/picky/rack/harakiri.rb +51 -47
- data/lib/picky/results.rb +81 -77
- data/lib/picky/search.rb +169 -158
- data/lib/picky/sinatra.rb +34 -0
- data/lib/picky/sources/base.rb +73 -70
- data/lib/picky/sources/couch.rb +61 -57
- data/lib/picky/sources/csv.rb +68 -64
- data/lib/picky/sources/db.rb +139 -135
- data/lib/picky/sources/delicious.rb +52 -48
- data/lib/picky/sources/mongo.rb +68 -63
- data/lib/picky/sources/wrappers/base.rb +20 -16
- data/lib/picky/sources/wrappers/location.rb +37 -33
- data/lib/picky/statistics.rb +46 -43
- data/lib/picky/tasks.rb +3 -0
- data/lib/picky/tokenizers/base.rb +192 -187
- data/lib/picky/tokenizers/index.rb +25 -21
- data/lib/picky/tokenizers/location.rb +33 -29
- data/lib/picky/tokenizers/query.rb +49 -43
- data/lib/picky.rb +21 -13
- data/lib/tasks/application.rake +1 -1
- data/lib/tasks/index.rake +3 -3
- data/lib/tasks/routes.rake +1 -1
- data/lib/tasks/server.rake +1 -1
- data/spec/lib/adapters/rack/base_spec.rb +1 -1
- data/spec/lib/adapters/rack/live_parameters_spec.rb +1 -1
- data/spec/lib/adapters/rack/query_spec.rb +1 -1
- data/spec/lib/application_spec.rb +39 -32
- data/spec/lib/backend/file/basic_spec.rb +2 -2
- data/spec/lib/backend/file/json_spec.rb +2 -2
- data/spec/lib/backend/file/marshal_spec.rb +2 -2
- data/spec/lib/backend/file/text_spec.rb +1 -1
- data/spec/lib/backend/files_spec.rb +14 -24
- data/spec/lib/backend/redis/basic_spec.rb +2 -2
- data/spec/lib/backend/redis/list_hash_spec.rb +3 -3
- data/spec/lib/backend/redis/string_hash_spec.rb +3 -3
- data/spec/lib/backend/redis_spec.rb +20 -13
- data/spec/lib/calculations/location_spec.rb +1 -1
- data/spec/lib/categories_indexed_spec.rb +16 -34
- data/spec/lib/category_indexed_spec.rb +9 -27
- data/spec/lib/category_indexing_spec.rb +2 -3
- data/spec/lib/category_spec.rb +10 -10
- data/spec/lib/character_substituters/west_european_spec.rb +6 -5
- data/spec/lib/cores_spec.rb +17 -17
- data/spec/lib/extensions/symbol_spec.rb +15 -1
- data/spec/lib/frontend_adapters/rack_spec.rb +20 -20
- data/spec/lib/generators/aliases_spec.rb +3 -3
- data/spec/lib/generators/cacher_strategy_spec.rb +1 -1
- data/spec/lib/generators/partial/default_spec.rb +3 -3
- data/spec/lib/generators/partial/none_spec.rb +2 -2
- data/spec/lib/generators/partial/substring_spec.rb +1 -1
- data/spec/lib/generators/partial_generator_spec.rb +3 -3
- data/spec/lib/generators/similarity/double_metaphone_spec.rb +1 -1
- data/spec/lib/generators/similarity/metaphone_spec.rb +1 -1
- data/spec/lib/generators/similarity/none_spec.rb +1 -1
- data/spec/lib/generators/similarity/phonetic_spec.rb +1 -1
- data/spec/lib/generators/similarity/soundex_spec.rb +1 -1
- data/spec/lib/generators/similarity_generator_spec.rb +2 -2
- data/spec/lib/generators/weights/logarithmic_spec.rb +1 -1
- data/spec/lib/generators/weights_generator_spec.rb +1 -1
- data/spec/lib/helpers/measuring_spec.rb +2 -2
- data/spec/lib/indexed/bundle/memory_spec.rb +6 -6
- data/spec/lib/indexed/bundle/redis_spec.rb +4 -4
- data/spec/lib/indexed/wrappers/bundle/calculation_spec.rb +2 -3
- data/spec/lib/indexed/wrappers/bundle/wrapper_spec.rb +2 -2
- data/spec/lib/indexed/wrappers/exact_first_spec.rb +5 -5
- data/spec/lib/indexers/base_spec.rb +1 -1
- data/spec/lib/indexers/parallel_spec.rb +1 -1
- data/spec/lib/indexers/serial_spec.rb +1 -1
- data/spec/lib/{index/base_indexed_spec.rb → indexes/index_indexed_spec.rb} +3 -3
- data/spec/lib/{index/base_indexing_spec.rb → indexes/index_indexing_spec.rb} +19 -2
- data/spec/lib/{index/base_spec.rb → indexes/index_spec.rb} +6 -25
- data/spec/lib/{index → indexes}/redis_spec.rb +1 -1
- data/spec/lib/indexes_class_spec.rb +2 -2
- data/spec/lib/indexes_indexed_spec.rb +1 -1
- data/spec/lib/indexes_indexing_spec.rb +1 -1
- data/spec/lib/indexes_spec.rb +1 -1
- data/spec/lib/indexing/bundle/base_spec.rb +7 -5
- data/spec/lib/indexing/bundle/memory_partial_generation_speed_spec.rb +4 -4
- data/spec/lib/indexing/bundle/memory_spec.rb +15 -15
- data/spec/lib/indexing/bundle/redis_spec.rb +9 -9
- data/spec/lib/interfaces/live_parameters_spec.rb +5 -5
- data/spec/lib/loader_spec.rb +17 -19
- data/spec/lib/loggers/search_spec.rb +2 -2
- data/spec/lib/query/allocation_spec.rb +1 -1
- data/spec/lib/query/allocations_spec.rb +1 -1
- data/spec/lib/query/combination_spec.rb +4 -4
- data/spec/lib/query/combinations/base_spec.rb +1 -1
- data/spec/lib/query/combinations/memory_spec.rb +1 -1
- data/spec/lib/query/combinations/redis_spec.rb +1 -1
- data/spec/lib/query/indexes_spec.rb +7 -2
- data/spec/lib/query/qualifier_category_mapper_spec.rb +34 -0
- data/spec/lib/query/token_spec.rb +32 -53
- data/spec/lib/query/tokens_spec.rb +30 -35
- data/spec/lib/query/weights_spec.rb +16 -16
- data/spec/lib/rack/harakiri_spec.rb +5 -5
- data/spec/lib/results_spec.rb +1 -1
- data/spec/lib/search_spec.rb +24 -22
- data/spec/lib/sinatra_spec.rb +36 -0
- data/spec/lib/sources/base_spec.rb +1 -1
- data/spec/lib/sources/couch_spec.rb +9 -9
- data/spec/lib/sources/csv_spec.rb +7 -7
- data/spec/lib/sources/db_spec.rb +2 -2
- data/spec/lib/sources/delicious_spec.rb +5 -5
- data/spec/lib/sources/mongo_spec.rb +7 -7
- data/spec/lib/sources/wrappers/base_spec.rb +2 -2
- data/spec/lib/sources/wrappers/location_spec.rb +1 -1
- data/spec/lib/statistics_spec.rb +1 -1
- data/spec/lib/tokenizers/base_spec.rb +2 -2
- data/spec/lib/tokenizers/index_spec.rb +1 -1
- data/spec/lib/tokenizers/query_spec.rb +1 -1
- metadata +30 -30
- data/lib/picky/adapters/rack/query.rb +0 -65
- data/lib/picky/index/base.rb +0 -409
- data/lib/picky/index/base_indexed.rb +0 -29
- data/lib/picky/index/base_indexing.rb +0 -127
- data/lib/picky/index/memory.rb +0 -16
- data/lib/picky/index/redis.rb +0 -16
- data/lib/picky/query/qualifiers.rb +0 -76
- data/lib/picky/query/solr.rb +0 -60
- data/lib/picky/signals.rb +0 -8
- data/lib/picky-tasks.rb +0 -6
- data/lib/tasks/spec.rake +0 -11
- data/spec/lib/query/qualifiers_spec.rb +0 -31
data/lib/picky/loader.rb
CHANGED
@@ -1,322 +1,285 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
module Loader # :nodoc:all
|
1
|
+
module Picky
|
4
2
|
|
5
|
-
#
|
6
|
-
# First itself, then the app.
|
3
|
+
# Loads the search engine and itself.
|
7
4
|
#
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
exclaim 'Loader loading itself.'
|
22
|
-
load __FILE__
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.load_relative filename_without_rb
|
26
|
-
load File.join(File.dirname(__FILE__), "#{filename_without_rb}.rb")
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.load_user filename
|
30
|
-
load File.join(PICKY_ROOT, "#{filename}.rb")
|
31
|
-
end
|
32
|
-
def self.load_user_lib filename
|
33
|
-
load_user File.join('lib', filename)
|
34
|
-
end
|
35
|
-
def self.load_all_user_in dirname
|
36
|
-
Dir[File.join(PICKY_ROOT, dirname, '**', '*.rb')].each do |filename|
|
37
|
-
load filename
|
5
|
+
module Loader # :nodoc:all
|
6
|
+
|
7
|
+
# Reloads the whole app.
|
8
|
+
# First itself, then the app.
|
9
|
+
#
|
10
|
+
def self.reload
|
11
|
+
Dir.chdir PICKY_ROOT
|
12
|
+
exclaim 'Reloading loader.'
|
13
|
+
load_self
|
14
|
+
exclaim 'Reloading framework.'
|
15
|
+
load_framework
|
16
|
+
exclaim 'Reloading application.'
|
17
|
+
load_application
|
38
18
|
end
|
39
|
-
end
|
40
19
|
|
41
|
-
|
42
|
-
#
|
43
|
-
def self.load_application
|
44
|
-
# Add lib dir to load path.
|
20
|
+
# Loads this file anew.
|
45
21
|
#
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
#
|
50
|
-
begin
|
51
|
-
load_all_user_in 'lib/initializers'
|
52
|
-
load_all_user_in 'lib/tokenizers'
|
53
|
-
load_all_user_in 'lib/indexers'
|
54
|
-
load_all_user_in 'lib/query'
|
55
|
-
rescue NameError => name_error
|
56
|
-
namespaced_class_name = name_error.message.gsub /^uninitialized\sconstant\s/, ''
|
57
|
-
load_user_lib namespaced_class_name.underscore # Try it once.
|
58
|
-
retry
|
22
|
+
def self.load_self
|
23
|
+
exclaim 'Loader loading itself.'
|
24
|
+
load __FILE__
|
59
25
|
end
|
60
26
|
|
61
|
-
#
|
62
|
-
#
|
63
|
-
# TODO Application.prepare_for_reload
|
64
|
-
|
65
|
-
# Load the user's config.
|
66
|
-
#
|
67
|
-
load_user 'app/logging'
|
68
|
-
load_user 'app/application'
|
69
|
-
|
70
|
-
# Finalize the applications.
|
71
|
-
#
|
72
|
-
Application.finalize_apps
|
73
|
-
|
74
|
-
# TODO Rewrite
|
75
|
-
#
|
76
|
-
Query::Qualifiers.instance.prepare
|
77
|
-
|
78
|
-
exclaim "Application #{Application.apps.map(&:name).join(', ')} loaded."
|
79
|
-
end
|
80
|
-
|
81
|
-
# Loads the internal parts of the framework.
|
82
|
-
# (Not for the user)
|
83
|
-
#
|
84
|
-
def self.load_framework_internals
|
85
|
-
# Load compiled C code.
|
86
|
-
#
|
87
|
-
load_relative 'ext/maybe_compile'
|
88
|
-
|
89
|
-
# Load extensions.
|
90
|
-
#
|
91
|
-
load_relative 'extensions/object'
|
92
|
-
load_relative 'extensions/array'
|
93
|
-
load_relative 'extensions/symbol'
|
94
|
-
load_relative 'extensions/module'
|
95
|
-
load_relative 'extensions/class'
|
96
|
-
load_relative 'extensions/hash'
|
97
|
-
|
98
|
-
# Requiring Helpers
|
99
|
-
#
|
100
|
-
load_relative 'helpers/measuring'
|
101
|
-
|
102
|
-
# Calculations.
|
103
|
-
#
|
104
|
-
load_relative 'calculations/location'
|
105
|
-
|
106
|
-
# Index generation strategies.
|
107
|
-
#
|
108
|
-
load_relative 'indexers/base'
|
109
|
-
load_relative 'indexers/serial'
|
110
|
-
load_relative 'indexers/parallel'
|
111
|
-
|
112
|
-
# Generators.
|
113
|
-
#
|
114
|
-
load_relative 'generators/strategy'
|
115
|
-
|
116
|
-
# Partial index generation strategies.
|
117
|
-
#
|
118
|
-
load_relative 'generators/partial/strategy'
|
119
|
-
load_relative 'generators/partial/none'
|
120
|
-
load_relative 'generators/partial/substring'
|
121
|
-
load_relative 'generators/partial/default'
|
122
|
-
|
123
|
-
# Weight index generation strategies.
|
124
|
-
#
|
125
|
-
load_relative 'generators/weights/strategy'
|
126
|
-
load_relative 'generators/weights/logarithmic'
|
127
|
-
load_relative 'generators/weights/default'
|
128
|
-
|
129
|
-
# Similarity index generation strategies.
|
130
|
-
#
|
131
|
-
load_relative 'generators/similarity/strategy'
|
132
|
-
load_relative 'generators/similarity/none'
|
133
|
-
load_relative 'generators/similarity/phonetic'
|
134
|
-
load_relative 'generators/similarity/metaphone'
|
135
|
-
load_relative 'generators/similarity/double_metaphone'
|
136
|
-
load_relative 'generators/similarity/soundex'
|
137
|
-
load_relative 'generators/similarity/default'
|
138
|
-
|
139
|
-
# Index generators.
|
140
|
-
#
|
141
|
-
load_relative 'generators/base'
|
142
|
-
load_relative 'generators/partial_generator'
|
143
|
-
load_relative 'generators/weights_generator'
|
144
|
-
load_relative 'generators/similarity_generator'
|
145
|
-
|
146
|
-
# Index store handling.
|
147
|
-
#
|
148
|
-
load_relative 'backend/base'
|
149
|
-
|
150
|
-
load_relative 'backend/redis'
|
151
|
-
load_relative 'backend/redis/basic'
|
152
|
-
load_relative 'backend/redis/list_hash'
|
153
|
-
load_relative 'backend/redis/string_hash'
|
154
|
-
|
155
|
-
load_relative 'backend/file/basic'
|
156
|
-
load_relative 'backend/file/text'
|
157
|
-
load_relative 'backend/file/marshal'
|
158
|
-
load_relative 'backend/file/json'
|
159
|
-
|
160
|
-
load_relative 'backend/files'
|
161
|
-
|
162
|
-
# Indexing and Indexed things.
|
163
|
-
#
|
164
|
-
load_relative 'bundle'
|
165
|
-
|
166
|
-
load_relative 'indexing/bundle/base'
|
167
|
-
load_relative 'indexing/bundle/memory'
|
168
|
-
load_relative 'indexing/bundle/redis'
|
169
|
-
|
170
|
-
load_relative 'indexing/wrappers/category/location'
|
171
|
-
|
172
|
-
load_relative 'indexed/bundle/base'
|
173
|
-
load_relative 'indexed/bundle/memory'
|
174
|
-
load_relative 'indexed/bundle/redis'
|
175
|
-
|
176
|
-
load_relative 'indexed/wrappers/exact_first'
|
177
|
-
|
178
|
-
# Bundle Wrapper
|
27
|
+
# Load a file relative to this.
|
179
28
|
#
|
180
|
-
load_relative
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
load_relative 'indexed/wrappers/category/location'
|
185
|
-
|
186
|
-
# Tokens.
|
187
|
-
#
|
188
|
-
load_relative 'query/token'
|
189
|
-
load_relative 'query/tokens'
|
190
|
-
|
191
|
-
# Tokenizers types.
|
192
|
-
#
|
193
|
-
load_relative 'tokenizers/base'
|
194
|
-
load_relative 'tokenizers/index'
|
195
|
-
load_relative 'tokenizers/query'
|
196
|
-
|
197
|
-
# Query combinations, qualifiers, weigher.
|
198
|
-
#
|
199
|
-
load_relative 'query/combination'
|
200
|
-
load_relative 'query/combinations/base'
|
201
|
-
load_relative 'query/combinations/memory'
|
202
|
-
load_relative 'query/combinations/redis'
|
203
|
-
|
204
|
-
load_relative 'query/allocation'
|
205
|
-
load_relative 'query/allocations'
|
206
|
-
|
207
|
-
load_relative 'query/qualifiers'
|
208
|
-
|
209
|
-
load_relative 'query/weights'
|
210
|
-
|
211
|
-
load_relative 'query/indexes'
|
212
|
-
|
213
|
-
# Configuration.
|
214
|
-
#
|
215
|
-
# load_internals 'configuration/index'
|
216
|
-
|
217
|
-
# Adapters.
|
218
|
-
#
|
219
|
-
load_relative 'adapters/rack/base'
|
220
|
-
load_relative 'adapters/rack/query'
|
221
|
-
load_relative 'adapters/rack/live_parameters'
|
222
|
-
load_relative 'adapters/rack'
|
223
|
-
|
224
|
-
# Routing.
|
225
|
-
#
|
226
|
-
load_relative 'frontend_adapters/rack'
|
227
|
-
end
|
228
|
-
# Loads the user interface parts.
|
229
|
-
#
|
230
|
-
def self.load_user_interface
|
231
|
-
# Load harakiri.
|
232
|
-
#
|
233
|
-
load_relative 'rack/harakiri'
|
234
|
-
|
235
|
-
# Errors.
|
236
|
-
#
|
237
|
-
load_relative 'no_source_specified_exception'
|
238
|
-
|
239
|
-
# Load analyzer.
|
240
|
-
#
|
241
|
-
load_relative 'analyzer'
|
242
|
-
|
243
|
-
# Character Substituters
|
244
|
-
#
|
245
|
-
load_relative 'character_substituters/west_european'
|
246
|
-
|
247
|
-
# Signal handling
|
248
|
-
#
|
249
|
-
load_relative 'signals'
|
250
|
-
|
251
|
-
# Logging.
|
252
|
-
#
|
253
|
-
load_relative 'loggers/search'
|
254
|
-
|
255
|
-
# Convenience accessors for generators.
|
256
|
-
#
|
257
|
-
load_relative 'generators/aliases'
|
258
|
-
|
259
|
-
# API.
|
260
|
-
#
|
261
|
-
load_relative 'category'
|
262
|
-
load_relative 'category_indexed'
|
263
|
-
load_relative 'category_indexing'
|
264
|
-
|
265
|
-
load_relative 'categories'
|
266
|
-
load_relative 'categories_indexed'
|
267
|
-
load_relative 'categories_indexing'
|
268
|
-
|
269
|
-
load_relative 'index/base'
|
270
|
-
load_relative 'index/base_indexed'
|
271
|
-
load_relative 'index/base_indexing'
|
272
|
-
load_relative 'index/memory'
|
273
|
-
load_relative 'index/redis'
|
274
|
-
|
275
|
-
load_relative 'indexes'
|
276
|
-
load_relative 'indexes_indexed'
|
277
|
-
load_relative 'indexes_indexing'
|
278
|
-
|
279
|
-
# Results.
|
280
|
-
#
|
281
|
-
load_relative 'results'
|
282
|
-
|
283
|
-
# Search.
|
284
|
-
#
|
285
|
-
load_relative 'search'
|
286
|
-
load_relative 'query'
|
287
|
-
#
|
288
|
-
# load_relative 'query/solr'
|
29
|
+
def self.load_relative filename_without_rb
|
30
|
+
load File.join(File.dirname(__FILE__), "#{filename_without_rb}.rb")
|
31
|
+
end
|
289
32
|
|
290
|
-
#
|
33
|
+
# Load a user file.
|
291
34
|
#
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
load_relative 'sources/couch'
|
297
|
-
load_relative 'sources/mongo'
|
298
|
-
|
299
|
-
load_relative 'sources/wrappers/base'
|
300
|
-
load_relative 'sources/wrappers/location'
|
35
|
+
def self.load_user filename
|
36
|
+
file_name = File.join PICKY_ROOT, "#{filename}.rb"
|
37
|
+
load file_name if File.exists? file_name
|
38
|
+
end
|
301
39
|
|
302
|
-
#
|
40
|
+
# Load the user's application.
|
303
41
|
#
|
304
|
-
|
42
|
+
def self.load_application
|
43
|
+
Application.reload
|
44
|
+
end
|
305
45
|
|
306
|
-
#
|
307
|
-
#
|
308
|
-
|
46
|
+
# Loads the internal parts of the framework.
|
47
|
+
# (Not for the user)
|
48
|
+
#
|
49
|
+
def self.load_framework_internals
|
50
|
+
# Load compiled C code.
|
51
|
+
#
|
52
|
+
load_relative 'ext/maybe_compile'
|
53
|
+
|
54
|
+
# Load extensions.
|
55
|
+
#
|
56
|
+
load_relative 'extensions/object'
|
57
|
+
load_relative 'extensions/array'
|
58
|
+
load_relative 'extensions/symbol'
|
59
|
+
load_relative 'extensions/module'
|
60
|
+
load_relative 'extensions/class'
|
61
|
+
load_relative 'extensions/hash'
|
62
|
+
|
63
|
+
# Requiring Helpers
|
64
|
+
#
|
65
|
+
load_relative 'helpers/measuring'
|
66
|
+
|
67
|
+
# Calculations.
|
68
|
+
#
|
69
|
+
load_relative 'calculations/location'
|
70
|
+
|
71
|
+
# Index generation strategies.
|
72
|
+
#
|
73
|
+
load_relative 'indexers/base'
|
74
|
+
load_relative 'indexers/serial'
|
75
|
+
load_relative 'indexers/parallel'
|
76
|
+
|
77
|
+
# Generators.
|
78
|
+
#
|
79
|
+
load_relative 'generators/strategy'
|
80
|
+
|
81
|
+
# Partial index generation strategies.
|
82
|
+
#
|
83
|
+
load_relative 'generators/partial/strategy'
|
84
|
+
load_relative 'generators/partial/none'
|
85
|
+
load_relative 'generators/partial/substring'
|
86
|
+
load_relative 'generators/partial/default'
|
87
|
+
|
88
|
+
# Weight index generation strategies.
|
89
|
+
#
|
90
|
+
load_relative 'generators/weights/strategy'
|
91
|
+
load_relative 'generators/weights/logarithmic'
|
92
|
+
load_relative 'generators/weights/default'
|
93
|
+
|
94
|
+
# Similarity index generation strategies.
|
95
|
+
#
|
96
|
+
load_relative 'generators/similarity/strategy'
|
97
|
+
load_relative 'generators/similarity/none'
|
98
|
+
load_relative 'generators/similarity/phonetic'
|
99
|
+
load_relative 'generators/similarity/metaphone'
|
100
|
+
load_relative 'generators/similarity/double_metaphone'
|
101
|
+
load_relative 'generators/similarity/soundex'
|
102
|
+
load_relative 'generators/similarity/default'
|
103
|
+
|
104
|
+
# Index generators.
|
105
|
+
#
|
106
|
+
load_relative 'generators/base'
|
107
|
+
load_relative 'generators/partial_generator'
|
108
|
+
load_relative 'generators/weights_generator'
|
109
|
+
load_relative 'generators/similarity_generator'
|
110
|
+
|
111
|
+
# Index store handling.
|
112
|
+
#
|
113
|
+
load_relative 'backend/base'
|
114
|
+
|
115
|
+
load_relative 'backend/redis'
|
116
|
+
load_relative 'backend/redis/basic'
|
117
|
+
load_relative 'backend/redis/list_hash'
|
118
|
+
load_relative 'backend/redis/string_hash'
|
119
|
+
|
120
|
+
load_relative 'backend/file/basic'
|
121
|
+
load_relative 'backend/file/text'
|
122
|
+
load_relative 'backend/file/marshal'
|
123
|
+
load_relative 'backend/file/json'
|
124
|
+
|
125
|
+
load_relative 'backend/files'
|
126
|
+
|
127
|
+
# Indexing and Indexed things.
|
128
|
+
#
|
129
|
+
load_relative 'bundle'
|
130
|
+
|
131
|
+
load_relative 'indexing/bundle/base'
|
132
|
+
load_relative 'indexing/bundle/memory'
|
133
|
+
load_relative 'indexing/bundle/redis'
|
134
|
+
|
135
|
+
load_relative 'indexing/wrappers/category/location'
|
136
|
+
|
137
|
+
load_relative 'indexed/bundle/base'
|
138
|
+
load_relative 'indexed/bundle/memory'
|
139
|
+
load_relative 'indexed/bundle/redis'
|
140
|
+
|
141
|
+
load_relative 'indexed/wrappers/exact_first'
|
142
|
+
|
143
|
+
# Bundle Wrapper
|
144
|
+
#
|
145
|
+
load_relative 'indexed/wrappers/bundle/wrapper'
|
146
|
+
load_relative 'indexed/wrappers/bundle/calculation'
|
147
|
+
load_relative 'indexed/wrappers/bundle/location'
|
148
|
+
|
149
|
+
load_relative 'indexed/wrappers/category/location'
|
150
|
+
|
151
|
+
# Tokens.
|
152
|
+
#
|
153
|
+
load_relative 'query/token'
|
154
|
+
load_relative 'query/tokens'
|
155
|
+
|
156
|
+
# Tokenizers types.
|
157
|
+
#
|
158
|
+
load_relative 'tokenizers/base'
|
159
|
+
load_relative 'tokenizers/index'
|
160
|
+
load_relative 'tokenizers/query'
|
161
|
+
|
162
|
+
# Query combinations, qualifiers, weigher.
|
163
|
+
#
|
164
|
+
load_relative 'query/combination'
|
165
|
+
load_relative 'query/combinations/base'
|
166
|
+
load_relative 'query/combinations/memory'
|
167
|
+
load_relative 'query/combinations/redis'
|
168
|
+
|
169
|
+
load_relative 'query/allocation'
|
170
|
+
load_relative 'query/allocations'
|
171
|
+
|
172
|
+
load_relative 'query/qualifier_category_mapper'
|
173
|
+
|
174
|
+
load_relative 'query/weights'
|
175
|
+
|
176
|
+
load_relative 'query/indexes'
|
177
|
+
|
178
|
+
# Configuration.
|
179
|
+
#
|
180
|
+
# load_internals 'configuration/index'
|
181
|
+
|
182
|
+
# Adapters.
|
183
|
+
#
|
184
|
+
load_relative 'adapters/rack/base'
|
185
|
+
load_relative 'adapters/rack/search'
|
186
|
+
load_relative 'adapters/rack/live_parameters'
|
187
|
+
load_relative 'adapters/rack'
|
188
|
+
|
189
|
+
# Routing.
|
190
|
+
#
|
191
|
+
load_relative 'frontend_adapters/rack'
|
192
|
+
end
|
193
|
+
# Loads the user interface parts.
|
194
|
+
#
|
195
|
+
def self.load_user_interface
|
196
|
+
# Load harakiri.
|
197
|
+
#
|
198
|
+
load_relative 'rack/harakiri'
|
199
|
+
|
200
|
+
# Errors.
|
201
|
+
#
|
202
|
+
load_relative 'no_source_specified_exception'
|
203
|
+
|
204
|
+
# Load analyzer.
|
205
|
+
#
|
206
|
+
load_relative 'analyzer'
|
207
|
+
|
208
|
+
# Character Substituters
|
209
|
+
#
|
210
|
+
load_relative 'character_substituters/west_european'
|
211
|
+
|
212
|
+
# Logging.
|
213
|
+
#
|
214
|
+
load_relative 'loggers/search'
|
215
|
+
|
216
|
+
# Convenience accessors for generators.
|
217
|
+
#
|
218
|
+
load_relative 'generators/aliases'
|
219
|
+
|
220
|
+
# API.
|
221
|
+
#
|
222
|
+
load_relative 'category'
|
223
|
+
load_relative 'category_indexed'
|
224
|
+
load_relative 'category_indexing'
|
225
|
+
|
226
|
+
load_relative 'categories'
|
227
|
+
load_relative 'categories_indexed'
|
228
|
+
load_relative 'categories_indexing'
|
229
|
+
|
230
|
+
load_relative 'indexes'
|
231
|
+
load_relative 'indexes_indexed'
|
232
|
+
load_relative 'indexes_indexing'
|
233
|
+
|
234
|
+
load_relative 'indexes/index'
|
235
|
+
load_relative 'indexes/index_indexed'
|
236
|
+
load_relative 'indexes/index_indexing'
|
237
|
+
load_relative 'indexes/memory'
|
238
|
+
load_relative 'indexes/redis'
|
239
|
+
|
240
|
+
# Results.
|
241
|
+
#
|
242
|
+
load_relative 'results'
|
243
|
+
|
244
|
+
# Search.
|
245
|
+
#
|
246
|
+
load_relative 'search'
|
247
|
+
load_relative 'query'
|
248
|
+
#
|
249
|
+
# load_relative 'query/solr'
|
250
|
+
|
251
|
+
# Sources.
|
252
|
+
#
|
253
|
+
load_relative 'sources/base'
|
254
|
+
load_relative 'sources/db'
|
255
|
+
load_relative 'sources/csv'
|
256
|
+
load_relative 'sources/delicious'
|
257
|
+
load_relative 'sources/couch'
|
258
|
+
load_relative 'sources/mongo'
|
259
|
+
|
260
|
+
load_relative 'sources/wrappers/base'
|
261
|
+
load_relative 'sources/wrappers/location'
|
262
|
+
|
263
|
+
# Interfaces
|
264
|
+
#
|
265
|
+
load_relative 'interfaces/live_parameters'
|
266
|
+
|
267
|
+
# Application.
|
268
|
+
#
|
269
|
+
load_relative 'application'
|
270
|
+
|
271
|
+
# Load tools. Load in specific case?
|
272
|
+
#
|
273
|
+
load_relative 'cores'
|
274
|
+
end
|
309
275
|
|
310
|
-
#
|
276
|
+
# Loads the framework.
|
311
277
|
#
|
312
|
-
|
313
|
-
|
278
|
+
def self.load_framework
|
279
|
+
load_framework_internals
|
280
|
+
load_user_interface
|
281
|
+
end
|
314
282
|
|
315
|
-
# Loads the framework.
|
316
|
-
#
|
317
|
-
def self.load_framework
|
318
|
-
load_framework_internals
|
319
|
-
load_user_interface
|
320
283
|
end
|
321
284
|
|
322
|
-
end
|
285
|
+
end
|
data/lib/picky/loggers/search.rb
CHANGED
@@ -1,19 +1,26 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
#
|
3
|
-
module
|
4
|
-
|
3
|
+
module Picky
|
4
|
+
|
5
|
+
# TODO Remove?
|
5
6
|
#
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
module Loggers # :nodoc:all
|
8
|
+
|
9
|
+
# Log Proxy
|
10
|
+
#
|
11
|
+
class Search
|
12
|
+
|
13
|
+
attr_reader :logger
|
14
|
+
|
15
|
+
def initialize logger
|
16
|
+
@logger = logger
|
17
|
+
end
|
18
|
+
|
19
|
+
def log message
|
20
|
+
logger.info message
|
21
|
+
end
|
22
|
+
|
12
23
|
end
|
13
|
-
|
14
|
-
def log message
|
15
|
-
logger.info message
|
16
|
-
end
|
17
|
-
|
18
24
|
end
|
25
|
+
|
19
26
|
end
|