It's a little hard to debug this without any code examples, but just to confirm your usage of shouldClearFilters, are you definitely doing this?
setSearchTerm("", { shouldClearFilters: false });
As for "query is removed from url" - this is expected behavior. The query string in the URL is tied to the browser input. If you don't want this, you need to configure your SearchProvider with trackUrlState: false (although this again has other UX implications - see the docs description).
I'm finding it a little hard to follow your use-case / desired user experience - what may work for you is a custom search input (separate from the default one that comes OOTB from Search UI) that you can "clear" visually without actually triggering an onSearch event.
The requeriment was to clear the search input without affecting the application state, and setting the HTML input to type search added the "x" mark and solved the problem.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.