{"action":"created","issue":{"url":"https://api.github.com/repos/ashleyhsia0/hb-project-breadcrumbs/issues/16","repository_url":"https://api.github.com/repos/ashleyhsia0/hb-project-breadcrumbs","labels_url":"https://api.github.com/repos/ashleyhsia0/hb-project-breadcrumbs/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/ashleyhsia0/hb-project-breadcrumbs/issues/16/comments","events_url":"https://api.github.com/repos/ashleyhsia0/hb-project-breadcrumbs/issues/16/events","html_url":"https://github.com/ashleyhsia0/hb-project-breadcrumbs/issues/16","id":155599976,"number":16,"title":"Searchbox feature not working for Flask-SQLAlchemy integrations documentation","user":{"login":"ashleyhsia0","id":18315198,"avatar_url":"https://avatars.githubusercontent.com/u/18315198?v=3","gravatar_id":"","url":"https://api.github.com/users/ashleyhsia0","html_url":"https://github.com/ashleyhsia0","followers_url":"https://api.github.com/users/ashleyhsia0/followers","following_url":"https://api.github.com/users/ashleyhsia0/following{/other_user}","gists_url":"https://api.github.com/users/ashleyhsia0/gists{/gist_id}","starred_url":"https://api.github.com/users/ashleyhsia0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashleyhsia0/subscriptions","organizations_url":"https://api.github.com/users/ashleyhsia0/orgs","repos_url":"https://api.github.com/users/ashleyhsia0/repos","events_url":"https://api.github.com/users/ashleyhsia0/events{/privacy}","received_events_url":"https://api.github.com/users/ashleyhsia0/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-18T20:58:19Z","updated_at":"2016-05-18T21:11:04Z","closed_at":"2016-05-18T21:11:04Z","body":"As `test_search_model.py` was functioning properly (refer to Issue #4 ), decided to move SQLAlchemy-Searchable to original `model.py` file and original db `breadcrumbs`.\r\n\r\nWhile moving the code over, noticed that SQLAlchemy-Searchable was using `Base`, whereas we use `db.Model`. Had to follow the documentation for Flask-SQLAlchemy integrations (https://sqlalchemy-searchable.readthedocs.io/en/latest/integrations.html).\r\n\r\nSearch returns no results, when it was working prior to Flask-SQLAlchemy integration???\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ashleyhsia0/hb-project-breadcrumbs/issues/comments/220159410","html_url":"https://github.com/ashleyhsia0/hb-project-breadcrumbs/issues/16#issuecomment-220159410","issue_url":"https://api.github.com/repos/ashleyhsia0/hb-project-breadcrumbs/issues/16","id":220159410,"user":{"login":"ashleyhsia0","id":18315198,"avatar_url":"https://avatars.githubusercontent.com/u/18315198?v=3","gravatar_id":"","url":"https://api.github.com/users/ashleyhsia0","html_url":"https://github.com/ashleyhsia0","followers_url":"https://api.github.com/users/ashleyhsia0/followers","following_url":"https://api.github.com/users/ashleyhsia0/following{/other_user}","gists_url":"https://api.github.com/users/ashleyhsia0/gists{/gist_id}","starred_url":"https://api.github.com/users/ashleyhsia0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashleyhsia0/subscriptions","organizations_url":"https://api.github.com/users/ashleyhsia0/orgs","repos_url":"https://api.github.com/users/ashleyhsia0/repos","events_url":"https://api.github.com/users/ashleyhsia0/events{/privacy}","received_events_url":"https://api.github.com/users/ashleyhsia0/received_events","type":"User","site_admin":false},"created_at":"2016-05-18T21:11:04Z","updated_at":"2016-05-18T21:11:04Z","body":"Someone had the same problem per following links:\r\nhttps://github.com/kvesteri/sqlalchemy-searchable/issues/30\r\nhttp://stackoverflow.com/questions/29198489/flask-sqlalchemy-sqlalchemy-searchable-returning-empty-list\r\n\r\nI checked the database and `search_vector` was empty for the `restaurants` table, when it should include the name and address of restaurant.\r\n\r\n**Solution: Call `db.configure_mappers()` before `db.create_all()`.**\r\n\r\nNeed to properly configure the mappers for SQLAlchemy before creating tables, so that SQLAlchemy-Searchable's `search_vector` trigger can populate the `TSVectorType` column.\r\n\r\nPer the SQLAlchemy-Searchable docs:\r\n> It is very important here that you either access your searchable class or call configure_mappers before the creation of tables. SA-Searchable adds DDL listeners on the configuration phase of models.\r\n\r\nDid not use configure_mappers() when trying out SQLAlchemy-Searchable in test_search_model.py so not sure why this occured. Perhaps because Base was called in test_search_model.py?\r\n\r\nNote: Did not use the BaseQuery or SearchQueryMixin per the documentation (search method still works without this)."}}