Filters

A filter is a named rule which causes APS Catalog to return only packages that meet a specific filtering criterion. A client creates a filter using indexes and feeds: An index contains the filter name and the filtering criterion; a feed contains information about packages that meet such criterion. For instance, to filter packages by vendors, a client must perform the following steps:

  1. Retrieve vendor names and links to Vendor indexes from a Repository index.
  2. Display vendors list to a user.
  3. Retrieve an index corresponding to the vendor (after the user chooses one of the vendors).
  4. Fetch a feed link from the index.
  5. Display the feed content to the user.

This example outlines the routine of using such filters. It is as follows:

  1. A client retrieves descriptions of lower-level indexes and links to these indexes from a current index. For instructions on how to do it, see the Retrieving Information from Indexes section.
  2. The client displays these descriptions as filter names to a user
  3. The user chooses one of the filter names.
  4. The client extracts a feed link from an index corresponding to the filter name. For instructions on how to do it, see the Discovering Feeds section.
  5. The client displays feed content to the user. As all feeds have the same syntax, this step is performed using the same instructions as described in the Retrieving Repository Feed and Displaying Its Content section.

 

According to the APS, each package pertains to one or more categories. A client can filter packages by these categories. To do it, a client must perform the following steps:

  1. Retrieve a Repository index.
  2. Extract a list of categories by parsing the index for the //select[@id='category'].
  3. Generate a feed link to each category. Each such link looks as follows: <formAction>?<selectName>=<optValue>
    Here

    For instance, we have the following part of a Repository index:

    <form id="filterForm" action="../1.atom" method="get">

    <label for="name">Application name:</label>

    <input type="text" id="name" name="name" value="" /><br />

    <label for="category">Category</label>

    <select id="category" name="category">

    <optgroup label="Web">

    <option value="Web/Wiki">Wiki</option>

    </optgroup>

    </select>

    After parsing this part, a client must get a Web/Wiki category with a feed link ../1.atom?category=Web/Wiki.

  4. Display the feed content on a user's request.

A client can also filter the APS Catalog content by packagers. To do it, a client must repeat the previous procedure substituting id='category' by id='packager'.

 

A client can perform even more complex filtering. To build this functionality into a client, you can use facilities provided by indexes, search descriptions, or both. For details on facilities provided by indexes, we recommend you to elaborate the XML structure of each index. For description of indexes XML structure, see the Indexes section. For details on search descriptions, refer to the next section.