title: whoosh search after database migration
body: <p>I migrated my database from sqlite3 to postgresql with the following three steps</p>
  
  <ol>
  <li><p>I create a sqlite dump file with </p>
  
  <p>sqlite3 app.db .dump > app_dump.sql</p></li>
  <li><p>I create a postgresql database and initialized it with my models.py file as </p>
  
  <p>python manage.py db init</p></li>
  </ol>
  
  <p>where manage.py is </p>
  
  <pre><code>SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://appuser:777@localhost/app_db' 
  migrate = Migrate(app, db)
  
  manager = Manager(app)
  manager.add_command('db', MigrateCommand)
  
  if __name__ == '__main__':
      manager.run()
  </code></pre>
  
  <ol start="3">
  <li>I used only the insert lines in the dump file to populate the new database.</li>
  </ol>
  
  <p>This worked well, however I do want to have a whoosh search in my User table. </p>
  
  <p>My models.py looks like this </p>
  
  <pre><code>if sys.version_info &gt;= (3, 0):
      enable_search = False
  else:
      enable_search = True
      import flask.ext.whooshalchemy as whooshalchemy
  
  class User(db.Model):
      __searchable__ = ['username','id'] 
  
      id = db.Column(db.Integer, primary_key=True)
      username = db.Column(db.String(100), index=True)
  
  if enable_search:
      whooshalchemy.whoosh_index(app, User)
  </code></pre>
  
  <p>However, the search does not seem to work at all. I fear that the table has not been properly indexed? Anybody know how I can fix this?
  thanks
  carl</p>
  
  <p>EDIT:
  Solved it... have a look at 
  <a href="https://gist.github.com/davb5/21fbffd7a7990f5e066c" rel="nofollow">https://gist.github.com/davb5/21fbffd7a7990f5e066c</a></p>