Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Display autocomplete in OpenSearch Suggestions format #200

Closed
SineSwiper opened this Issue · 10 comments

6 participants

@SineSwiper

Now that autocomplete support is available, the next logical step would be to make sure that it can spit out its autocomplete hints in OpenSearch Suggestions format. This can then be included into the OpenSearchDescription XML for MetaCPAN.

@SineSwiper

Example: http://api.metacpan.org/search/autocomplete?q=Meta

This would look like:

[
   "Meta",
   [
      "meta",
      "metafy",
      "metaweb",
      "Metaweb",
      "metabot",
      "metapage",
      "Metabase",
      "DCI::Meta",
      "metatrans",
      "MetaStore",
      "metapatch",
      "metaclass",
      "metaclass",
      "MetaTrans",
      "Perl::Meta",
      "Meta::Init",
      "Acme::Meta",
      "Geo::METAR",
      "CPAN::Meta",
      "Class::Meta"
   ],
   [
      "Acme-MetaSyntactic"
      "Acme-MetaSyntactic"
      "Metaweb"
      "Metaweb"
      "Bot-MetaSyntactic"
      "Text-MetaText"
      "Metabase"
      "DCI"
      "MetaTrans"
      "MetaStore"
      "Template-Patch"
      "Moose"
      "Class-MOP"
      "MetaTrans"
      "Perl-Meta"
      "Meta"
      "Acme-Meta"
      "Geo-METAR"
      "CPAN-Meta"
      "Class-Meta"
   ],
   [
      "https://metacpan.org/search?q=meta",
      "https://metacpan.org/search?q=metafy",
      "https://metacpan.org/search?q=metaweb",
      "https://metacpan.org/search?q=Metaweb",
      "https://metacpan.org/search?q=metabot",
      "https://metacpan.org/search?q=metapage",
      "https://metacpan.org/search?q=Metabase",
      "https://metacpan.org/search?q=DCI::Meta",
      "https://metacpan.org/search?q=metatrans",
      "https://metacpan.org/search?q=MetaStore",
      "https://metacpan.org/search?q=metapatch",
      "https://metacpan.org/search?q=metaclass",
      "https://metacpan.org/search?q=metaclass",
      "https://metacpan.org/search?q=MetaTrans",
      "https://metacpan.org/search?q=Perl::Meta",
      "https://metacpan.org/search?q=Meta::Init",
      "https://metacpan.org/search?q=Acme::Meta",
      "https://metacpan.org/search?q=Geo::METAR",
      "https://metacpan.org/search?q=CPAN::Meta",
      "https://metacpan.org/search?q=Class::Meta"
   ]
]
@rwstauner
Owner

Is this the same as CPAN-API/metacpan-web#434 ?

@SineSwiper

Yes, but why was the original case closed?

@david-gang

it was somehow closed automatically. i am not aware that i closed the issue

@oalders
Owner

IIRC there was some conversation about how many output formats we wanted to support and whether this would better be provided as some external wrapper around the API. Having said that, I'm happy to revisit this.

@SineSwiper

Why have an external wrapper around the API when you are using a Catalyst MVC model? MVC makes it easy to just create a new View with the different format. Besides, I don't see this particular format being used for anything except search suggestions (ie: only for /search/autocomplete), as that is what the format is designed for.

@oalders
Owner

Right. I don't think there's a lot of overhead involved adding another output format, so I'm in favour of it. @monken?

@monken
Owner

Why do you link to https://metacpan.org/search?q=meta instead https://metacpan.org/module/meta?
Since you already selected the exact name of the module, you could as well just go to the selected module and not the search results.

@SineSwiper

No reason except copypasta. The existing OpenSearch (sans autocomplete) is already going directly to the module, so /module/meta would work fine.

I would add that non-module matches (like "askndiawr", which doesn't actually find anything) should still go to the search?q= version, though. I think that works as-is, though, since the OpenSearchDescription (not the autocomplete) is already doing that.

@ranguard
Owner

No one stepped forward to do this - Closing as part of Nov 2014 cleanup

@ranguard ranguard closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.