1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<refentry id="function.yaz-search">
<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
<ulink url="&url.yaz-loc-bib1;">Z39.50 Maintenance Agency</ulink>
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:"../../../../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
-->
|