Flask-SQLAlchemy-Whoosh
A simple and easy to use Flask extension to add full text search to your SQLAlchemy models using the Whoosh search engine.
Installing
$ pip install Flask-SQLAlchemy-Whoosh
Setup
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from Flask_SQLalchemy_Whoosh.searcher import WhooshSearcher
from Flask_SQLalchemy_Whoosh.mixin import SearchableMixin
app = Flask(__name__)
db = SQLAlchemy(app)
search = WhooshSearcher(app)
# If you want to use the SearchableMixin
SearchableMixin.init_search(search, db)
Documentation
You can find some documentation here
Example
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from Flask_SQLalchemy_Whoosh.searcher import WhooshSearcher
from Flask_SQLalchemy_Whoosh.mixin import SearchableMixin
from whoosh.fields import ID, TEXT, NUMERIC
app = Flask(__name__)
db = SQLAlchemy(app)
search = WhooshSearcher(app)
SearchableMixin.init_search(search, db)
class Product(SearchableMixin, db.Model):
__tablename__ = "product"
# __searchable__ is needed to tell the searcher what to index
# For documentation on the specifics of each field, refer to the Whoosh documentation
# https://whoosh.readthedocs.io/en/latest/schema.html
__searchable__ = {
"id": ID(stored=True, unique=True),
"name": TEXT(stored=True),
"desc": TEXT,
"price": NUMERIC
}
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String),
desc = db.Column(db.String),
price = db.Column(db.Integer)
# If you want to index a table that already has entries, use the reindex method
# It will index all entries in the table
Product.reindex()
# Use the search method to search a table
results, total = Product.search("name", "nails")
Metadata
Release files for Flask-SQLalchemy-Whoosh 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flask_sqlalchemy_whoosh-0.1.5.tar.gz | 4.4 kB | Without provenance | Details for flask_sqlalchemy_whoosh-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flask_sqlalchemy_whoosh-0.1.5-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for flask_sqlalchemy_whoosh-0.1.5-py2.py3-none-any.whl |
Total release size: 9.2 kB
Release files / flask_sqlalchemy_whoosh-0.1.5.tar.gz
| Download URL | flask_sqlalchemy_whoosh-0.1.5.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
283174c20ed6bbfb66276ca65b98ae714992a15d7170da1cc9d2933ed44e25ae
|
|
BLAKE2b-256 checksum How to use checksums |
c0390b3048e73970481ac8c7f87d30e69ad8d63aff9c3d1c0a3d5a3ee3bafabe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|
Release files / flask_sqlalchemy_whoosh-0.1.5-py2.py3-none-any.whl
| Download URL | flask_sqlalchemy_whoosh-0.1.5-py2.py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
9814181dd753e7713731d1c931df5de34519afdc35bc4d121ca3f0119c98be2d
|
|
BLAKE2b-256 checksum How to use checksums |
2e0e7f9e486cf7bcdbd4930bd716d150cc0276d126607eb7120bca7557159fca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|
Security for Flask-SQLalchemy-Whoosh 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.