|
15 | 15 | import pathlib
|
16 | 16 | import re
|
17 | 17 | import secrets
|
18 |
| -from sqlite_fts4 import rank_bm25 # type: ignore |
19 | 18 | import textwrap
|
20 | 19 | from typing import ( cast, Any, Callable, Dict, Generator, Iterable, Union, Optional, List, Tuple,)
|
21 | 20 | import uuid
|
@@ -385,10 +384,6 @@ def register(fn):
|
385 | 384 | else:
|
386 | 385 | register(fn)
|
387 | 386 |
|
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 |
| - |
392 | 387 | def attach(self, alias: str, filepath: Union[str, pathlib.Path]):
|
393 | 388 | """
|
394 | 389 | 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:
|
516 | 511 |
|
517 | 512 | return self.quote(value)
|
518 | 513 |
|
519 |
| - def table_names(self, fts4: bool = False, fts5: bool = False) -> List[str]: |
| 514 | + def table_names(self, fts5: bool = False) -> List[str]: |
520 | 515 | """
|
521 | 516 | List of string table names in this database.
|
522 | 517 |
|
523 |
| - :param fts4: Only return tables that are part of FTS4 indexes |
524 | 518 | :param fts5: Only return tables that are part of FTS5 indexes
|
525 | 519 | """
|
526 | 520 | where = ["type = 'table'"]
|
527 |
| - if fts4: |
528 |
| - where.append("sql like '%USING FTS4%'") |
529 | 521 | if fts5:
|
530 | 522 | where.append("sql like '%USING FTS5%'")
|
531 | 523 | sql = "select name from sqlite_master where {}".format(" AND ".join(where))
|
@@ -2525,11 +2517,6 @@ def search_sql(
|
2525 | 2517 | ).strip()
|
2526 | 2518 | if virtual_table_using == "FTS5":
|
2527 | 2519 | 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 |
| - ) |
2533 | 2520 | if include_rank:
|
2534 | 2521 | columns_with_prefix_sql += ",\n " + rank_implementation + " rank"
|
2535 | 2522 | limit_offset = ""
|
|
0 commit comments