Skip to content

Commit 41234d8

Browse files
committed
Support dynamic variables in ignored allowed groups
Co-author: @madnificent
1 parent 738820e commit 41234d8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/mu_search/index_manager.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,15 @@ def ensure_index_combination_for_groups(type_name, allowed_groups, used_groups =
209209
@logger.debug("INDEX MGMT") { "Trying to combine indexes in cache for type '#{type_name}' to match allowed_groups #{allowed_groups} and used_groups #{used_groups}" }
210210
if !ignored_allowed_groups.empty?
211211
@logger.debug("INDEX MGMT") { "Ignoring the following allowed groups: #{ignored_allowed_groups.inspect}" }
212-
allowed_groups.reject!{ |ag| ignored_allowed_groups.include? ag }
212+
allowed_groups.reject! do |allowed_group|
213+
ignored_allowed_groups.any? do |ignored_allowed_group|
214+
ignored_allowed_group["name"] == allowed_group["name"] \
215+
&& ignored_allowed_group["variables"].length == allowed_group["variables"].length \
216+
&& ignored_allowed_group["variables"].zip(allowed_group["variables"]).all? do |ignored_var, allowed_var|
217+
ignored_var == "*" || ignored_var == allowed_var
218+
end
219+
end
220+
end
213221
end
214222
indexes = @indexes[type_name].values.find_all(&:eager_index?)
215223
@logger.debug("INDEX MGMT") { "Currently known indexes for type '#{type_name}': #{indexes.map(&:allowed_groups).to_json}" }

0 commit comments

Comments
 (0)