Reference: Google Analytic Issue with Search in X theme
Could you include an option to add a custom data- attribute or an ignore flag to the Search Element’s tracking script? Alternatively, ensuring that internal ajax-based searches do not push unneeded history states or trigger page_view virtual events would prevent GA4 from double-counting or incorrectly logging search behaviors.