Bytecode
Bytecode

Reputation: 6591

Android fast searching

am using fts3 tabele for searching my problem is, I have invoking search in textWatch listener of the EditText, when I type 'a' it start search for 'a', then I type 'b' it search for 'ab' only after the result of 'a' comes, how can I solve this issue, that means when I type 'b', it stop searching of 'a' and start searching of 'ab' . Currently my search slow because of this issue, please help me.

Upvotes: 1

Views: 529

Answers (2)

Mojo Risin
Mojo Risin

Reputation: 8142

There are few things you can try to optimize your query.

  1. Check out sqlite docs for how to optimize LIKE statements
  2. Make sure you have indexes on the rows you'll perform filtering
  3. If still not working fast enough try to do some precomputation or build some data structure to restrict the search set

Upvotes: 1

Heiko Rupp
Heiko Rupp

Reputation: 30974

Is the column you are searching in indexed? Adding an index will make a huge difference.

Otherwise/in addition, you should enable profiling the code and look at it with traceview to better understand where the time is really spent.

Upvotes: 0

Related Questions