{"action":"created","issue":{"url":"https://api.github.com/repos/reddit/reddit/issues/1289","labels_url":"https://api.github.com/repos/reddit/reddit/issues/1289/labels{/name}","comments_url":"https://api.github.com/repos/reddit/reddit/issues/1289/comments","events_url":"https://api.github.com/repos/reddit/reddit/issues/1289/events","html_url":"https://github.com/reddit/reddit/pull/1289","id":65966523,"number":1289,"title":"Search providers","user":{"login":"grandpaslab","id":6209184,"avatar_url":"https://avatars.githubusercontent.com/u/6209184?v=3","gravatar_id":"","url":"https://api.github.com/users/grandpaslab","html_url":"https://github.com/grandpaslab","followers_url":"https://api.github.com/users/grandpaslab/followers","following_url":"https://api.github.com/users/grandpaslab/following{/other_user}","gists_url":"https://api.github.com/users/grandpaslab/gists{/gist_id}","starred_url":"https://api.github.com/users/grandpaslab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grandpaslab/subscriptions","organizations_url":"https://api.github.com/users/grandpaslab/orgs","repos_url":"https://api.github.com/users/grandpaslab/repos","events_url":"https://api.github.com/users/grandpaslab/events{/privacy}","received_events_url":"https://api.github.com/users/grandpaslab/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":29,"created_at":"2015-04-02T16:47:14Z","updated_at":"2015-05-06T00:14:55Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/reddit/reddit/pulls/1289","html_url":"https://github.com/reddit/reddit/pull/1289","diff_url":"https://github.com/reddit/reddit/pull/1289.diff","patch_url":"https://github.com/reddit/reddit/pull/1289.patch"},"body":"Move search to provider architecture."},"comment":{"url":"https://api.github.com/repos/reddit/reddit/issues/comments/99268626","html_url":"https://github.com/reddit/reddit/pull/1289#issuecomment-99268626","issue_url":"https://api.github.com/repos/reddit/reddit/issues/1289","id":99268626,"user":{"login":"kemitche","id":849933,"avatar_url":"https://avatars.githubusercontent.com/u/849933?v=3","gravatar_id":"","url":"https://api.github.com/users/kemitche","html_url":"https://github.com/kemitche","followers_url":"https://api.github.com/users/kemitche/followers","following_url":"https://api.github.com/users/kemitche/following{/other_user}","gists_url":"https://api.github.com/users/kemitche/gists{/gist_id}","starred_url":"https://api.github.com/users/kemitche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kemitche/subscriptions","organizations_url":"https://api.github.com/users/kemitche/orgs","repos_url":"https://api.github.com/users/kemitche/repos","events_url":"https://api.github.com/users/kemitche/events{/privacy}","received_events_url":"https://api.github.com/users/kemitche/received_events","type":"User","site_admin":false},"created_at":"2015-05-06T00:14:55Z","updated_at":"2015-05-06T00:14:55Z","body":"End of business day update:\r\n\r\n- [x] Able to set-up Solr with instructions given in README\r\n- [ ] Can run reddit code (non-search features) with providerized search (Solr and/or Cloudsearch)\r\n- [ ] Can upload docs to Solr\r\n- [ ] Can search the Solr index\r\n- [ ] Verified no regressions to Cloudsearch functionality used by reddit.com\r\n\r\nThe second bullet point is causing trouble; I'm hitting cyclical issues with reading `g.search` and attributes off of the provider in various contexts. It's a combination of import-time execution of validators, module level globals reading off of `g`, and similar problems.\r\n\r\nOther providers don't hit these issues as they don't import any code that interacts with `g`. It seems like in order to make this providerization work, there's going to need to either be (1) changes to the providers to de-couple those files from most `r2` imports, or (2) changes to things like `VMenu` and such to not read from `g.search` at import time of controllers, etc.\r\n\r\nI lean towards option 2 at this point; I've experimented a bit with the path that needs taking, and the big problem is the `VMenu` validator's use of `SearchSortMenu` and `SubredditSearchSortMenu`, which each try to pull information from `g.search` with this pull request. The straightest path forward may be to provide a static set of sorts (`_options`) for the initial implementation. It's not ideal or elegant, but my goal is to get this merged sooner rather than let the PR live too long and cause merge issues.\r\n\r\nSo, to summarize: If you have time, please *remove the references to `g.search` from `SearchSortMenu` and `SubredditSearchSortMenu`*, and define those mappings/_options globally. We can refactor later to find a way to let each provider define its sort options & mappings."}}