php-doc-en/reference/yaz/functions/yaz-search.xml
Torben Wilson af4410a7e1 Normalized the sgml-default-dtd-file local-variable line for those
still using this, after discussion on the phpdoc list.
From now on, manual.ced will need to be found at ~/.phpdoc/manual.ced.



git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@288721 c90b9560-bf6c-de11-be94-00142212c4b1
2009-09-25 07:04:39 +00:00

205 lines
6.2 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<refentry xml:id="function.yaz-search" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>yaz_search</refname>
<refpurpose>Prepares for a search</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>yaz_search</methodname>
<methodparam><type>resource</type><parameter>id</parameter></methodparam>
<methodparam><type>string</type><parameter>type</parameter></methodparam>
<methodparam><type>string</type><parameter>query</parameter></methodparam>
</methodsynopsis>
<para>
<function>yaz_search</function> prepares for a search on the given
connection.
</para>
<para>
Like <function>yaz_connect</function> this function is non-blocking and
only prepares for a search to be executed later when
<function>yaz_wait</function> is called.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>id</parameter></term>
<listitem>
<para>
The connection resource returned by <function>yaz_connect</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>type</parameter></term>
<listitem>
<para>
This parameter represents the query type - only <literal>"rpn"</literal>
is supported now in which case the third argument specifies a Type-1
query in prefix query notation.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>query</parameter></term>
<listitem>
<para>
The RPN query is a textual representation of the Type-1 query as
defined by the Z39.50 standard. However, in the text representation
as used by YAZ a prefix notation is used, that is the operator
precedes the operands. The query string is a sequence of tokens where
white space is ignored unless surrounded by double quotes. Tokens beginning
with an at-character (<literal>@</literal>) are considered operators,
otherwise they are treated as search terms.
</para>
<table>
<title>RPN Operators</title>
<tgroup cols="2">
<colspec colwidth="1*" colname="construct"/>
<colspec colwidth="2*" colname="description"/>
<thead>
<row>
<entry>Construct</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>@and</literal> query1 query2</entry>
<entry>intersection of query1 and query2</entry>
</row>
<row>
<entry><literal>@or</literal> query1 query2</entry>
<entry>union of query1 and query2</entry>
</row>
<row>
<entry><literal>@not</literal> query1 query2</entry>
<entry>query1 and not query2</entry>
</row>
<row>
<entry><literal>@set</literal> name</entry>
<entry>result set reference</entry>
</row>
<row>
<entry><literal>@attrset</literal> set query</entry>
<entry>
specifies attribute-set for query. This construction is only allowed
once - in the beginning of the whole query
</entry>
</row>
<row>
<entry><literal>@attr</literal> [set] type=value query</entry>
<entry>
applies attribute to query. The type and value are integers
specifying the attribute-type and attribute-value respectively.
The set, if given, specifies the attribute-set.
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
You can find information about attributes at the
<link xlink:href="&url.yaz-loc-bib1;">Z39.50 Maintenance Agency</link>
site.
</para>
<note>
<para>
If you would like to use a more friendly notation,
use the CCL parser - functions <function>yaz_ccl_conf</function> and
<function>yaz_ccl_parse</function>.
</para>
</note>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title>Query Examples</title>
<para>
You can search for simple terms, like this:
<screen>
<![CDATA[
computer
]]>
</screen>
which matches documents where "computer" occur. No attributes are
specified.
</para>
<para>
The query
<screen>
<![CDATA[
"knuth donald"
]]>
</screen>
matches documents where "knuth donald" occur (provided that the
server supports phrase search).
</para>
<para>
This query applies two attributes for the same phrase.
<screen>@attr 1=1003 @attr 4=1 "knuth donald"</screen>
First attribute is type 1 (Bib-1 use), attribute value is 1003
(Author).
Second attribute has is type 4 (structure), value 1 (phrase),
so this should match documents where Donald Knuth is author.
</para>
<para>
The query
<screen>
<![CDATA[
@and @or a b @not @or c d e
]]>
</screen>
would in infix notation look like <literal>(a or b) and ((c or d) not
e)</literal>.
</para>
<para>
Another, more complex, one:
<screen>
<![CDATA[
@attrset gils @and @attr 1=4 art @attr 1=2000 company
]]>
</screen>
The query as a whole uses the GILS attributeset. The query matches
documents where <literal>art</literal> occur in the title (GILS,BIB-1)
and in which <literal>company</literal> occur as Distributor (GILS).
</para>
</example>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->