Skip to content
David E. Wheeler edited this page Apr 28, 2011 · 15 revisions

Search API

  • Name: dist
  • Returns: application/json
  • URI Template Variables: {in}
  • Availability: API Server

Full text search API. Returns JSON describing the search results, as well as a few metadata points. The index to be searched is determined by the {in} URI template variable, which may be any one of the following values:

  • docs: Search the documentation.
  • dists: Search distribution metadata, including READMEs and tags.
  • extensions: Search extension metadata
  • tags: Search tags
  • users: Search users

Parameters

The API supports the following parameters, which must be submitted via a URL encoded GET query string ("R" column indicates required parameters):

R Param Type Default Description
q String The search query.
 | **`o`**   | Number   |        0    | Query results offset.
 | **`l`**   | Number   |       50    | Query results limit.

The offset may be any positive integer and defaults to 0. The limit may be any positive integer between 1 and 1024. Defaults to 50 wen not specified, and reverts to 50 when any non-supported value is passed.

Query Syntax

Search queries are free-form but support a few operators.

TBD.

Result Structure

The structure of the returned API is a single JSON object with the following keys:

Key Type Description
query String The search query string
offset Number The the results offset.
limit Number The results limit.
count Number The total number of results.
hits Array The actual results in descending order by score.

The contents of the hits array is a list of objects, the structure of which varies depending on the value of the {in} URI template variable. A few examples:

Docs Hits

Each hit when when searching the docs index reflects a single documentation file that matched the search query. The hit objects contain the following keys:

Key Type Description
title String The title of the document
excerpt String An excerpt from the document highlight matched terms in <strong> elements.
abstract String A short description of the extension documented, if any.
dist String The name of the distribution in which the document is found.
version SemVer The version of the distribution release in which the document is found.
docpath String The path to the document within the distribution release, sans file name suffix.
date Date The date the release was uploaded to PGXN.
user String The nickname of the user who uploaded this release of the distribution.
user_name String The full name of the user who uploaded this release of the distribution.

Dists Hits

Extensions Hits

Users Hits

Tags Hits

Clone this wiki locally