include_rank parameter for Table.search

* Add `include_rank` parameter to `Table.search`
* Test for .search(include_rank)
* Docs for table.search(include_rank)

https://github.com/simonw/sqlite-utils/pull/628

Refs #480

---------

Co-authored-by: Simon Willison <swillison@gmail.com>
This commit is contained in:
liunux4odoo 2024-11-24 04:34:27 +08:00 committed by GitHub
commit 7423296ec7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 33 additions and 0 deletions

View file

@ -2678,6 +2678,7 @@ class Table(Queryable):
offset: Optional[int] = None,
where: Optional[str] = None,
where_args: Optional[Union[Iterable, dict]] = None,
include_rank: bool = False,
quote: bool = False,
) -> Generator[dict, None, None]:
"""
@ -2691,6 +2692,7 @@ class Table(Queryable):
:param offset: Optional integer SQL offset.
:param where: Extra SQL fragment for the WHERE clause
:param where_args: Arguments to use for :param placeholders in the extra WHERE clause
:param include_rank: Select the search rank column in the final query
:param quote: Apply quoting to disable any special characters in the search query
See :ref:`python_api_fts_search`.
@ -2710,6 +2712,7 @@ class Table(Queryable):
limit=limit,
offset=offset,
where=where,
include_rank=include_rank,
),
args,
)