Indeed merging the two sites would do, as documented here:
In your case you would add both https://domain.xy.com and https://sitesearchdomain.xy.com in the edit field of Site or app address
In Tag Manager navigate to the Piwik PRO tag and enable the switch Recognize a visitor across subsites
Store cookie on this domain would have the value of .xy.com