Facet Service
From n² wiki
This is the Platform API documentation for the Facet service.
This service provides faceted browsing capabilities for a store.
Contents |
[edit] URI Pattern
http://api.talis.com/stores/{storename}/services/facet
[edit] Resource Operations
| URI Pattern | Method | Request Body | Semantics | Capability required |
|---|---|---|---|---|
| /services/facet | GET | Retrieve an HTML form | basic search | |
| /services/facet?query=&fields= | GET | Perform a Facetted Browse | basic search |
[edit] Request Parameters
| Parameter | Required? | Description | Values |
|---|---|---|---|
| query | Yes | The query expression for which the top ranking terms should be calculated | Text Search Syntax |
| field | Yes | A comma delimited list of fields for which top ranking terms are to be returned | Any valid field (see Field Predicate Map |
| top | No | The maximum number of terms to return for each field | An Integer. Default is 5 |
| output | No | Selects the Output Type |
|
[edit] Facetted Browsing
[edit] XML Output Format
The root element of the result is <facet-service>. This contains a <head> element which contains one child element for each of the service parameters containing the values supplied for this request.
The <fields> element contains one <field> child element per field that is analysed by the service. Fields that have no matching terms are included as empty elements. Fields specified in the request that do not exist in the bigfoot store are not included as child elements.
The search-uri attribute contains the URI the user can use to obtain the results for the given field value. The number attribute contains an indicative number of items that match the given query and field value - this is not guaranteed to be the same as the number of results obtained by querying the contentbox directly.
<?xml version="1.0"?>
<facet-results xmlns="http://schemas.talis.com/2007/facet-results#">
<head>
<query>austen</query>
<fields>title,author,some-other-field</fields>
</head>
<fields>
<field name="title">
<term number="19" search-uri="http://api.talis.com/bf/stores/ukbib/items?query=austen+title:%22Pride+and+prejudice%22" >Pride and prejudice</term>
<term number="12" search-uri="http://api.talis.com/bf/stores/ukbib/items?query=austen+title:%22Emma%22">Emma</term>
<term number="9" search-uri="http://api.talis.com/bf/stores/ukbib/items?query=austen+title:%22Northanger+Abbey%22">Northanger Abbey</term>
<term number="8" search-uri="http://api.talis.com/bf/stores/ukbib/items?query=austen+title:%22Mansfield+Park%22">Mansfield Park</term>
</field>
<field name="some-other-field"/>
<field name="author">
<term number="91" search-uri="http://api.talis.com/bf/stores/ukbib/items?query=austen+author:%22Austen,+Jane,%22">Austen, Jane,</term>
<term number="6" search-uri="http://api.talis.com/bf/stores/ukbib/items?query=austen+author:%22Jane+Austen+Society.%22">Jane Austen Society.</term>
<term number="3" search-uri="http://api.talis.com/bf/stores/ukbib/items?query=austen+author:%22Evans,+J.+M.+(Jessie+Maud)%22">Evans, J. M. (Jessie Maud)</term>
<term number="3" search-uri="http://api.talis.com/bf/stores/ukbib/items?query=austen+author:%22Chapman,+R.+W.+(Robert+William)%22">Chapman, R. W. (Robert William)</term>
</field>
</fields>
</facet-result>
[edit] HTML Output Format
The HTML output format option provides a simple way to visualize the results of the Facet service.
The results are delivered with a link to fetch matching items or browse within additional facets.

