Fix slow typing in search

Until we have the new search, we can fix the slow typing in the search bar with this PR.

This PR is based on the PR #1671 .