Skip to content

Full Text Search API using Flask, Peewee, and SQLite with FTS5 and Okapi BM25 rating

Notifications You must be signed in to change notification settings

radupotop/fts-api

Repository files navigation

All commands are run within venv. I use Python 3.7.x.

The products.db sqlite3 db file is included for convenience. It might not run on all machines.

Building and Usage

To build the initial product db:

python build.py

To run:

python run.py

The file containg the FTS queries is input.txt

Structure

The models are held in model.py.

There is a main Products model and a FTS virtual table SearchProducts.

The virtual table has a single column (not counting the implicit rowid), called product_brand containing the concatenated product and brand names.

These tables are created in build.py. The Products table is build from the CSV file, while the SearchProducts is populated from the Products table.

run.py handles executing the FTS query, and uses Okapi BM25 for ranking.

There is a sample_output.txt file provided for convenience.

Author

Radu Potop radu@wooptoo.com

About

Full Text Search API using Flask, Peewee, and SQLite with FTS5 and Okapi BM25 rating

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages