datasette-search-all by simonw

416 downloads this week        Star

Screenshot of simonw/datasette-search-all

README source code

datasette-search-all

PyPI Changelog Tests License

Datasette plugin for searching all searchable tables at once.

Installation

Install the plugin in the same Python environment as Datasette:

pip install datasette-search-all

Background

See datasette-search-all: a new plugin for searching multiple Datasette tables at once for background on this project. You can try the plugin out at https://fara.datasettes.com/

Usage

This plugin only works if at least one of the tables connected to your Datasette instance has been configured for SQLite's full-text search.

The Datasette search documentation includes details on how to enable full-text search for a table.

You can also use the following tools:

  • sqlite-utils includes a command-line tool for enabling full-text search.
  • datasette-enable-fts is a Datasette plugin that adds a web interface for enabling search for specific columns.

If the plugin detects at least one searchable table it will add a search form to the homepage.

You can also navigate to /-/search on your Datasette instance to use the search interface directly.

Screenshot

Animated screenshot showing the plugin in action

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd datasette-search-all
python -m venv venv
source venv/bin/activate

Or if you are using pipenv:

pipenv shell

Now install the dependencies and tests:

pip install -e '.[test]'

To run the tests:

pytest

To run the browser automation tests:

pip install -e '.[test,playwright]'
pytest