{"action":"created","issue":{"url":"https://api.github.com/repos/18F/C2/issues/355","labels_url":"https://api.github.com/repos/18F/C2/issues/355/labels{/name}","comments_url":"https://api.github.com/repos/18F/C2/issues/355/comments","events_url":"https://api.github.com/repos/18F/C2/issues/355/events","html_url":"https://github.com/18F/C2/pull/355","id":76503879,"number":355,"title":"[WIP] [Delivers #93638088] search","user":{"login":"afeld","id":86842,"avatar_url":"https://avatars.githubusercontent.com/u/86842?v=3","gravatar_id":"","url":"https://api.github.com/users/afeld","html_url":"https://github.com/afeld","followers_url":"https://api.github.com/users/afeld/followers","following_url":"https://api.github.com/users/afeld/following{/other_user}","gists_url":"https://api.github.com/users/afeld/gists{/gist_id}","starred_url":"https://api.github.com/users/afeld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afeld/subscriptions","organizations_url":"https://api.github.com/users/afeld/orgs","repos_url":"https://api.github.com/users/afeld/repos","events_url":"https://api.github.com/users/afeld/events{/privacy}","received_events_url":"https://api.github.com/users/afeld/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-14T22:00:56Z","updated_at":"2015-05-15T03:03:25Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/18F/C2/pulls/355","html_url":"https://github.com/18F/C2/pull/355","diff_url":"https://github.com/18F/C2/pull/355.diff","patch_url":"https://github.com/18F/C2/pull/355.patch"},"body":"Search options are documented here:\r\n\r\nhttps://docs.google.com/document/d/1q3dsdkqAKjK_XDohjTtBdiaxduaEnm3KLHrKMtg94rI/edit#\r\n\r\nEnded up going with the simplest possible Postgres Full Text Search."},"comment":{"url":"https://api.github.com/repos/18F/C2/issues/comments/102238951","html_url":"https://github.com/18F/C2/pull/355#issuecomment-102238951","issue_url":"https://api.github.com/repos/18F/C2/issues/355","id":102238951,"user":{"login":"cmc333333","id":326918,"avatar_url":"https://avatars.githubusercontent.com/u/326918?v=3","gravatar_id":"","url":"https://api.github.com/users/cmc333333","html_url":"https://github.com/cmc333333","followers_url":"https://api.github.com/users/cmc333333/followers","following_url":"https://api.github.com/users/cmc333333/following{/other_user}","gists_url":"https://api.github.com/users/cmc333333/gists{/gist_id}","starred_url":"https://api.github.com/users/cmc333333/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmc333333/subscriptions","organizations_url":"https://api.github.com/users/cmc333333/orgs","repos_url":"https://api.github.com/users/cmc333333/repos","events_url":"https://api.github.com/users/cmc333333/events{/privacy}","received_events_url":"https://api.github.com/users/cmc333333/received_events","type":"User","site_admin":false},"created_at":"2015-05-15T03:03:25Z","updated_at":"2015-05-15T03:03:25Z","body":"This is a good start! Some suggestions:\r\n\r\n* This might operate better as a manipulation of an existing queryset -- i.e. you want to filter and order an existing query rather than trying to merge the two queries later\r\n* This currently conflates filtering with ordering. Using an `in` clause doesn't inherently affect the order of the results, so the sort is misleading\r\n* Generating all of the term vectors at query time will be very taxing -- this transformation has to be performed on all relevant columns, on all rows for each query. It might be better to precompute that by adding a term vector column. Of course, if this column exists, it can/should have an index.\r\n* Weighing certain columns over others will be a useful feature in the future, but I wonder if it's only hiding the logic in the query right now\r\n* Doing all of the joins and listing the individual fields will become very painful as the number of clients expands (both to implement and at run time). If you go the precomputed column route, you could have each subtype insert its own values into that term vector column. Responsibility, then, falls on the subtype rather than the querier\r\n* It looks like there are some existing gems, e.g. [pg_search](https://github.com/Casecommons/pg_search), which might make this much easier for you\r\n\r\nI'll posit that this is another argument for flexible fields rather than distinct tables. The term vector _couldn't_ be specified statically, so we'd be forced to design a solution which worked for everyone out of the box."}}