{"action":"closed","number":260,"pull_request":{"url":"https://api.github.com/repos/wistia/wistia-doc/pulls/260","id":53302904,"html_url":"https://github.com/wistia/wistia-doc/pull/260","diff_url":"https://github.com/wistia/wistia-doc/pull/260.diff","patch_url":"https://github.com/wistia/wistia-doc/pull/260.patch","issue_url":"https://api.github.com/repos/wistia/wistia-doc/issues/260","number":260,"state":"closed","locked":false,"title":"Append a custom param to a Swiftype search","user":{"login":"ldenevi","id":1868312,"avatar_url":"https://avatars.githubusercontent.com/u/1868312?v=3","gravatar_id":"","url":"https://api.github.com/users/ldenevi","html_url":"https://github.com/ldenevi","followers_url":"https://api.github.com/users/ldenevi/followers","following_url":"https://api.github.com/users/ldenevi/following{/other_user}","gists_url":"https://api.github.com/users/ldenevi/gists{/gist_id}","starred_url":"https://api.github.com/users/ldenevi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ldenevi/subscriptions","organizations_url":"https://api.github.com/users/ldenevi/orgs","repos_url":"https://api.github.com/users/ldenevi/repos","events_url":"https://api.github.com/users/ldenevi/events{/privacy}","received_events_url":"https://api.github.com/users/ldenevi/received_events","type":"User","site_admin":false},"body":"This hack works around the inability to append a custom string to the Swiftype search params.\r\n\r\nSwiftype offers two ways to use their search engine: an \"install\" method and a custom Javascript. The \"install\" method basically sends the search query to their servers and either displays the results in a DIV or a results page. This behavior is configured in the dashboard on their website.\r\n\r\nThe custom method only lets a user populate a DIV; it does not allow for a results page.\r\n\r\nWhat we want is the customization ability along with the results page. This hack basically switches between both methods along with some hack to append a param. It checks to see if it's in the result page; if yes, then it uses the install method in order to pull the Swiftype query params and load the results in the page.\r\n\r\nIf it's not the results page, then it uses the custom method. It searches the page for a swiftype input field and binds Swiftype to it. When the user submits the query, the custom code hijacks the in-page rendering function, pulls the `wsrc` attribute from the input field, and redirects the user to the results page that includes the search query and custom param.\r\n\r\n# Bugs\r\n\r\n- [x] When no search result, the page does not go anywhere\r\n- [x] Some search boxes not working (they need the `<form>` tag)\r\n- [x] Appending `undefined` when INPUT does not have a `wsrc` attribute\r\n- [x] Back button breaks\r\n- [ ] Autocomplete style is broken for main search field","created_at":"2015-12-10T19:14:48Z","updated_at":"2015-12-14T15:23:37Z","closed_at":"2015-12-14T15:23:37Z","merged_at":"2015-12-14T15:23:36Z","merge_commit_sha":"7ca6384cad3482fe5e503ab21c1cc313f815b232","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/wistia/wistia-doc/pulls/260/commits","review_comments_url":"https://api.github.com/repos/wistia/wistia-doc/pulls/260/comments","review_comment_url":"https://api.github.com/repos/wistia/wistia-doc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wistia/wistia-doc/issues/260/comments","statuses_url":"https://api.github.com/repos/wistia/wistia-doc/statuses/7a8b58e5ec84af232d77180277330c2df1ca6c0d","head":{"label":"wistia:leo/custom-param","ref":"leo/custom-param","sha":"7a8b58e5ec84af232d77180277330c2df1ca6c0d","user":{"login":"wistia","id":100727,"avatar_url":"https://avatars.githubusercontent.com/u/100727?v=3","gravatar_id":"","url":"https://api.github.com/users/wistia","html_url":"https://github.com/wistia","followers_url":"https://api.github.com/users/wistia/followers","following_url":"https://api.github.com/users/wistia/following{/other_user}","gists_url":"https://api.github.com/users/wistia/gists{/gist_id}","starred_url":"https://api.github.com/users/wistia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wistia/subscriptions","organizations_url":"https://api.github.com/users/wistia/orgs","repos_url":"https://api.github.com/users/wistia/repos","events_url":"https://api.github.com/users/wistia/events{/privacy}","received_events_url":"https://api.github.com/users/wistia/received_events","type":"Organization","site_admin":false},"repo":{"id":4864651,"name":"wistia-doc","full_name":"wistia/wistia-doc","owner":{"login":"wistia","id":100727,"avatar_url":"https://avatars.githubusercontent.com/u/100727?v=3","gravatar_id":"","url":"https://api.github.com/users/wistia","html_url":"https://github.com/wistia","followers_url":"https://api.github.com/users/wistia/followers","following_url":"https://api.github.com/users/wistia/following{/other_user}","gists_url":"https://api.github.com/users/wistia/gists{/gist_id}","starred_url":"https://api.github.com/users/wistia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wistia/subscriptions","organizations_url":"https://api.github.com/users/wistia/orgs","repos_url":"https://api.github.com/users/wistia/repos","events_url":"https://api.github.com/users/wistia/events{/privacy}","received_events_url":"https://api.github.com/users/wistia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wistia/wistia-doc","description":"The one, the only, the WISTIA DOCUMENTATION!!!!","fork":false,"url":"https://api.github.com/repos/wistia/wistia-doc","forks_url":"https://api.github.com/repos/wistia/wistia-doc/forks","keys_url":"https://api.github.com/repos/wistia/wistia-doc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wistia/wistia-doc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wistia/wistia-doc/teams","hooks_url":"https://api.github.com/repos/wistia/wistia-doc/hooks","issue_events_url":"https://api.github.com/repos/wistia/wistia-doc/issues/events{/number}","events_url":"https://api.github.com/repos/wistia/wistia-doc/events","assignees_url":"https://api.github.com/repos/wistia/wistia-doc/assignees{/user}","branches_url":"https://api.github.com/repos/wistia/wistia-doc/branches{/branch}","tags_url":"https://api.github.com/repos/wistia/wistia-doc/tags","blobs_url":"https://api.github.com/repos/wistia/wistia-doc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wistia/wistia-doc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wistia/wistia-doc/git/refs{/sha}","trees_url":"https://api.github.com/repos/wistia/wistia-doc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wistia/wistia-doc/statuses/{sha}","languages_url":"https://api.github.com/repos/wistia/wistia-doc/languages","stargazers_url":"https://api.github.com/repos/wistia/wistia-doc/stargazers","contributors_url":"https://api.github.com/repos/wistia/wistia-doc/contributors","subscribers_url":"https://api.github.com/repos/wistia/wistia-doc/subscribers","subscription_url":"https://api.github.com/repos/wistia/wistia-doc/subscription","commits_url":"https://api.github.com/repos/wistia/wistia-doc/commits{/sha}","git_commits_url":"https://api.github.com/repos/wistia/wistia-doc/git/commits{/sha}","comments_url":"https://api.github.com/repos/wistia/wistia-doc/comments{/number}","issue_comment_url":"https://api.github.com/repos/wistia/wistia-doc/issues/comments{/number}","contents_url":"https://api.github.com/repos/wistia/wistia-doc/contents/{+path}","compare_url":"https://api.github.com/repos/wistia/wistia-doc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wistia/wistia-doc/merges","archive_url":"https://api.github.com/repos/wistia/wistia-doc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wistia/wistia-doc/downloads","issues_url":"https://api.github.com/repos/wistia/wistia-doc/issues{/number}","pulls_url":"https://api.github.com/repos/wistia/wistia-doc/pulls{/number}","milestones_url":"https://api.github.com/repos/wistia/wistia-doc/milestones{/number}","notifications_url":"https://api.github.com/repos/wistia/wistia-doc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wistia/wistia-doc/labels{/name}","releases_url":"https://api.github.com/repos/wistia/wistia-doc/releases{/id}","created_at":"2012-07-02T20:44:30Z","updated_at":"2015-11-16T16:44:22Z","pushed_at":"2015-12-14T15:23:36Z","git_url":"git://github.com/wistia/wistia-doc.git","ssh_url":"git@github.com:wistia/wistia-doc.git","clone_url":"https://github.com/wistia/wistia-doc.git","svn_url":"https://github.com/wistia/wistia-doc","homepage":null,"size":16964,"stargazers_count":10,"watchers_count":10,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":47,"forks":12,"open_issues":47,"watchers":10,"default_branch":"master"}},"base":{"label":"wistia:master","ref":"master","sha":"b9fdf6388ed5ec6ca93318d27b62b9af1ad5fc26","user":{"login":"wistia","id":100727,"avatar_url":"https://avatars.githubusercontent.com/u/100727?v=3","gravatar_id":"","url":"https://api.github.com/users/wistia","html_url":"https://github.com/wistia","followers_url":"https://api.github.com/users/wistia/followers","following_url":"https://api.github.com/users/wistia/following{/other_user}","gists_url":"https://api.github.com/users/wistia/gists{/gist_id}","starred_url":"https://api.github.com/users/wistia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wistia/subscriptions","organizations_url":"https://api.github.com/users/wistia/orgs","repos_url":"https://api.github.com/users/wistia/repos","events_url":"https://api.github.com/users/wistia/events{/privacy}","received_events_url":"https://api.github.com/users/wistia/received_events","type":"Organization","site_admin":false},"repo":{"id":4864651,"name":"wistia-doc","full_name":"wistia/wistia-doc","owner":{"login":"wistia","id":100727,"avatar_url":"https://avatars.githubusercontent.com/u/100727?v=3","gravatar_id":"","url":"https://api.github.com/users/wistia","html_url":"https://github.com/wistia","followers_url":"https://api.github.com/users/wistia/followers","following_url":"https://api.github.com/users/wistia/following{/other_user}","gists_url":"https://api.github.com/users/wistia/gists{/gist_id}","starred_url":"https://api.github.com/users/wistia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wistia/subscriptions","organizations_url":"https://api.github.com/users/wistia/orgs","repos_url":"https://api.github.com/users/wistia/repos","events_url":"https://api.github.com/users/wistia/events{/privacy}","received_events_url":"https://api.github.com/users/wistia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wistia/wistia-doc","description":"The one, the only, the WISTIA DOCUMENTATION!!!!","fork":false,"url":"https://api.github.com/repos/wistia/wistia-doc","forks_url":"https://api.github.com/repos/wistia/wistia-doc/forks","keys_url":"https://api.github.com/repos/wistia/wistia-doc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wistia/wistia-doc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wistia/wistia-doc/teams","hooks_url":"https://api.github.com/repos/wistia/wistia-doc/hooks","issue_events_url":"https://api.github.com/repos/wistia/wistia-doc/issues/events{/number}","events_url":"https://api.github.com/repos/wistia/wistia-doc/events","assignees_url":"https://api.github.com/repos/wistia/wistia-doc/assignees{/user}","branches_url":"https://api.github.com/repos/wistia/wistia-doc/branches{/branch}","tags_url":"https://api.github.com/repos/wistia/wistia-doc/tags","blobs_url":"https://api.github.com/repos/wistia/wistia-doc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wistia/wistia-doc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wistia/wistia-doc/git/refs{/sha}","trees_url":"https://api.github.com/repos/wistia/wistia-doc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wistia/wistia-doc/statuses/{sha}","languages_url":"https://api.github.com/repos/wistia/wistia-doc/languages","stargazers_url":"https://api.github.com/repos/wistia/wistia-doc/stargazers","contributors_url":"https://api.github.com/repos/wistia/wistia-doc/contributors","subscribers_url":"https://api.github.com/repos/wistia/wistia-doc/subscribers","subscription_url":"https://api.github.com/repos/wistia/wistia-doc/subscription","commits_url":"https://api.github.com/repos/wistia/wistia-doc/commits{/sha}","git_commits_url":"https://api.github.com/repos/wistia/wistia-doc/git/commits{/sha}","comments_url":"https://api.github.com/repos/wistia/wistia-doc/comments{/number}","issue_comment_url":"https://api.github.com/repos/wistia/wistia-doc/issues/comments{/number}","contents_url":"https://api.github.com/repos/wistia/wistia-doc/contents/{+path}","compare_url":"https://api.github.com/repos/wistia/wistia-doc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wistia/wistia-doc/merges","archive_url":"https://api.github.com/repos/wistia/wistia-doc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wistia/wistia-doc/downloads","issues_url":"https://api.github.com/repos/wistia/wistia-doc/issues{/number}","pulls_url":"https://api.github.com/repos/wistia/wistia-doc/pulls{/number}","milestones_url":"https://api.github.com/repos/wistia/wistia-doc/milestones{/number}","notifications_url":"https://api.github.com/repos/wistia/wistia-doc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wistia/wistia-doc/labels{/name}","releases_url":"https://api.github.com/repos/wistia/wistia-doc/releases{/id}","created_at":"2012-07-02T20:44:30Z","updated_at":"2015-11-16T16:44:22Z","pushed_at":"2015-12-14T15:23:36Z","git_url":"git://github.com/wistia/wistia-doc.git","ssh_url":"git@github.com:wistia/wistia-doc.git","clone_url":"https://github.com/wistia/wistia-doc.git","svn_url":"https://github.com/wistia/wistia-doc","homepage":null,"size":16964,"stargazers_count":10,"watchers_count":10,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":47,"forks":12,"open_issues":47,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wistia/wistia-doc/pulls/260"},"html":{"href":"https://github.com/wistia/wistia-doc/pull/260"},"issue":{"href":"https://api.github.com/repos/wistia/wistia-doc/issues/260"},"comments":{"href":"https://api.github.com/repos/wistia/wistia-doc/issues/260/comments"},"review_comments":{"href":"https://api.github.com/repos/wistia/wistia-doc/pulls/260/comments"},"review_comment":{"href":"https://api.github.com/repos/wistia/wistia-doc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wistia/wistia-doc/pulls/260/commits"},"statuses":{"href":"https://api.github.com/repos/wistia/wistia-doc/statuses/7a8b58e5ec84af232d77180277330c2df1ca6c0d"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"ldenevi","id":1868312,"avatar_url":"https://avatars.githubusercontent.com/u/1868312?v=3","gravatar_id":"","url":"https://api.github.com/users/ldenevi","html_url":"https://github.com/ldenevi","followers_url":"https://api.github.com/users/ldenevi/followers","following_url":"https://api.github.com/users/ldenevi/following{/other_user}","gists_url":"https://api.github.com/users/ldenevi/gists{/gist_id}","starred_url":"https://api.github.com/users/ldenevi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ldenevi/subscriptions","organizations_url":"https://api.github.com/users/ldenevi/orgs","repos_url":"https://api.github.com/users/ldenevi/repos","events_url":"https://api.github.com/users/ldenevi/events{/privacy}","received_events_url":"https://api.github.com/users/ldenevi/received_events","type":"User","site_admin":false},"comments":5,"review_comments":12,"commits":9,"additions":90,"deletions":28,"changed_files":11}}