AMO:Users/Search API

From MozillaWiki
Jump to: navigation, search

Search API

The new Search API uses Sphinx to power its results. In addition to sphinx we have a custom query language that is meant to be human readable.

General syntax

The general syntax for a query is as such:

http://services.addons.mozilla.org/[locale]/[app]/api/1.5/search/[query] 

where locale is something like 'en-US' or 'fr'
where app is something like 'firefox', 'thunderbird', 'sunbird', 'seamonkey', or 'fennec'
where query is the actual search query

Query syntax

The query syntax supports straightforward searches like yslow should bring up the yslow addon. Additionally there are a few filters you can use to fine-tune your results.

Category filters

If you wish to filter your query by a specific category you can by doing the following:

[query] category:[category short name] 

Where [category short name] is the first word of a category name (in en-US) e.g. "alerts" is "Alerts & Updates"

For example:

yslow category:alerts 

will look for addons matching "yslow" in the category "Alerts & Updates"

Tag filters

If you wish to filter your query by a specific tag you can by doing the following:

[query] tag:[tag] 

Where [tag] is the tag.

For example:

yslow tag:webdev 

will look for addons matching "yslow" tagged as "webdev"

Version filters

If you wish to look for addons that support a specific version of Firefox/Thunderbird/Sunbird/etc:

[query] version:[version] 

Where [version] is the version number e.g. 1.0,2.0,3.5.

For example:

yslow version:3.5 

will look for addons matching "yslow" that are supported in version 3.5 of the select application i.e. if you are in /en-US/firefox then this will work in version 3.5 of firefox.

Type filters

If you wish to look for addons of a specific type (e.g. extension, theme, etc) you can use the following syntax:

[query] type:[type] 

Where [type] is the addon type e.g. plugin, extension, theme, etc

For example:

yslow type:theme 

will look for addons matching "yslow" that are themes.

Platform filters

If you wish to look for addons that work on a specific platform (linux, mac, etc)

[query] platform:[type] 

Where [platform] is the OS in which you'd like to run the addon

For example:

yslow platform:mac 

will look for addons matching "yslow" that will run on the Mac OS platform.

Date filter

If you wish to look for addons that were updated after a certain date

[query] after:[YYYY-MM-DD]

Where [YYYY-MM-DD] is the date format

For example:

yslow after:2008-03-04 

will look for addons matching "yslow" that were updated after 4 March 2008.