Added the mnogosearch functions.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@40946 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Egon Schmid 2001-02-07 11:56:30 +00:00
parent 468d47a266
commit 48bc5a490a

462
functions/mnogosearch.xml Normal file
View file

@ -0,0 +1,462 @@
<reference id="ref.mnogo">
<title>mnoGoSearch Functions</title>
<titleabbrev>mnoGoSearch</titleabbrev>
<partintro>
<simpara>
These functions allow you to access mnoGoSearch (former
UdmSearch) free search engine. In order to have these
functions available, you must compile php with mnogosearch
support by using the <option role="configure">--with-mnogosearch
</option> option. If you use this option without specifying the
path to mnogosearch, php will look for mnogosearch under
/usr/local/mnogosearch path by default. If you installed
mnogosearch at the other path you should specify it: <option
role="configure">--with-mnogosearch=DIR</option>.
</simpara>
<note>
<para>
php contains built-in mysql access library, which can be used to
access mysql. It is known that mnoGoSearch is not compatible with
this built-in library and can work only with generic mysql
libraries. Thus, if you use mnoGoSearch with mysql, during php
configuration you have to indicate directory of mysql
installation, i.e. for example: <option
role="configure">--with-mnogosearch --with-mysql=/usr</option>
</para>
</note>
<simpara>
You need at least 3.1.9 version of mnoGoSearch installed to use
these functions.
</simpara>
<simpara>
More information about mnoGoSearch can be found at<ulink
url="&url.mnogo">&url.mnogo;</ulink>.
</simpara>
</partintro>
<refentry id="function.Udm_Alloc_Agent">
<refnamediv>
<refname>Udm_Alloc_Agent</refname>
<refpurpose>Allocate mnoGoSearch session</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>int <function>udm_alloc_agent</function></funcdef>
<paramdef>string <parameter>dbaddr</parameter></paramdef>
<paramdef>string
<parameter>
<optional>dbmode</optional>
</parameter>
</paramdef>
</funcprototype>
</funcsynopsis>
<para>
<function>Udm_Alloc_Agent</function> returns mnogosearch agent
identifier on success, false on error. This function creates a
session with database parameters.
</para>
<note>
<para>
In fact this function does not open connection to database and
thus does not check entered login and password.
</para>
</note>
</refsect1>
</refentry>
<refentry id="function.Udm_Set_Agent_Param">
<refnamediv>
<refname>Udm_Set_Agent_Param</refname>
<refpurpose>Set mnoGoSearch agent session parameters</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef><function>Udm_Set_Agent_Param</function></funcdef>
<paramdef>int <parameter>agent</parameter></paramdef>
<paramdef>int <parameter>var</parameter></paramdef>
<paramdef>string <parameter>val</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
<function>Udm_Alloc_Agent</function> returns true on success,
false on error. Defines mnoGoSearch session parameters.
</para>
<para>
The following parameters and their values are available:
</para>
<para>
<parameter>UDM_PARAM_PAGE_NUM</parameter> used to choose search
results page number (results are returned by pages beginning from
0, with <parameter>UDM_PARAM_PAGE_SIZE</parameter> results per
page).
</para>
<para>
<parameter>UDM_PARAM_PAGE_SIZE</parameter> - number of search
results displayed on one page.
</para>
<para>
<parameter>UDM_PARAM_SEARCH_MODE</parameter> - search mode. The
following values available: <parameter>UDM_MODE_ALL</parameter> -
search for all words <parameter>UDM_MODE_ANY</parameter> - search
for any word <parameter>UDM_MODE_BOOL</parameter> - boolean
query.
</para>
<para>
<parameter>UDM_PARAM_CACHE_MODE</parameter> - turns on or off
search cache mode. Available values:
<parameter>UDM_CACHE_ENABLED</parameter>,
<parameter>UDM_CACHE_DISABLED</parameter>
</para>
<para>
<parameter>UDM_PARAM_TRACK_MODE</parameter> - turns on or off
trackquery mode. Available values:
<parameter>UDM_TRACK_ENABLED</parameter>,
<parameter>UDM_TRACK_DISABLED</parameter>
</para>
<para>
<parameter>UDM_PARAM_CHARSET</parameter> - defines local charset.
Available values: set of charsets supported by mnoGoSearch,
e.g. koi8-r, cp1251, ...
</para>
<para>
<parameter>UDM_PARAM_STOPFILE</parameter> - Defines name and path
to stopwords file. (There is a small difference with mnoGoSearch
- if in mnoGoSearch a relative path or no path entered, then it
looks for this file in relation to
<parameter>UDM_CONF_DIR</parameter>, while the module looks for
the file in relation to current path, i.e. to the path where the
script is executed.)
</para>
</refsect1>
</refentry>
<refentry id="function.Udm_Add_Search_Limit">
<refnamediv>
<refname>Udm_Add_Search_Limit</refname>
<refpurpose>Add various search limits</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef><function>udm_add_search_limit</function></funcdef>
<paramdef>int <parameter>agent</parameter></paramdef>
<paramdef>int <parameter>var</parameter></paramdef>
<paramdef>string <parameter>val</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
<function>Udm_Add_Search_Limit</function> returns true on
success, false on error.
</para>
<note>
<para>
This function is not yet implemented, but it is planned to
define various search restrictions - i.e. by category, tag,
date, etc. by analogy with
<parameter>Udm_Set_Agent_Param</parameter>.
</para>
</note>
</refsect1>
</refentry>
<refentry id="function.Udm_Find">
<refnamediv>
<refname>Udm_Find</refname>
<refpurpose>Perform search</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>int <function>udm_find</function></funcdef>
<paramdef>int <parameter>agent</parameter></paramdef>
<paramdef>string <parameter>query</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
<function>Udm_Add_Search_Limit</function> returns true on
success, false on error.
</para>
<para>
The search itself. The first argument - session, the next one -
query itself. To find something just type words you want to find
and press SUBMIT button. For example, "mysql odbc". You should
not use quotes " in query, they are written here only to divide a
query from other text. mnoGoSearch will find all documents that
contain word "mysql" and/or word "odbc". Best documents having
bigger weights will be displayed first. If you use search mode
ALL, search will return documents that contain both (or more)
words you entered. In case you use mode ANY, the search will
return list of documents that contain any of the words you
entered. If you want more advanced results you may use query
language. You should select "bool" match mode in the search
from.
</para>
<para>
mnoGoSearch understands the following boolean operators:
</para>
<para>
&amp; - logical AND. For example, &quot;mysql &amp;
odbc&quot;. mnoGoSearch will find any URLs that contain both
&quot;mysql&quot; and &quot;odbc&quot;.
</para>
<para>
| - logical OR. For example &quot;mysql|odbc&quot;. mnoGoSearch
will find any URLs, that contain word &quot;mysql&quot; or word
&quot;odbc&quot;.
</para>
<para>
~ - logical NOT. For example &quot;mysql &amp; ~odbc&quot;.
mnoGoSearch will find URLs that contain word &quot;mysql&quot;
and do not contain word &quot;odbc&quot; at the same time. Note
that ~ just excludes given word from results. Query
&quot;~odbc&quot; will find nothing!
</para>
<para>
() - group command to compose more complex queries. For example
&quot;(mysql | msql) &amp; ~postgres&quot;. Query language is
simple and powerful at the same time. Just consider query as
usual boolean expression.
</para>
</refsect1>
</refentry>
<refentry id="function.Udm_Get_Res_Param">
<refnamediv>
<refname>Udm_Get_Res_Param</refname>
<refpurpose>Get mnoGoSearch result parameters</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>int <function>udm_get_res_param</function></funcdef>
<paramdef>int <parameter>res</parameter></paramdef>
<paramdef>int <parameter>param</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
<function>Udm_Get_Res_Param</function> returns result parameter
value on success, false on error.
</para>
<para>
<parameter>res</parameter> - a link to result identifier,
received after call to <parameter>Udm-Find</parameter>
</para>
<para>
<parameter>param</parameter> - parameter identifier, can have the
following values:
</para>
<para>
<parameter>UDM_PARAM_NUM_ROWS</parameter> - number of received
found links on the current page. It is equal to
<parameter>UDM_PARAM_PAGE_SIZE</parameter> for all search pages,
on the last page - the rest of links.
</para>
<para>
<parameter>UDM_PARAM_FOUND</parameter> - total number of results
matching the query.
</para>
</refsect1>
</refentry>
<refentry id="function.Udm_Get_Res_Field">
<refnamediv>
<refname>Udm_Get_Res_Field</refname>
<refpurpose>Fetch mnoGoSearch result field</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>int <function>udm_get_res_field</function></funcdef>
<paramdef>int <parameter>res</parameter></paramdef>
<paramdef>int <parameter>row</parameter></paramdef>
<paramdef>int <parameter>field</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
<function>Udm_Alloc_Agent</function> result field value on
success, false on error.
</para>
<para>
<parameter>res</parameter> - a link to result identifier,
received after call to <parameter>Udm-Find</parameter>
</para>
<para>
<parameter>row</parameter> - the number of the link on the
current page. May be from 0 to to
<parameter>UDM_PARAM_NUM_ROWS</parameter>.
</para>
<para>
<parameter>field</parameter> - field identifier, may have the
following values:
</para>
<para>
<parameter>UDM_FIELD_URL</parameter> - URL field
</para>
<para>
<parameter>UDM_FIELD_CONTENT</parameter> - Content-type field.
</para>
<para>
<parameter>UDM_FIELD_TITLE</parameter> - Title fo the page.
</para>
<para>
<parameter>UDM_FIELD_KEYWORDS</parameter> - keywords, defined in
the META tag of the page.
</para>
<para>
<parameter>UDM_FIELD_DESC</parameter> - description, defined in
the META tag of the page.
</para>
<para>
<parameter>UDM_FIELD_TEXT</parameter> - text of the page's body.
</para>
<para>
<parameter>UDM_FIELD_SIZE</parameter> - page size.
</para>
<para>
<parameter>UDM_FIELD_URLID</parameter> - unique link ID
</para>
<para>
<parameter>UDM_FIELD_SCORE</parameter> - page rating.
</para>
<para>
<parameter>UDM_FIELD_MODIFIED</parameter> - last_modified field
in unixtime format.
</para>
</refsect1>
</refentry>
<refentry id="function.Udm_Free_Res">
<refnamediv>
<refname>Udm_Free_Res</refname>
<refpurpose>mnoGoSearch free result</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>int <function>udm_free_res</function></funcdef>
<paramdef>int <parameter>res</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
<function>udm_free_res</function> returns true on success, false
on error.
</para>
<para>
<parameter>res</parameter> - a link to result identifier,
received after call to <parameter>Udm-Find</parameter>
</para>
<para>
Freeing up memory allocated for results.
</para>
</refsect1>
</refentry>
<refentry id="function.Udm_Free_Agent">
<refnamediv>
<refname>Udm_Free_Agent</refname>
<refpurpose>Free mnoGoSearch session</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>int <function>udm_free_agent</function></funcdef>
<paramdef>int <parameter>agent</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
<function>udm_free_res</function> returns true on success, false
on error.
</para>
<para>
<parameter>agent</parameter> - link to agent identifier, received
after call to <parameter>Udm_Alloc_Agent</parameter>
</para>
<para>
Freeing up memory allocated for agent.
</para>
</refsect1>
</refentry>
<refentry id="function.Udm_Errno">
<refnamediv>
<refname>Udm_Errno</refname>
<refpurpose>mnoGoSearch error number</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>int <function>udm_errno</function></funcdef>
<paramdef>int <parameter>agent</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
<function>udm_errno</function> returns mnoGoSearch error number,
zero if no error.
</para>
<para>
<parameter>agent</parameter> - link to agent identifier, received
after call to <parameter>Udm_Alloc_Agent</parameter>
</para>
<para>
Receiving numeric agent error code.
</para>
</refsect1>
</refentry>
<refentry id="function.Udm_Error">
<refnamediv>
<refname>Udm_Error</refname>
<refpurpose>mnoGoSearch error message</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>string <function>udm_error</function></funcdef>
<paramdef>int <parameter>agent</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
<function>udm_error</function> returns mnoGoSearch error message,
empty string if no error.
</para>
<para>
<parameter>agent</parameter> - link to agent identifier, received
after call to <parameter>Udm_Alloc_Agent</parameter>
</para>
<para>
Receiving agent error message.
</para>
</refsect1>
</refentry>
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->