I’m not really sure why you post a technical question, if you also post a feature request (showing that you know it’s not possible): Automatic ticket merging + combinable AND/OR logic between attributes for duplicate detection
What kind of answer are you looking for, for your technical question? I’m just trying to understand your expectation.