Skip to content

sh4nks/flask-whooshee

 
 

Repository files navigation

Flask-Whooshee

Build Status PyPI Version License

Adds Whoosh integration to Flask-SQLAlchemy.

Flask-Whooshee provides a more advanced Whoosh integration for Flask. Its main power is in the ability to index and search joined queries.

The project is in early beta stage and is fairly stable. However, API may still change before 1.0.0 release.

Flask-Whooshee is licensed under BSD License. Note that up until 0.3.0 it was licensed under GPLv2+.

Quickstart

Install it from PyPI:

$ pip install Flask-Whooshee

Flask-Whooshee supports two different methods of setting up the extension. You can either initialize it directly, thus binding it to a specific application instance:

app = Flask(__name__)
whooshee = Whooshee(app)

and the second is to use the factory pattern which will allow you to configure whooshee at a later point:

whooshee = Whooshee()
def create_app():
    app = Flask(__name__)
    whooshee.init_app(app)
    return app

Now you can create a basic whoosheer:

@whooshee.register_model('title', 'content')
class Entry(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String)
    content = db.Column(db.Text)

and finally you can search the model:

Entry.query.whooshee_search('chuck norris').order_by(Entry.id.desc()).all()

Links

About

Customizable Flask - SQLAlchemy - Whoosh integration

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 99.3%
  • Makefile 0.7%