mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-12 19:44:13 +02:00
search_sql add include_rank option
This commit is contained in:
parent
087753cd42
commit
863dd03c67
1 changed files with 3 additions and 0 deletions
|
|
@ -2376,6 +2376,7 @@ class Table(Queryable):
|
|||
limit: Optional[int] = None,
|
||||
offset: Optional[int] = None,
|
||||
where: Optional[str] = None,
|
||||
include_rank: bool = False,
|
||||
) -> str:
|
||||
""" "
|
||||
Return SQL string that can be used to execute searches against this table.
|
||||
|
|
@ -2427,6 +2428,8 @@ class Table(Queryable):
|
|||
rank_implementation = "rank_bm25(matchinfo([{}], 'pcnalx'))".format(
|
||||
fts_table
|
||||
)
|
||||
if include_rank:
|
||||
columns_with_prefix_sql += ",\n " + rank_implementation + " rank"
|
||||
limit_offset = ""
|
||||
if limit is not None:
|
||||
limit_offset += " limit {}".format(limit)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue