Display autocomplete in OpenSearch Suggestions format #200

Closed
SineSwiper opened this Issue Apr 27, 2012 · 10 comments

Comments

Projects
None yet
6 participants

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.

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"
   ]
]
Member

rwstauner commented Apr 29, 2012

Is this the same as cpan-api/metacpan-web#434 ?

Yes, but why was the original case closed?

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

Owner

oalders commented May 1, 2012

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.

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.

Owner

oalders commented May 2, 2012

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

Member

monken commented May 15, 2012

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.

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.

Owner

ranguard commented Nov 13, 2014

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

@ranguard ranguard closed this Nov 13, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment