Documentation for create-triggers, refs #57

This commit is contained in:
Simon Willison 2019-09-02 17:10:26 -07:00
commit 3a4dddaca2
2 changed files with 10 additions and 0 deletions

View file

@ -907,6 +907,12 @@ If you insert additional records into the table you will need to refresh the sea
}, pk="id")
dogs.populate_fts(["name", "twitter"])
A better solution is to use database triggers. You can set up database triggers to automatically update the full-text index using ``create_triggers=True``:
.. code-block:: python
dogs.enable_fts(["name", "twitter"], create_triggers=True)
``.enable_fts()`` defaults to using `FTS5 <https://www.sqlite.org/fts5.html>`__. If you wish to use `FTS4 <https://www.sqlite.org/fts3.html>`__ instead, use the following:
.. code-block:: python