uTools-Manuals/docs/php/udm_add_search_limit.html
2019-04-08 23:22:26 +08:00

155 lines
6.4 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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>Add various search limits</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.udm-add-search-limit" class="refentry">
<div class="refnamediv">
<h1 class="refname">udm_add_search_limit</h1>
<p class="verinfo">(PHP 4 &gt;= 4.0.5, PHP 5 &lt; 5.1.0, PECL mnogosearch &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">udm_add_search_limit</span> &mdash; <span class="dc-title">Add various search limits</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.udm-add-search-limit-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>udm_add_search_limit</strong></span>
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$agent</code></span>
, <span class="methodparam"><span class="type">int</span> <code class="parameter">$var</code></span>
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$val</code></span>
) : <span class="type">bool</span></div>
<p class="para rdfs-comment">
<span class="function"><strong>udm_add_search_limit()</strong></span> adds search restrictions.
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.udm-add-search-limit-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">agent</code></dt>
<dd>
<p class="para">
A link to Agent, received after call to
<span class="function"><a href="udm_alloc_agent.html" class="function">udm_alloc_agent()</a></span>.
</p>
</dd>
<dt>
<code class="parameter">var</code></dt>
<dd>
<p class="para">
Defines the parameter, indicating limits.
Possible <code class="parameter">var</code> values:
<ul class="itemizedlist">
<li class="listitem">
<span class="simpara">
<strong><code>UDM_LIMIT_URL</code></strong> - defines document URL limitations to limit the search
through subsection of the database. It supports SQL % and _ LIKE wildcards,
where % matches any number of characters, even zero characters,
and _ matches exactly one character. E.g. http://www.example.___/catalog
may stand for http://www.example.com/catalog and http://www.example.net/catalog.
</span>
</li>
<li class="listitem">
<span class="simpara">
<strong><code>UDM_LIMIT_TAG</code></strong> - defines site TAG limitations. In indexer-conf you can
assign specific TAGs to various sites and parts of a site. Tags in
mnoGoSearch 3.1.x are lines, that may contain metasymbols % and _.
Metasymbols allow searching among groups of tags.
E.g. there are links with tags ABCD and ABCE, and search restriction
is by ABC_ - the search will be made among both of the tags.
</span>
</li>
<li class="listitem">
<span class="simpara">
<strong><code>UDM_LIMIT_LANG</code></strong> - defines document language limitations.
</span>
</li>
<li class="listitem">
<span class="simpara">
<strong><code>UDM_LIMIT_CAT</code></strong> - defines document category limitations. Categories are
similar to tag feature, but nested. So you can have one category inside
another and so on. You have to use two characters for each level. Use a
hex number going from 0-F or a 36 base number going from 0-Z.
Therefore a top-level category like &#039;Auto&#039; would be 01. If it has a
subcategory like &#039;Ford&#039;, then it would be 01 (the parent category) and then
&#039;Ford&#039; which we will give 01. Put those together and you get 0101. If &#039;Auto&#039;
had another subcategory named &#039;VW&#039;, then it&#039;s id would be 01 because it
belongs to the &#039;Ford&#039; category and then 02 because it&#039;s the next category.
So it&#039;s id would be 0102. If VW had a sub category called &#039;Engine&#039; then it&#039;s
id would start at 01 again and it would get the &#039;VW&#039; id 02 and &#039;Auto&#039; id of
01, making it 010201. If you want to search for sites under that category
then you pass it cat=010201 in the URL.
</span>
</li>
<li class="listitem">
<p class="para">
<strong><code>UDM_LIMIT_DATE</code></strong> - defines limitation by date the document was modified.
</p>
<p class="para">
Format of parameter value: a string with first character &lt; or &gt;,
then with no space - date in unixtime format, for example:
</p>
<p class="para">
<div class="example" id="zookeeper.create.example.basic">
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />udm_add_search_limit</span><span style="color: #007700">(</span><span style="color: #0000BB">$udm</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">UDM_LIMIT_DATE</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"&amp;lt;908012006"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
</div>
</p>
<p class="para">
If &gt; character is used, then the search will be restricted to those
documents having a modification date greater than entered, if &lt;, then smaller.
</p>
</li>
</ul>
</p>
</dd>
<dt>
<code class="parameter">val</code></dt>
<dd>
<p class="para">
Defines the value of the current parameter.
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.udm-add-search-limit-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
成功时返回 <strong><code>TRUE</code></strong> 或者在失败时返回 <strong><code>FALSE</code></strong>
</p>
</div>
</div></div></div></body></html>