hoogle
hoogle copied to clipboard
Implement search suggestions so the OpenSearch XML we ship works
Fixes #389.
That wasn't that bad.
This now works in Firefox and Chrome, which is pretty cool.
I tested this locally by hacking up the XML files Hoogle ships:
html/search.xml:
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>Hoogle - Local</ShortName>
<LongName>Hoogle - Haskell API Search</LongName>
<Description>
Hoogle is a Haskell API search engine, which allows you to
search many standard Haskell libraries by either function name,
or by approximate type signature.
</Description>
<Tags>haskell</Tags>
<Url type="text/html" template="http://localhost:8080/?hoogle={searchTerms}"/>
<Url type="application/x-suggestions+json" template="http://localhost:8080/?hoogle={searchTerms}&mode=suggest"/>
<Image height="16" width="16" type="image/png">https://hoogle.haskell.org/favicon.png</Image>
<Image height="64" width="64" type="image/png">https://hoogle.haskell.org/favicon64.png</Image>
<Developer>Neil Mitchell</Developer>
<AdultContent>false</AdultContent>
<Language>en-us</Language>
<OutputEncoding>UTF-8</OutputEncoding>
<InputEncoding>UTF-8</InputEncoding>
</OpenSearchDescription>
I'm not sure the best way to do this templating to replace the URLs at present, so I'm leaving that to future work to make that work locally.
