{"action":"created","issue":{"url":"https://api.github.com/repos/elm-lang/package.elm-lang.org/issues/160","repository_url":"https://api.github.com/repos/elm-lang/package.elm-lang.org","labels_url":"https://api.github.com/repos/elm-lang/package.elm-lang.org/issues/160/labels{/name}","comments_url":"https://api.github.com/repos/elm-lang/package.elm-lang.org/issues/160/comments","events_url":"https://api.github.com/repos/elm-lang/package.elm-lang.org/issues/160/events","html_url":"https://github.com/elm-lang/package.elm-lang.org/pull/160","id":130146810,"number":160,"title":"[WIP] Feature/type search","user":{"login":"klaftertief","id":11281,"avatar_url":"https://avatars.githubusercontent.com/u/11281?v=3","gravatar_id":"","url":"https://api.github.com/users/klaftertief","html_url":"https://github.com/klaftertief","followers_url":"https://api.github.com/users/klaftertief/followers","following_url":"https://api.github.com/users/klaftertief/following{/other_user}","gists_url":"https://api.github.com/users/klaftertief/gists{/gist_id}","starred_url":"https://api.github.com/users/klaftertief/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klaftertief/subscriptions","organizations_url":"https://api.github.com/users/klaftertief/orgs","repos_url":"https://api.github.com/users/klaftertief/repos","events_url":"https://api.github.com/users/klaftertief/events{/privacy}","received_events_url":"https://api.github.com/users/klaftertief/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2016-01-31T16:23:10Z","updated_at":"2016-08-20T11:27:17Z","closed_at":"2016-08-20T11:24:57Z","pull_request":{"url":"https://api.github.com/repos/elm-lang/package.elm-lang.org/pulls/160","html_url":"https://github.com/elm-lang/package.elm-lang.org/pull/160","diff_url":"https://github.com/elm-lang/package.elm-lang.org/pull/160.diff","patch_url":"https://github.com/elm-lang/package.elm-lang.org/pull/160.patch"},"body":"This adds a separate search page, inspired by [Hoogle](https://www.haskell.org/hoogle/).\r\n\r\n## The search works roughly like that:\r\n\r\n- Fetch the summary list of all available packages.\r\n- Fetch the `documentation.json` of the latest version for each up-to-date package.\r\n- Parse the type annotations of each exposed module.\r\n- Put the type annotations into one big list, also keep a normalised* version with it.\r\n- Parse the search query like a type annotation, calculate a `distance` between the normalised versions.\r\n- Exclude annotations with a `distance` above a given threshold.\r\n- Show search results, sorted by distance.\r\n\r\nNormalisation means to replace the type variables with ones in alphabetical order, respecting identical occurrences.\r\n\r\n## Please note:\r\n\r\n- To see the search in action one has to build the project from source with a set of packages in the `/packages` directory. Packages can be found at https://github.com/elm-lang/package.elm-lang.org/tree/diffs/tmp\r\n- Visiting the search page loads the documentation of all current packages. As the time of writing this is around 165 request, with a total of maybe 1MB. A single bundle file on the server with all documentations would help, but also some client side storage. I'm happy to implement some client side caching, but I'm not sure about what people think about using external dependencies for this website.\r\n- Only up-do-date packages are loaded. It's easy to include all packages, some might not get parsed, though. Any opinions about this?\r\n- Only `Value` annotations are searched, no `Union` or `Alias`. It's easy to add those as well, but is there any value in it?\r\n- The search works either for just the name or the actual annotation. The name-comparison (in both) is super simple and only cares about actual equality or substring occurrences. Hooking into some fuzzy text search would be easy, but I wasn't sure again about bundling a dependency.\r\n- There is some code duplication for the search result type views. I wanted have correct links from there to the corresponding packages, both in for the name and the annotation. But the current views depend on the context (URL) of the page they are in, the search results need to produce absolute links. I did not want to put too much effort into this at this stage. Any help there is appreciated.\r\n- The [`distance` implementation](https://github.com/klaftertief/package.elm-lang.org/blob/feature/type-search/src/frontend/Docs/Type.elm#L237-L277) of two types is not the nicest at the moment. I could use some more experienced eyes there, mainly to find some good penalty settings to have a good constant threshold for filtering the search results. I was thinking about normalising the `distance` by using some complexity measure of each type.\r\n- Searching with type variables (lowercase annotations) is limited such that one can't use a single type variable like `x` to match anything \"structured\", like `List a`. That is a search for `x -> y -> x` only finds `always` and not some arbitrary function whose return type maths the type of the first parameter.\r\n\r\nSo, before merging I'd like to have a better notation of `distance` values with the help of a good set of penalties and probably some DRYed up views.\r\n\r\n![elm-search-empty](https://cloud.githubusercontent.com/assets/11281/12703266/42a36fca-c83f-11e5-80f4-ca468cf2fee3.png)\r\n![elm-search-searching](https://cloud.githubusercontent.com/assets/11281/12703267/42c5f64e-c83f-11e5-841c-4c425811db45.png)"},"comment":{"url":"https://api.github.com/repos/elm-lang/package.elm-lang.org/issues/comments/241194306","html_url":"https://github.com/elm-lang/package.elm-lang.org/pull/160#issuecomment-241194306","issue_url":"https://api.github.com/repos/elm-lang/package.elm-lang.org/issues/160","id":241194306,"user":{"login":"klaftertief","id":11281,"avatar_url":"https://avatars.githubusercontent.com/u/11281?v=3","gravatar_id":"","url":"https://api.github.com/users/klaftertief","html_url":"https://github.com/klaftertief","followers_url":"https://api.github.com/users/klaftertief/followers","following_url":"https://api.github.com/users/klaftertief/following{/other_user}","gists_url":"https://api.github.com/users/klaftertief/gists{/gist_id}","starred_url":"https://api.github.com/users/klaftertief/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klaftertief/subscriptions","organizations_url":"https://api.github.com/users/klaftertief/orgs","repos_url":"https://api.github.com/users/klaftertief/repos","events_url":"https://api.github.com/users/klaftertief/events{/privacy}","received_events_url":"https://api.github.com/users/klaftertief/received_events","type":"User","site_admin":false},"created_at":"2016-08-20T11:27:17Z","updated_at":"2016-08-20T11:27:17Z","body":"I'll open a separate pull request with a link to the search to (package.)elm-lang.org then. "}}
{"actor":{"display_login":"klaftertief"}}