Skip to content

Commit f1d02b6

Browse files
committed
rm !$
1 parent 30ebf4c commit f1d02b6

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

fastlite/db.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import pathlib
1616
import re
1717
import secrets
18-
from sqlite_fts4 import rank_bm25 # type: ignore
1918
import textwrap
2019
from typing import ( cast, Any, Callable, Dict, Generator, Iterable, Union, Optional, List, Tuple,)
2120
import uuid
@@ -385,10 +384,6 @@ def register(fn):
385384
else:
386385
register(fn)
387386

388-
def register_fts4_bm25(self):
389-
"Register the ``rank_bm25(match_info)`` function used for calculating relevance with SQLite FTS4."
390-
self.register_function(rank_bm25, deterministic=True, replace=True)
391-
392387
def attach(self, alias: str, filepath: Union[str, pathlib.Path]):
393388
"""
394389
Attach another SQLite database file to this connection with the specified alias, equivalent to::
@@ -516,16 +511,13 @@ def quote_default_value(self, value: str) -> str:
516511

517512
return self.quote(value)
518513

519-
def table_names(self, fts4: bool = False, fts5: bool = False) -> List[str]:
514+
def table_names(self, fts5: bool = False) -> List[str]:
520515
"""
521516
List of string table names in this database.
522517
523-
:param fts4: Only return tables that are part of FTS4 indexes
524518
:param fts5: Only return tables that are part of FTS5 indexes
525519
"""
526520
where = ["type = 'table'"]
527-
if fts4:
528-
where.append("sql like '%USING FTS4%'")
529521
if fts5:
530522
where.append("sql like '%USING FTS5%'")
531523
sql = "select name from sqlite_master where {}".format(" AND ".join(where))
@@ -2525,11 +2517,6 @@ def search_sql(
25252517
).strip()
25262518
if virtual_table_using == "FTS5":
25272519
rank_implementation = "[{}].rank".format(fts_table)
2528-
else:
2529-
self.db.register_fts4_bm25()
2530-
rank_implementation = "rank_bm25(matchinfo([{}], 'pcnalx'))".format(
2531-
fts_table
2532-
)
25332520
if include_rank:
25342521
columns_with_prefix_sql += ",\n " + rank_implementation + " rank"
25352522
limit_offset = ""

0 commit comments

Comments
 (0)