{"action":"opened","issue":{"url":"https://api.github.com/repos/kvesteri/sqlalchemy-searchable/issues/47","repository_url":"https://api.github.com/repos/kvesteri/sqlalchemy-searchable","labels_url":"https://api.github.com/repos/kvesteri/sqlalchemy-searchable/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/kvesteri/sqlalchemy-searchable/issues/47/comments","events_url":"https://api.github.com/repos/kvesteri/sqlalchemy-searchable/issues/47/events","html_url":"https://github.com/kvesteri/sqlalchemy-searchable/issues/47","id":152024263,"number":47,"title":"Feature : Specifying the row language for to_tsvector call.","user":{"login":"ibrahim12","id":1056163,"avatar_url":"https://avatars.githubusercontent.com/u/1056163?v=3","gravatar_id":"","url":"https://api.github.com/users/ibrahim12","html_url":"https://github.com/ibrahim12","followers_url":"https://api.github.com/users/ibrahim12/followers","following_url":"https://api.github.com/users/ibrahim12/following{/other_user}","gists_url":"https://api.github.com/users/ibrahim12/gists{/gist_id}","starred_url":"https://api.github.com/users/ibrahim12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ibrahim12/subscriptions","organizations_url":"https://api.github.com/users/ibrahim12/orgs","repos_url":"https://api.github.com/users/ibrahim12/repos","events_url":"https://api.github.com/users/ibrahim12/events{/privacy}","received_events_url":"https://api.github.com/users/ibrahim12/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-04-30T11:02:05Z","updated_at":"2016-04-30T11:02:05Z","closed_at":null,"body":"Provision for setting `regconfig` as a row column. \r\n\r\nlike on model, \r\n\r\n```\r\nclass Post(db.Model):\r\n   ...\r\n   title = db.Column(db.String)\r\n   ketwords = db.Column(db.Text)\r\n   \r\n   # will hold for language full name for each row.\r\n   row_language = db.Column(db.String, defualt='english' )\r\n   search_vector = db.Column(TSVectorType('keywords', 'title', regconfig='post.row_language'))\r\n\r\n```\r\n\r\non migrations, \r\n\r\n```\r\n    sync_trigger(conn, 'post', 'search_vector', ['keywords', 'title'], None, {regconfig: 'post.row_language'} )\r\n\r\n```\r\n\r\nThis will generate a query like this,\r\n\r\n```\r\nSELECT *\r\nFROM table\r\nWHERE search_vector @@ to_tsquery(post.row_langugage::regconfig, 'SEARCH_KEY') ;\r\n```\r\n\r\nTrigger will be, \r\n\r\n```\r\nBEGIN\r\n                NEW.search_vector = to_tsvector(post.row_language::regconfig, regexp_replace(coalesce(NEW.keywords, ''''), ''[-@.]'', '' '', ''g'')) || to_tsvector(post.row_language::regconfig, regexp_replace(coalesce(NEW.title, ''''), ''[-@.]'', '' '', ''g''));\r\n                RETURN NEW;\r\nEND\r\n\r\n```\r\n\r\n"}}