olance/has_machine_tags — Issue #1: :match_all option is very slow!
Author: olance
Created: 2011-10-10 02:49:21+00:00
State: open

I guess the nested requests are way too bad... on a somewhat large database (~130k taggings), searching for objects tagged with only 2 given [machine] tags takes up to 2 minutes on a reasonable machine.

Gotta do something...

Meanwhile, this is very efficient (on the same database!) :
objects = []
string_tag_list.split(",").each do |tag|
matching = Object.tagged_with tag, { :comparison_match => true }
objects.empty? ? objects = matching : objects &= matching
end

# objects now contains all Objects matching all given tags!