FTS (full-text search) sqlite how to implement FTS table?

I am trying to create an Android application and want to allow a quick search, so he studied FTS for sqlite for Android. I see how to create it, but wondered:

Table_words - table for words

  • If I create a new FTS table, that is, Table_words_fts - will it replace table_words, will it be added as another table?

  • If I add as another table, am I adding data at the same time to the FTS table, as well as to table_words through my code?

  • If so, can I omit some columns that are not needed and include others that are not in the table_words table?

  • If I just replace the table with number 1, does that affect regular queries?

  • If I do not replace it, but you do not need to store data in a new FTS table, is that just added to read the table faster?

Until now, I understand that this is a separate table, add that I add data to it throughout the code, and I can omit some columns, but not add new ones. Also, the way the data is stored will be exactly the same as I am adding it to other tables ...

Here is my idea to work with it ... Creating a table:

// create FTS tables for quicker matches for search
db.execSQL("CREATE VIRTUAL TABLE " + TABLE_WORDS_FTS + " USING fts3("
    + KEY_ID + ", " + KEY_DICTIONARYID + ", " + KEY_WORD1 + " , "
    + KEY_WORD2 + " , " + KEY_WORD3 + ", " + KEY_WORD4 + " " + ");");

Create a regular table:

// Words table create statement
private static final String CREATE_TABLE_WORDS = "CREATE TABLE "
    + TABLE_WORDS + "(" + KEY_ID + " INTEGER PRIMARY KEY,"
    + KEY_DICTIONARYID + " INTEGER," + KEY_WORD1 + " TEXT," + KEY_WORD2
    + " TEXT," + KEY_WORD3 + " TEXT," + KEY_WORD4 + " TEXT" + ")";
db.execSQL(CREATE_TABLE_WORDS);

I will do the rest in the usual way ... but repeat: try to find out if the table is added in addition to the table? Should it regularly store data?

+3
source share
1 answer
  • Yes, it acts like a regular table; it does not replace existing ones.

  • , FTS, , .

  • , .

  • , . , FTS.

  • , FTS somwhere else; . FTS.

+2

All Articles