node-zoom
Version:
66 lines (58 loc) • 5.05 kB
HTML
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>5.�Facets</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="YAZ User's Guide and Reference"><link rel="up" href="zoom.html" title="Chapter�3.�ZOOM"><link rel="prev" href="zoom.records.html" title="4.�Records"><link rel="next" href="zoom.scan.html" title="6.�Scan"></head><body><link rel="stylesheet" type="text/css" href="common/style1.css"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">5.�Facets</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="zoom.records.html">Prev</a>�</td><th width="60%" align="center">Chapter�3.�ZOOM</th><td width="20%" align="right">�<a accesskey="n" href="zoom.scan.html">Next</a></td></tr></table><hr></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="zoom.facets"></a>5.�Facets</h2></div></div></div><p>
Facet operations is not part of the official ZOOM specification, but
is an Index Data extension for YAZ-based Z39.50 targets,
<a class="ulink" href="http://lucene.apache.org/solr/" target="_top">Solr</a> and SRU 2.0 targets.
Facets may be requestd by the
<a class="link" href="zoom.html#zoom.facets.option">facets</a> option before a
search is sent.
For inspection of the returned facets, the following functions are
available:
</p><pre class="synopsis">
ZOOM_facet_field *ZOOM_resultset_facets(ZOOM_resultset r);
ZOOM_facet_field ZOOM_resultset_get_facet_field(ZOOM_resultset r,
const char *facet_name);
ZOOM_facet_field ZOOM_resultset_get_facet_field_by_index(ZOOM_resultset r,
int pos);
size_t ZOOM_resultset_facets_size(ZOOM_resultset r);
const char *ZOOM_facet_field_name(ZOOM_facet_field facet_field);
size_t ZOOM_facet_field_term_count(ZOOM_facet_field facet_field);
const char *ZOOM_facet_field_get_term(ZOOM_facet_field facet_field,
size_t idx, int *freq);
</pre><p>
References to temporary structures are returned by all functions.
They are only valid as long the Result set is valid.
<code class="function">ZOOM_resultset_get_facet_field</code> or
<code class="function">ZOOM_resultset_get_facet_field_by_index</code>.
<code class="function">ZOOM_resultset_facets</code>.
<code class="function">ZOOM_facet_field_name</code>.
<code class="function">ZOOM_facet_field_get_term</code>.
</p><p><a name="zoom.resultset.get_facet_field"></a>
A single Facet field is returned by function
<code class="function">ZOOM_resultset_get_facet_field</code> or
<code class="function">ZOOM_resultset_get_facet_field_by_index</code> that takes
a result set and facet name or positive index respectively. First
facet has position zero. If no facet could be obtained (invalid name
or index out of bounds) <code class="literal">NULL</code> is returned.
</p><p><a name="zoom.resultset.facets"></a>
An array of facets field can be returned by
<code class="function">ZOOM_resultset_facets</code>. The length of the array is
given by <code class="function">ZOOM_resultset_facets_size</code>. The array is
zero-based and last entry will be at
<code class="function">ZOOM_resultset_facets_size(result_set)</code>-1.
</p><p><a name="zoom.resultset.facets_names"></a>
It is possible to interate over facets by name, by calling
<code class="function">ZOOM_resultset_facets_names</code>.
This will return an const array of char * where each string can be used
as parameter for <code class="function">ZOOM_resultset_get_facet_field</code>.
</p><p>
Function <code class="function">ZOOM_facet_field_name</code> gets the request
facet name from a returned facet field.
</p><p>
Function <code class="function">ZOOM_facet_field_get_term</code> returns the
idx'th term and term count for a facet field.
Idx must between 0 and
<code class="function">ZOOM_facet_field_term_count</code>-1, otherwise the
returned reference will be <code class="literal">NULL</code>. On a valid idx, the
value of the freq reference will be the term count.
The <code class="literal">freq</code> parameter must be valid pointer to integer.
</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="zoom.records.html">Prev</a>�</td><td width="20%" align="center"><a accesskey="u" href="zoom.html">Up</a></td><td width="40%" align="right">�<a accesskey="n" href="zoom.scan.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">4.�Records�</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">�6.�Scan</td></tr></table></div></body></html>