{"action":"created","issue":{"url":"https://api.github.com/repos/reddit/reddit/issues/1335","labels_url":"https://api.github.com/repos/reddit/reddit/issues/1335/labels{/name}","comments_url":"https://api.github.com/repos/reddit/reddit/issues/1335/comments","events_url":"https://api.github.com/repos/reddit/reddit/issues/1335/events","html_url":"https://github.com/reddit/reddit/pull/1335","id":88568074,"number":1335,"title":"Search syntax selection improvements","user":{"login":"Pokechu22","id":8334194,"avatar_url":"https://avatars.githubusercontent.com/u/8334194?v=3","gravatar_id":"","url":"https://api.github.com/users/Pokechu22","html_url":"https://github.com/Pokechu22","followers_url":"https://api.github.com/users/Pokechu22/followers","following_url":"https://api.github.com/users/Pokechu22/following{/other_user}","gists_url":"https://api.github.com/users/Pokechu22/gists{/gist_id}","starred_url":"https://api.github.com/users/Pokechu22/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pokechu22/subscriptions","organizations_url":"https://api.github.com/users/Pokechu22/orgs","repos_url":"https://api.github.com/users/Pokechu22/repos","events_url":"https://api.github.com/users/Pokechu22/events{/privacy}","received_events_url":"https://api.github.com/users/Pokechu22/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-15T23:35:26Z","updated_at":"2015-07-30T18:28:13Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/reddit/reddit/pulls/1335","html_url":"https://github.com/reddit/reddit/pull/1335","diff_url":"https://github.com/reddit/reddit/pull/1335.diff","patch_url":"https://github.com/reddit/reddit/pull/1335.patch"},"body":"This makes it easier to search in alternate syntaxes (such as cloudsearch) by doing 2 things: \r\n\r\n1. Preserving the entered search syntax (rather than setting it back to default each search)\r\n2. Making the &delta; (delta) icon have a link to search in the converted syntax.\r\n\r\n*This code is untested*."},"comment":{"url":"https://api.github.com/repos/reddit/reddit/issues/comments/126425493","html_url":"https://github.com/reddit/reddit/pull/1335#issuecomment-126425493","issue_url":"https://api.github.com/repos/reddit/reddit/issues/1335","id":126425493,"user":{"login":"Pokechu22","id":8334194,"avatar_url":"https://avatars.githubusercontent.com/u/8334194?v=3","gravatar_id":"","url":"https://api.github.com/users/Pokechu22","html_url":"https://github.com/Pokechu22","followers_url":"https://api.github.com/users/Pokechu22/followers","following_url":"https://api.github.com/users/Pokechu22/following{/other_user}","gists_url":"https://api.github.com/users/Pokechu22/gists{/gist_id}","starred_url":"https://api.github.com/users/Pokechu22/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pokechu22/subscriptions","organizations_url":"https://api.github.com/users/Pokechu22/orgs","repos_url":"https://api.github.com/users/Pokechu22/repos","events_url":"https://api.github.com/users/Pokechu22/events{/privacy}","received_events_url":"https://api.github.com/users/Pokechu22/received_events","type":"User","site_admin":false},"created_at":"2015-07-30T18:28:13Z","updated_at":"2015-07-30T18:28:13Z","body":":haircut: OK, there's two main parts. (this is the right emoji to use, yes?)\r\n\r\n&nbsp;\r\n\r\nThe first change (37c88f4) makes it so that if you manually switch to an alternate search syntax (cloudsearch syntax most of the time), it keeps it that way.  \r\nRight now, you can manually switch to cloudsearch by adding `&syntax=cloudsearch` to the end of the URL.  The reasons you'd want to do so vary, but [one example from the search tips page](https://www.reddit.com/wiki/search#wiki_cloudsearch_syntax) is filtering by specific dates, eg [`1388534400..1420070400`](https://www.reddit.com/search?q=timestamp%3A1388534400..1420070400&syntax=cloudsearch) to search for all posts between 2014 and 2015.  However, if you edit the text in the search box and then click submit, it removes the `&syntax=cloudsearch` from the URL, resulting in a [plaintext search](https://www.reddit.com/search?q=%28and+timestamp%3A1388534400..1420070400+title%3A%27potato%27%29&restrict_sr=&sort=relevance&t=all) (because the new text isn't valid as lucene).  Which means that you'd either have to add `&syntax=cloudsearch` to the end of the URL each time or edit the URL directly, which is a pain.  \r\nWhat that commit is supposed to do is make it so that the syntax is kept, so that you can actually edit the query in the search box.  It does this by adding a hidden input, which I *think* is the right way of making it.  I'm not a web dev though, so it might be wrong.\r\n\r\n&nbsp;\r\n\r\nThe second commit, 0bc418c, makes it so that the converted syntax revealed by the `δ` is a link to search in that syntax.  \r\nRight now, when you search, you'll see a `δ` in the corner which shows you the converted query.  For example, a search for [`author:pokechu22 subreddit:bugs link`](https://www.reddit.com/search?q=author%3Apokechu22+subreddit%3Abugs+link&restrict_sr=&sort=relevance&t=all) (in the default syntax) is converted to `(and (field author 'pokechu22') (field subreddit 'bugs') (field text 'link'))`.  I believe this is mostly just a debugging thing.  \r\nThe change makes it so that you can click that and search in the converted syntax.  Mostly, this won't be needed, but it might be useful in some cases.  To do this, I needed to update the `search_url` method, as right now it doesn't include the syntax.  I also added the syntax for the \"search within /r/subreddit\" link (but, that probably will never show up, as structured searches within subreddits are disabled)."}}