Search code examples
sqlsqlitefull-text-searchfts3fts4

How to modify languageid column in a SQLite FTS table?


In SQLite FTS tables there is a hidden languageid column that I want to make use of: I need to populate my FTS4 table with rows in two different languages, which I will then distinguish by languageid column.

I create my table with a command like this:

CREATE VIRTUAL TABLE `texts` USING FTS4(`text`, tokenize=unicode61, languageid=`lid`)

Now how can I INSERT a row with a specified languageid if it is a hidden column? Or is there some other way to specify the language used in a row?


Solution

  • So, I had to explicitly specify the languageid column like this (here lid is the name of languageid column):

    INSERT INTO `texts` (`text`,`lid`) VALUES (?,?)
    

    Sidenote: I used Python in IntelliJ IDEA for this and the IDE gave me a Unable to resolve column 'lid' error, but the code still worked.