Fixing similar tags module query

Only group by m.core_content_id to avoid duplicates. Move "having" to "where", better to filter before grouping where it's possible.
Expanding the filter for the current item to also include the type_alias, otherwise items with the same id but from other extensions would be excluded as well.