@@ -199,28 +199,19 @@ def search_modules(search_string)
199
199
ActiveRecord ::Base . connection_pool . with_connection do
200
200
@query = Mdm ::Module ::Detail . all
201
201
202
- @authors = Set . new
203
- @names = Set . new
204
- @os = Set . new
205
- @text = Set . new
206
- @types = Set . new
207
- @stances = Set . new
208
- @refs = Set . new
202
+ @archs = Set . new
203
+ @authors = Set . new
204
+ @names = Set . new
205
+ @os = Set . new
206
+ @refs = Set . new
207
+ @stances = Set . new
208
+ @text = Set . new
209
+ @types = Set . new
209
210
210
211
value_set_by_keyword . each do |keyword , value_set |
211
212
formatted_values = match_values ( value_set )
212
213
213
214
case keyword
214
- when 'author'
215
- @authors << formatted_values
216
- when 'name'
217
- @names << formatted_values
218
- when 'os' , 'platform'
219
- @os << formatted_values
220
- when 'text'
221
- @text << formatted_values
222
- when 'type'
223
- @types << formatted_values
224
215
when 'app'
225
216
formatted_values = value_set . collect { |value |
226
217
formatted_value = 'aggressive'
@@ -230,13 +221,26 @@ def search_modules(search_string)
230
221
formatted_value
231
222
}
232
223
@stances << formatted_values
224
+ when 'arch'
225
+ @archs << formatted_values
226
+ when 'author'
227
+ @authors << formatted_values
228
+ when 'name'
229
+ @names << formatted_values
230
+ when 'os' , 'platform'
231
+ @os << formatted_values
233
232
when 'ref'
234
233
@refs << formatted_values
235
234
when 'cve' , 'bid' , 'edb'
236
235
formatted_values = value_set . collect { |value |
237
236
prefix = keyword . upcase
238
237
"#{ prefix } -%#{ value } %"
239
238
}
239
+ @refs << formatted_values
240
+ when 'text'
241
+ @text << formatted_values
242
+ when 'type'
243
+ @types << formatted_values
240
244
end
241
245
end
242
246
@@ -246,13 +250,14 @@ def search_modules(search_string)
246
250
#
247
251
# @query = @query.where(unioned_conditions).to_a.uniq { |m| m.fullname }
248
252
end
249
-
253
+
254
+ @query = @query . module_arch ( @archs . to_a . flatten ) if @archs . any?
250
255
@query = @query . module_author ( @authors . to_a . flatten ) if @authors . any?
251
256
@query = @query . module_name ( @names . to_a . flatten ) if @names . any?
252
257
@query = @query . module_os_or_platform ( @os . to_a . flatten ) if @os . any?
253
258
@query = @query . module_text ( @text . to_a . flatten ) if @text . any?
254
259
@query = @query . module_type ( @types . to_a . flatten ) if @types . any?
255
- @query = @query . module_app ( @stances . to_a . flatten ) if @stances . any?
260
+ @query = @query . module_stance ( @stances . to_a . flatten ) if @stances . any?
256
261
@query = @query . module_ref ( @refs . to_a . flatten ) if @refs . any?
257
262
258
263
@query . uniq
0 commit comments