mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 05:26:57 +08:00
215 lines
7.5 KiB
HTML
215 lines
7.5 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||
<html>
|
||
<head>
|
||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||
<title>Prepares for a search</title>
|
||
</head>
|
||
<body class="docs"><div id="layout">
|
||
<div id="layout-content"><div id="function.yaz-search" class="refentry">
|
||
<div class="refnamediv">
|
||
<h1 class="refname">yaz_search</h1>
|
||
<p class="verinfo">(PHP 4 >= 4.0.1, PECL yaz >= 0.9.0)</p><p class="refpurpose"><span class="refname">yaz_search</span> — <span class="dc-title">Prepares for a search</span></p>
|
||
|
||
</div>
|
||
<div class="refsect1 description" id="refsect1-function.yaz-search-description">
|
||
<h3 class="title">说明</h3>
|
||
<div class="methodsynopsis dc-description">
|
||
<span class="methodname"><strong>yaz_search</strong></span>
|
||
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$id</code></span>
|
||
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$type</code></span>
|
||
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$query</code></span>
|
||
) : <span class="type">bool</span></div>
|
||
|
||
<p class="para rdfs-comment">
|
||
<span class="function"><strong>yaz_search()</strong></span> prepares for a search on the given
|
||
connection.
|
||
</p>
|
||
<p class="para">
|
||
Like <span class="function"><a href="yaz_connect.html" class="function">yaz_connect()</a></span> this function is non-blocking and
|
||
only prepares for a search to be executed later when
|
||
<span class="function"><a href="yaz_wait.html" class="function">yaz_wait()</a></span> is called.
|
||
</p>
|
||
</div>
|
||
|
||
<div class="refsect1 parameters" id="refsect1-function.yaz-search-parameters">
|
||
<h3 class="title">参数</h3>
|
||
<p class="para">
|
||
<dl>
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">id</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
The connection resource returned by <span class="function"><a href="yaz_connect.html" class="function">yaz_connect()</a></span>.
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">type</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
This parameter represents the query type - only <em>"rpn"</em>
|
||
is supported now in which case the third argument specifies a Type-1
|
||
query in prefix query notation.
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">query</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="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 (<em>@</em>) are considered operators,
|
||
otherwise they are treated as search terms.
|
||
</p>
|
||
<table class="doctable table">
|
||
<caption><strong>RPN Operators</strong></caption>
|
||
|
||
<col width="1*" />
|
||
<col width="2*" />
|
||
<thead>
|
||
<tr>
|
||
<th>Construct</th>
|
||
<th>Description</th>
|
||
</tr>
|
||
|
||
</thead>
|
||
|
||
<tbody class="tbody">
|
||
<tr>
|
||
<td><em>@and</em> query1 query2</td>
|
||
<td>intersection of query1 and query2</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><em>@or</em> query1 query2</td>
|
||
<td>union of query1 and query2</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><em>@not</em> query1 query2</td>
|
||
<td>query1 and not query2</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><em>@set</em> name</td>
|
||
<td>result set reference</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><em>@attrset</em> set query</td>
|
||
<td>
|
||
specifies attribute-set for query. This construction is only allowed
|
||
once - in the beginning of the whole query
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><em>@attr</em> [set] type=value query</td>
|
||
<td>
|
||
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.
|
||
</td>
|
||
</tr>
|
||
|
||
</tbody>
|
||
|
||
</table>
|
||
|
||
<p class="para">
|
||
You can find information about attributes at the
|
||
<a href="http://www.loc.gov/z3950/agency/defns/bib1.html" class="link external">» Z39.50 Maintenance Agency</a>
|
||
site.
|
||
</p>
|
||
<blockquote class="note"><p><strong class="note">Note</strong>:
|
||
<p class="para">
|
||
If you would like to use a more friendly notation,
|
||
use the CCL parser - functions <span class="function"><a href="yaz_ccl_conf.html" class="function">yaz_ccl_conf()</a></span> and
|
||
<span class="function"><a href="yaz_ccl_parse.html" class="function">yaz_ccl_parse()</a></span>.
|
||
</p>
|
||
</p></blockquote>
|
||
</dd>
|
||
|
||
|
||
</dl>
|
||
|
||
</p>
|
||
</div>
|
||
|
||
<div class="refsect1 returnvalues" id="refsect1-function.yaz-search-returnvalues">
|
||
<h3 class="title">返回值</h3>
|
||
<p class="para">
|
||
成功时返回 <strong><code>TRUE</code></strong>, 或者在失败时返回 <strong><code>FALSE</code></strong>。
|
||
</p>
|
||
</div>
|
||
|
||
<div class="refsect1 examples" id="refsect1-function.yaz-search-examples">
|
||
<h3 class="title">范例</h3>
|
||
<div class="example" id="example-5690">
|
||
<p><strong>Example #1 Query Examples</strong></p>
|
||
<div class="example-contents"><p>
|
||
You can search for simple terms, like this:
|
||
<div class="example-contents screen">
|
||
<div class="examplescode"><pre class="examplescode">computer</pre>
|
||
</div>
|
||
</div>
|
||
which matches documents where "computer" occur. No attributes are
|
||
specified.
|
||
</p></div>
|
||
<div class="example-contents"><p>
|
||
The query
|
||
<div class="example-contents screen">
|
||
<div class="examplescode"><pre class="examplescode">"knuth donald"</pre>
|
||
</div>
|
||
</div>
|
||
matches documents where "knuth donald" occur (provided that the
|
||
server supports phrase search).
|
||
</p></div>
|
||
<div class="example-contents"><p>
|
||
This query applies two attributes for the same phrase.
|
||
<div class="example-contents screen">@attr 1=1003 @attr 4=1 "knuth donald"</div>
|
||
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.
|
||
</p></div>
|
||
<div class="example-contents"><p>
|
||
The query
|
||
<div class="example-contents screen">
|
||
<div class="examplescode"><pre class="examplescode">@and @or a b @not @or c d e</pre>
|
||
</div>
|
||
</div>
|
||
would in infix notation look like <em>(a or b) and ((c or d) not
|
||
e)</em>.
|
||
</p></div>
|
||
<div class="example-contents"><p>
|
||
Another, more complex, one:
|
||
<div class="example-contents screen">
|
||
<div class="cdata"><pre>
|
||
@attrset gils @and @attr 1=4 art @attr 1=2000 company
|
||
</pre></div>
|
||
</div>
|
||
The query as a whole uses the GILS attributeset. The query matches
|
||
documents where <em>art</em> occur in the title (GILS,BIB-1)
|
||
and in which <em>company</em> occur as Distributor (GILS).
|
||
</p></div>
|
||
</div>
|
||
</div>
|
||
|
||
</div></div></div></body></html> |