Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot create noindexed columns with in sqlite FTS table

I'm trying to create the following table with sqlite 3.8.2

    CREATE VIRTUAL TABLE IF NOT EXISTS media_fts
        USING fts4 (
            notindexed=media_id,
            notindexed=album_id,
            title,
            artist,
            album_artist,
            album,
            comment,
            lyrics
        ) ;

But some reason, the command fails with the following error:

 no such column: media_id

Do you know what is going wrong?

Note : According to this answer, notindexed is supported for 3.8 and above.

like image 211
Name is carl Avatar asked Apr 02 '26 00:04

Name is carl


1 Answers

The notindexed= option is not a column but just an option. So when you want an unindexed column, you still have to list the column itself:

CREATE VIRTUAL TABLE IF NOT EXISTS media_fts
    USING fts4 (
        title,
        artist,
        album_artist,
        album,
        comment,
        lyrics,
        media_id,
        album_id,
        notindexed=media_id,
        notindexed=album_id
    ) ;
like image 79
CL. Avatar answered Apr 03 '26 16:04

CL.