Emergency fix for tags.

They’ll work, but they’ll still be super slow.
remotes/1708105384931250775/master
Luka Vandervelden 2020-04-07 23:29:29 +02:00
parent f8e4e6c343
commit c4223eabf1
1 changed files with 4 additions and 11 deletions

View File

@ -10,22 +10,15 @@ class DODB::Tags(V) < DODB::Indexer(V)
::Dir.mkdir_p indexing_directory
end
# FIXME: Too slow. That `uniq` call alone is a perf eater.
# FIXME: The slow is damn too high.
def tag_combinations(tags)
combinations = [] of Array(String)
previous_tags = [] of String
while tag = tags.shift?
previous_tags.push tag
combinations.push previous_tags.clone
if tags.size > 0
combinations.push tags.clone
end
tags.size.times do |i|
combinations.concat tags.permutations (i+1)
end
combinations.uniq
return combinations
end
def index(key, value)