Skip to content

Commit 048aebb

Browse files
committed
Search Result Uniqueness
SeeRM rapid7#8754 Cast the results of the query to an array and perform the uniq function passing a block which provides uniqueness based on the return value, which in this instance is ‘fullname’ This was done because the uniq function in AREL cannot take a specific field for uniqueness, and the sophistication of the query make grouping nearly impossible. Initial testing showed negligible speed difference to the user.
1 parent b85403a commit 048aebb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/msf/core/db_manager.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ def search_modules(search_string)
678678
union.or(condition)
679679
}
680680

681-
query = query.where(unioned_conditions).uniq
681+
query = query.where(unioned_conditions).to_a.uniq { |m| m.fullname }
682682
end
683683

684684
query

0 commit comments

Comments
 (0)