Add documentation about facets
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 5 Mar 2014 11:00:00 +0000 (12:00 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 5 Mar 2014 11:00:00 +0000 (12:00 +0100)
doc/tools.xml
doc/zoom.xml

index 7e4096c..2d9b62b 100644 (file)
@@ -2523,7 +2523,7 @@ int cql_transform_rpn2cql_wrbuf(cql_transform_t ct,
     </para>
    </sect2>
   </sect1>
-  <sect1><title>Sorting</title>
+  <sect1 id="sorting"><title>Sorting</title>
    <para>
     This chapter describes sorting and how it is supported in YAZ.
     Sorting applies to a result-set.
@@ -2597,6 +2597,83 @@ int cql_transform_rpn2cql_wrbuf(cql_transform_t ct,
     </para>
    </sect2>
   </sect1>
+  <sect1 id="facets"><title>Facets</title>
+  <para>
+   YAZ supports facets for in Solr, SRU 2.0 and Z39.50 protocols.
+  </para>
+  <para>
+   Like Type-1/RPN, YAZ supports a string notation for specifying
+   facets. For the API this is performed by
+   <function>yaz_pqf_parse_facet_list</function>.
+  </para>
+  <para>
+   For ZOOM C the facets are given by option "facets"
+   For yaz-client it is used for the facets command.
+  </para>
+  <para>
+   The grammar of this specification is as follows:
+   <literallayout>
+   facet-spec ::= facet-list
+
+   facet-list ::= facet-list ',' attr-spec | attr-spec
+
+   attr-spec ::= attr-spec '@attr' string | '@attr' string
+
+   </literallayout>
+    The notation is inspired by PQF. The string following '@attr'
+    may not include blanks and is of the form
+    <replaceable>type</replaceable><literal>=</literal><replaceable>value</replaceable>,
+    where <replaceable>type</replaceable> is an integer and
+    <replaceable>value</replaceable> is a string or an integer.
+  </para>
+  <para>
+   The Facets specification is not Bib-1. The following types apply:
+  </para>
+   <table id="facet.attributes">
+     <title>Facet attributes</title>
+       <tgroup cols="2">
+        <colspec colwidth="2*" colname="type"></colspec>
+        <colspec colwidth="9*" colname="description"></colspec>
+        <thead>
+         <row>
+          <entry>Type</entry>
+          <entry>Description</entry>
+         </row>
+        </thead>
+        <tbody>
+         <row>
+          <entry>1</entry>
+          <entry>
+            Field-name. This is often a string, eg "Author", "Year", etc.
+          </entry>
+         </row>
+
+         <row>
+          <entry>2</entry>
+          <entry>
+            Sort order. Value should be an integer.
+            Value 0: count descending (frequency). Value 1: alpha ascending.
+          </entry>
+         </row>
+
+         <row>
+          <entry>3</entry>
+          <entry>
+            Number of terms requested.
+          </entry>
+         </row>
+
+         <row>
+          <entry>4</entry>
+          <entry>
+            Start offset.
+          </entry>
+         </row>
+
+         </tbody>
+         </tgroup>
+       </table>
+  </sect1>
  </chapter>
 
  <!-- Keep this comment at the end of the file
index 9595a33..74c95f3 100644 (file)
@@ -293,13 +293,12 @@ ZOOM_options_set_int(opt, name, value)
        first operation), holds the negotiated version with the server
        (same or lower version).
        </entry><entry>1.2</entry></row>
-      <row><entry>
+      <row id="zoom.facets.option"><entry>
         facets</entry><entry>
-       A FacetList is comma-separated list of facet, which is defined
-       as <literal>AttributeList</literal>  and a optional FacetTerm
-       (a Term and a frequency). On request the terms is missing.
-       On response the the list contains the terms that the target
-       could collect.
+        Requested or recommend facets may be given before a search is sent.
+        The value of this setting is described in <xref linkend="facets"/>
+        For inspection of the facets returned, refer to the functions
+        described in <xref linkend="zoom.facets"/>.
        </entry><entry>none</entry></row>
       <row><entry>
         apdulog</entry><entry>
@@ -1035,19 +1034,19 @@ ZOOM_options_set_int(opt, name, value)
   </sect1>
   <sect1 id="zoom.facets"><title>Facets</title>
    <para>
-    Facets operations is not part of the official ZOOM specification, but
-    is an Index Data extension for YAZ-based Z39.50 targets or
-    <ulink url="&url.solr;">Solr</ulink> targets.
-    In case the target can and is requested to return facets, using a
-    result set the ZOOM client can request one or all facet fields.
-    Using a facet field the client can request the term count and then
-    interate over the terms.
+    Facet operations is not part of the official ZOOM specification, but
+    is an Index Data extension for YAZ-based Z39.50 targets,
+    <ulink url="&url.solr;">Solr</ulink> and SRU 2.0 targets.
+
+    Facets may be requestd by the
+     <link linkend="zoom.facets.option">facets</link> option before a
+    search is sent.
+    For inspection of the returned facets, the following functions are
+    available:
    </para>
    <synopsis>
     ZOOM_facet_field *ZOOM_resultset_facets(ZOOM_resultset r);
 
-    const char ** ZOOM_resultset_facets_names(ZOOM_resultset r);
-
     ZOOM_facet_field ZOOM_resultset_get_facet_field(ZOOM_resultset r,
                                                     const char *facet_name);
 
@@ -1069,7 +1068,6 @@ ZOOM_options_set_int(opt, name, value)
     <function>ZOOM_resultset_get_facet_field</function> or
     <function>ZOOM_resultset_get_facet_field_by_index</function>.
     <function>ZOOM_resultset_facets</function>.
-    <function>ZOOM_resultset_facets_names</function>.
     <function>ZOOM_facet_field_name</function>.
     <function>ZOOM_facet_field_get_term</function>.
     </para>