Tutorial at http://pythonhosted.org/Flask-WhooshAlchemy/ works for me.
Here's my setup
class Post(db.Model):
__tablename__ = 'post'
__searchable__ = ['body']
id = db.Column(db.Integer, primary_key=True)
body = db.Column(db.String)
Results:
If I do not put whoosh_index()
before whoosh_search()
, I get the error:
AttributeError: 'BaseQuery' object has no attribute 'whoosh_search'
db.session.query(Post).filter(Post.body=='hi')
returns the correct output.
Post.query.whooshee_search('hi')
returns empty
I did leave some code out, like additional columns and backrefs, but I don't think that changes anything
There are a few things to note:
- Tutorial worked fine without
whoosh_index()
, but my code threw error when I did not include it. db.session.query(Post).filter()
code worked fine, indicating my model is at least somewhat correct, and there is something wrong with whoosh/my whoosh setup
Please help, thanks