Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lucene vs SQLite Full Text Search for Android Application

My English skill is not good. So please try to understand what I say. Thank you !

I want to create a Android dictionary app but I'm not experienced on it. I did a research and there are 2 choices for creating database: Lucene and SQLite Full Text Search. So I made an app as some tutorials.I find that FTS use a Virtual Table to store database but the probblem is the app freeze when adding data to Virtual Table at the first time (from text file about 10000 line). The searching function also takes long time (about 10 seconds)

Then, I find some others tutorials about Lucene. Lucene create an indexed directory for searching but I do not know how fast it is (with large data). Anyone could give me some advices on my problem?

like image 345
Hoang Lam Avatar asked Apr 02 '14 12:04

Hoang Lam


2 Answers

I have not used Lucene for FTS yet, but you can make a virtual table in SQLite. However, the downside of virtual table in SQLite is that the storage space almost doubles.

"I find that FTS use a Virtual Table to store database but the probblem is the app freeze when adding data to Virtual Table at the first time (from text file about 10000 line). The searching function also takes long time (about 10 seconds) " Alternatively, you can make a virtual table beforehand and just add the sqlite database to the assets folder.

like image 102
John61590 Avatar answered Nov 05 '22 03:11

John61590


I suggest you to use sqlite with fts4. Three strong reason

  1. sqlite is android os feature. it's supported very well in android, and many people use it.
  2. Well extendable, not only fts feature support but other feature support.
  3. if you thing the index building time is two long, just build the index before you build the apk, and put it into asset. 10000 lines wording size db will not take 500ms to copy from asset to /data/data
like image 2
Jimmy Chen Avatar answered Nov 05 '22 01:11

Jimmy Chen