8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/rbbt/workflow/rest/finder.rb', line 8
def finder_find(term)
results = settings.finder.find(term)
results.uniq.collect{|r|
info = r.info
format_string = [info[:namespace], info[:format]].compact * ":"
info[:code] = r
if not format_string.empty?
info[:value] = r + " [#{format_string}]"
else
info[:value] = r
end
score = info.delete :score
if Array === score
info[:score] = score[0]
info[:best] = score[1]
end
info
}.sort_by{|i| i[:score] || 0}.reverse
end
|