Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full-text search seems to be broken #12

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

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