Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement search suggestions so the OpenSearch XML we ship works #390

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lf-
Copy link

@lf- lf- commented Oct 2, 2022

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}&amp;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.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The OpenSearch description specifies a broken suggestions endpoint
1 participant