Skip to content

Conversation

@callmephilip
Copy link

@callmephilip callmephilip commented Aug 31, 2024

I am not able to use full-text search functionality at the moment. As far as I can tell, the issue coming from detect_fts which returns None.

Some further investigation:

import textwrap

sql = textwrap.dedent(
    """
    SELECT name FROM sqlite_master
        WHERE rootpage = 0
        AND (
            sql LIKE :like
            OR sql LIKE :like2
            OR (
                tbl_name = :table
                AND sql LIKE '%VIRTUAL TABLE%USING FTS%'
            )
        )
"""
).strip()
args = {
    "like": "%VIRTUAL TABLE%USING FTS%content=[{}]%".format(notes.name),
    "like2": '%VIRTUAL TABLE%USING FTS%content="{}"%'.format(notes.name),
    "table": notes.name,
}

# this returns []
db.execute(sql, args).fetchall()

# this returns
# [('notes',),
# ('notes_fts',),
# ('notes_fts_data',),
# ('notes_fts_idx',),
# ('notes_fts_docsize',),
# ('notes_fts_config',),
# ('notes_ai',),
# ('notes_ad',),
# ('notes_au',)]
list(db.execute("SELECT name FROM sqlite_master"))

sql for notes_fts looks as follows:

'CREATE VIRTUAL TABLE [notes_fts] USING FTS5 (\n    [content],\n    content=[notes]\n)'

I'm happy to submit a fix but I don't think I fully understand where the issue is

@kalch
Copy link

kalch commented Sep 12, 2024

Put it in issues Philip?

@callmephilip
Copy link
Author

Put it in issues Philip?

yeah, probably not a bad idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants