0

I have an autocomplete SearchView that is managed throught Search API and shows a list of locations as suggestions. The data is provided by a ContentProvider in a remote GAE application.

The problem that I've is that the SearchView makes a query for every letter that the user press.

For example for New York it makes 8 queries and I want to limit that because a lot of the queries are wasted because network latency is bigger than user typing latency and for example 'New' is asked before receiving 'Ne'.

I will like a more intelligent behavior like other search components that have some logic to don't do so many queries while the user is actively typing.

PD: A solution using Searchable API or the provider will be better because I use SearchView in newer Android versions and search dialog in older ones.

lujop
  • 12,544
  • 9
  • 55
  • 90

1 Answers1

0

You could at least limit the minimum number of characters typed for starting the search by specifying:

android:searchSuggestThreshold

in the searchable configuration

gwvatieri
  • 5,023
  • 1
  • 27
  • 29
  • I already knew it. But it's not what I want. In fact I've it to zero because I show some especial suggestions when there isn't any text. – lujop Jan 31 '13 at 22:55
  • 1
    What I do to limit the number of requests I make is caching the results, especially considering that when users tapes they go forth and back a lot so I always first check the cache and eventually hit the server. The cache is also good because if a user misspell a word I return results going back in the cache. – gwvatieri Feb 01 '13 at 00:08