db.quote_fts() method, thanks Mark Neumann

Refs #296, closes #246.
This commit is contained in:
Mark Neumann 2021-08-18 19:43:11 +01:00 committed by GitHub
commit 53fec0d863
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 0 deletions

View file

@ -501,3 +501,14 @@ def test_search_sql(kwargs, fts, expected):
db["books"].enable_fts(["title", "author"], fts_version=fts)
sql = db["books"].search_sql(**kwargs)
assert sql == expected
def test_quote_fts_query(fresh_db):
table = fresh_db["searchable"]
table.insert_all(search_records)
table.enable_fts(["text", "country"])
query = "cat's"
result = fresh_db.quote_fts(query)
# Executing query does not crash.
list(table.search(result))