<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.yaz.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'function.yaz-search.php',
    1 => 'yaz_search',
    2 => 'Prepares for a search',
  ),
  'up' => 
  array (
    0 => 'ref.yaz.php',
    1 => 'YAZ Функції',
  ),
  'prev' => 
  array (
    0 => 'function.yaz-schema.php',
    1 => 'yaz_schema',
  ),
  'next' => 
  array (
    0 => 'function.yaz-set-option.php',
    1 => 'yaz_set_option',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/yaz/functions/yaz-search.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.yaz-search" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">yaz_search</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.1, PECL yaz &gt;= 0.9.0)</p><p class="refpurpose"><span class="refname">yaz_search</span> &mdash; <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"><a href="language.types.resource.php" class="type resource">resource</a></span> <code class="parameter">$id</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$type</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$query</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></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="function.yaz-connect.php" 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="function.yaz-wait.php" 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="function.yaz-connect.php" 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 <code class="literal">&quot;rpn&quot;</code>
       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 (<code class="literal">@</code>) 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><code class="literal">@and</code> query1 query2</td>
          <td>intersection of query1 and query2</td>
         </tr>

         <tr>
          <td><code class="literal">@or</code> query1 query2</td>
          <td>union of query1 and query2</td>
         </tr>

         <tr>
          <td><code class="literal">@not</code> query1 query2</td>
          <td>query1 and not query2</td>
         </tr>

         <tr>
          <td><code class="literal">@set</code> name</td>
          <td>result set reference</td>
         </tr>

         <tr>
          <td><code class="literal">@attrset</code> 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><code class="literal">@attr</code> [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">&raquo;&nbsp;Z39.50 Maintenance Agency</a>
       site.
      </p>
      <blockquote class="note"><p><strong class="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="function.yaz-ccl-conf.php" class="function">yaz_ccl_conf()</a></span> and 
        <span class="function"><a href="function.yaz-ccl-parse.php" 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><a href="reserved.constants.php#constant.true">true</a></code></strong> у разі успіху або <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> в разі помилки.
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-function.yaz-search-examples">
  <h3 class="title">Приклади</h3>
  <div class="example" id="example-1">
   <p><strong>Приклад #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 &quot;computer&quot; 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">&quot;knuth donald&quot;</pre>
</div>
    </div>
    matches documents where &quot;knuth donald&quot; 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 &quot;knuth donald&quot;</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 <code class="literal">(a or b) and ((c or d) not 
    e)</code>.
   </p></div>
   <div class="example-contents"><p>
    Another, more complex, one:
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">@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 <code class="literal">art</code> occur in the title (GILS,BIB-1)
    and in which <code class="literal">company</code> occur as Distributor (GILS).
   </p></div>
  </div>
 </div>

</div><?php manual_footer($setup); ?>