You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@whooshee.register_model('body', 'title')
class Post(db.Model):
__tablename__ = 'posts'
id = db.Column(db.Integer, primary_key=True)
body = db.Column(db.Text)
title = db.Column(db.String(60))
there are other two models:
@whooshee.register_model('name')
class Category(db.Model):
__tablename__ = 'categories'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(30), unique=True)
posts = db.relationship('Post', back_populates='category')
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Users/yangyuze/Documents/Sample/venv/lib/python2.7/site-packages/flask_whooshee.py", line 469, in reindex
getattr(wh, method_name)(writer, item)
File "/Users/yangyuze/Documents/Sample/venv/lib/python2.7/site-packages/flask_whooshee.py", line 345, in update_model
writer.update_document(**attrs)
File "/Users/yangyuze/Documents/Sample/venv/lib/python2.7/site-packages/whoosh/writing.py", line 490, in update_document
self.add_document(**fields)
File "/Users/yangyuze/Documents/Sample/venv/lib/python2.7/site-packages/whoosh/writing.py", line 730, in add_document
self._check_fields(schema, fieldnames)
File "/Users/yangyuze/Documents/Sample/venv/lib/python2.7/site-packages/whoosh/writing.py", line 718, in _check_fields
% (name, schema))
Thanks for the bug report!
Did you have a previous version of the code that used just @whooshee.register_model('body')? If so, you'd need to do reindexing [1].
What you're seeing is a Whoosh error that says the schema only has id and body, so that would suggest it was created before you also added title in your code. If you can confirm this and reindex will work for you, I'll make this clear in the documentation.
If this is not the case, please let me know flask-whooshee version you're using and we'll come up with a reproducer and a fix.
I register the column 'title' like:
there are other two models:
but I got
when I do the search, I do not know how to deal with it, the model User and Category are correct but the Post.
The text was updated successfully, but these errors were encountered: