Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 12270

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!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>Set the search limits</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="swishsearch.resetlimit.html">SwishSearch::resetLimit</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="swishsearch.setphrasedelimiter.html">SwishSearch::setPhraseDelimiter</a></div>
 <div class="up"><a href="ref.swish.html">Swish Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="swishsearch.setlimit" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">SwishSearch::setLimit</h1>
  <p class="verinfo">(PECL swish &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">SwishSearch::setLimit</span> &mdash; <span class="dc-title">Set the search limits</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-swishsearch.setlimit-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>SwishSearch::setLimit</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$property</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$low</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$high</code></span>
   )</div>

  <div class="warning"><strong class="warning">Warning</strong><p class="simpara">This function is
<em class="emphasis">EXPERIMENTAL</em>. The behaviour of this function, its name, and
surrounding documentation may change without notice in a future release of PHP.
This function should be used at your own risk.
</p></div>
 </div>

 <div class="refsect1 parameters" id="refsect1-swishsearch.setlimit-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">property</code></em></span>
     <dd>

      <p class="para">
       Search result property name.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">low</code></em></span>
     <dd>

      <p class="para">
       The lowest value of the property.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">high</code></em></span>
     <dd>

      <p class="para">
       The highest value of the property.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-swishsearch.setlimit-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   No value is returned.
  </p>
 </div>

 <div class="refsect1 errors" id="refsect1-swishsearch.setlimit-errors">
  <h3 class="title">Errors/Exceptions</h3>
  <p class="para">
   Throws <strong class="classname">SwishException</strong> on error.
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-swishsearch.setlimit-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-4745">
    <p><strong>Example #1 Basic  <span class="function"><strong>SwishSearch::setLimit()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">try&nbsp;{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$swish&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Swish</span><span style="color: #007700">(</span><span style="color: #DD0000">"index.swish-e"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$search&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$swish</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">prepare</span><span style="color: #007700">();<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$results&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$search</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">execute</span><span style="color: #007700">(</span><span style="color: #DD0000">"time"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"First&nbsp;query&nbsp;found:&nbsp;"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$results</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">hits</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"&nbsp;hits\n"</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;while(</span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$results</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">nextResult</span><span style="color: #007700">())&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Hit&nbsp;#"</span><span style="color: #007700">,&nbsp;++</span><span style="color: #0000BB">$i</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"&nbsp;-&nbsp;"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$result</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">swishdocsize</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"&nbsp;bytes\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$search</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setLimit</span><span style="color: #007700">(</span><span style="color: #DD0000">"swishdocsize"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"3000"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"6000"</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//limit&nbsp;by&nbsp;document&nbsp;size,&nbsp;from&nbsp;3000&nbsp;to&nbsp;6000&nbsp;bytes<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$results&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$search</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">execute</span><span style="color: #007700">(</span><span style="color: #DD0000">"time"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Second&nbsp;query&nbsp;found:&nbsp;"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$results</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">hits</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"&nbsp;hits\n"</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;while(</span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$results</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">nextResult</span><span style="color: #007700">())&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Hit&nbsp;#"</span><span style="color: #007700">,&nbsp;++</span><span style="color: #0000BB">$i</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"&nbsp;-&nbsp;"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$result</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">swishdocsize</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"&nbsp;bytes\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />}&nbsp;catch&nbsp;(</span><span style="color: #0000BB">SwishException&nbsp;$e</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$e</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getMessage</span><span style="color: #007700">(),&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>The above example will output
something similar to:</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
First query found: 5 hits
Hit #1 - 4261 bytes
Hit #2 - 37937 bytes
Hit #3 - 7126 bytes
Hit #4 - 15427 bytes
Hit #5 - 4768 bytes
Second query found: 2 hits
Hit #1 - 4261 bytes
Hit #2 - 4768 bytes
</pre></div>
    </div>
   </div>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="swishsearch.resetlimit.html">SwishSearch::resetLimit</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="swishsearch.setphrasedelimiter.html">SwishSearch::setPhraseDelimiter</a></div>
 <div class="up"><a href="ref.swish.html">Swish Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>