Source of: /manual/en/function.swishsearch-setlimit.php
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.swish.inc";
$setup = array (
'home' =>
array (
0 => 'index.php',
1 => 'PHP Manual',
),
'head' =>
array (
0 => 'UTF-8',
1 => 'en',
),
'this' =>
array (
0 => 'function.swishsearch-setlimit.php',
1 => 'SwishSearch->setLimit',
),
'up' =>
array (
0 => 'ref.swish.php',
1 => 'Swish Functions',
),
'prev' =>
array (
0 => 'function.swishsearch-resetlimit.php',
1 => 'SwishSearch->resetLimit',
),
'next' =>
array (
0 => 'function.swishsearch-setphrasedelimiter.php',
1 => 'SwishSearch->setPhraseDelimiter',
),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);
manual_header();
?>
<div id="function.swishsearch-setlimit" class="refentry">
<div class="refnamediv">
<h1 class="refname">SwishSearch->setLimit</h1>
<p class="verinfo">(PECL swish >= 0.1.0)</p><p class="refpurpose"><span class="refname">SwishSearch->setLimit</span> — <span class="dc-title">Set the search limits</span></p>
</div>
<a name="function.swishsearch-setlimit.description"></a><div class="refsect1 description">
<h3 class="title">Description</h3>
<div class="methodsynopsis dc-description">
<span class="type"><span class="type void">void</span></span> <span class="methodname"><b>SwishSearch->setLimit</b></span>
( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$property</tt></span>
, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$low</tt></span>
, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$high</tt></span>
)</div>
<div class="warning"><b class="warning">Warning</b><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>
<a name="function.swishsearch-setlimit.parameters"></a><div class="refsect1 parameters">
<h3 class="title">Parameters</h3>
<p class="para">
</p><dl>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">property</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
Search result property name.
</p>
</dd>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">low</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
The lowest value of the property.
</p>
</dd>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">high</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
The highest value of the property.
</p>
</dd>
</dl>
<p>
</p>
</div>
<a name="function.swishsearch-setlimit.returnvalues"></a><div class="refsect1 returnvalues">
<h3 class="title">Return Values</h3>
<p class="para">
No value is returned.
</p>
</div>
<a name="function.swishsearch-setlimit.errors"></a><div class="refsect1 errors">
<h3 class="title">Errors/Exceptions</h3>
<p class="para">
Throws <b class="classname">SwishException</b> on error.
</p>
</div>
<a name="function.swishsearch-setlimit.examples"></a><div class="refsect1 examples">
<h3 class="title">Examples</h3>
<p class="para">
</p><div class="example">
<p><b>Example #1 Basic <b>SwishSearch->setLimit()</b> example</b></p>
<div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB"><?php<br /></span><span style="color: #007700">try {<br /><br /> </span><span style="color: #0000BB">$swish </span><span style="color: #007700">= new </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 /> </span><span style="color: #0000BB">$search </span><span style="color: #007700">= </span><span style="color: #0000BB">$swish</span><span style="color: #007700">-></span><span style="color: #0000BB">prepare</span><span style="color: #007700">();<br /><br /> </span><span style="color: #0000BB">$results </span><span style="color: #007700">= </span><span style="color: #0000BB">$search</span><span style="color: #007700">-></span><span style="color: #0000BB">execute</span><span style="color: #007700">(</span><span style="color: #DD0000">"time"</span><span style="color: #007700">);<br /> echo </span><span style="color: #DD0000">"First query found: "</span><span style="color: #007700">, </span><span style="color: #0000BB">$results</span><span style="color: #007700">-></span><span style="color: #0000BB">hits</span><span style="color: #007700">, </span><span style="color: #DD0000">" hits\n"</span><span style="color: #007700">;<br /><br /> </span><span style="color: #0000BB">$i </span><span style="color: #007700">= </span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /> while(</span><span style="color: #0000BB">$result </span><span style="color: #007700">= </span><span style="color: #0000BB">$results</span><span style="color: #007700">-></span><span style="color: #0000BB">nextResult</span><span style="color: #007700">()) {<br /> echo </span><span style="color: #DD0000">"Hit #"</span><span style="color: #007700">, ++</span><span style="color: #0000BB">$i</span><span style="color: #007700">, </span><span style="color: #DD0000">" - "</span><span style="color: #007700">, </span><span style="color: #0000BB">$result</span><span style="color: #007700">-></span><span style="color: #0000BB">swishdocsize</span><span style="color: #007700">, </span><span style="color: #DD0000">" bytes\n"</span><span style="color: #007700">;<br /> }<br /><br /> </span><span style="color: #0000BB">$search</span><span style="color: #007700">-></span><span style="color: #0000BB">setLimit</span><span style="color: #007700">(</span><span style="color: #DD0000">"swishdocsize"</span><span style="color: #007700">, </span><span style="color: #DD0000">"3000"</span><span style="color: #007700">, </span><span style="color: #DD0000">"6000"</span><span style="color: #007700">); </span><span style="color: #FF8000">//limit by document size, from 3000 to 6000 bytes<br /> </span><span style="color: #0000BB">$results </span><span style="color: #007700">= </span><span style="color: #0000BB">$search</span><span style="color: #007700">-></span><span style="color: #0000BB">execute</span><span style="color: #007700">(</span><span style="color: #DD0000">"time"</span><span style="color: #007700">);<br /> echo </span><span style="color: #DD0000">"Second query found: "</span><span style="color: #007700">, </span><span style="color: #0000BB">$results</span><span style="color: #007700">-></span><span style="color: #0000BB">hits</span><span style="color: #007700">, </span><span style="color: #DD0000">" hits\n"</span><span style="color: #007700">;<br /><br /> </span><span style="color: #0000BB">$i </span><span style="color: #007700">= </span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /> while(</span><span style="color: #0000BB">$result </span><span style="color: #007700">= </span><span style="color: #0000BB">$results</span><span style="color: #007700">-></span><span style="color: #0000BB">nextResult</span><span style="color: #007700">()) {<br /> echo </span><span style="color: #DD0000">"Hit #"</span><span style="color: #007700">, ++</span><span style="color: #0000BB">$i</span><span style="color: #007700">, </span><span style="color: #DD0000">" - "</span><span style="color: #007700">, </span><span style="color: #0000BB">$result</span><span style="color: #007700">-></span><span style="color: #0000BB">swishdocsize</span><span style="color: #007700">, </span><span style="color: #DD0000">" bytes\n"</span><span style="color: #007700">;<br /> }<br /><br />} catch (</span><span style="color: #0000BB">SwishException $e</span><span style="color: #007700">) {<br /> echo </span><span style="color: #0000BB">$e</span><span style="color: #007700">-></span><span style="color: #0000BB">getMessage</span><span style="color: #007700">(), </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #0000BB">?></span>
</span>
</code></div>
</div>
<div class="example-contents para"><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>
</p>
</div>
</div><?php manual_footer(); ?>