Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > main > by-pkgid > 0afeee9cca140e167a996902b9a677c5 > files > 2782

php-manual-en-4.3.0-2mdk.noarch.rpm

<HTML
><HEAD
><TITLE
>udm_load_ispell_data</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="PHP Manual"
HREF="index.html"><LINK
REL="UP"
TITLE="mnoGoSearch Functions"
HREF="ref.mnogo.html"><LINK
REL="PREVIOUS"
TITLE="udm_get_res_param"
HREF="function.udm-get-res-param.html"><LINK
REL="NEXT"
TITLE="udm_open_stored"
HREF="function.udm-open-stored.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-1"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.udm-get-res-param.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.udm-open-stored.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.udm-load-ispell-data"
></A
>udm_load_ispell_data</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN56935"
></A
><P
>    (PHP 4 &#62;= 4.0.5)</P
>udm_load_ispell_data&nbsp;--&nbsp;Load ispell data</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN56938"
></A
><H2
>Description</H2
>int <B
CLASS="methodname"
>udm_load_ispell_data</B
> ( int agent, int var, string val1, string val2, int flag)<BR
></BR
><P
>&#13;    <B
CLASS="function"
>udm_load_ispell_data()</B
> loads ispell data. Returns <TT
CLASS="constant"
><B
>TRUE</B
></TT
> 
    on success, <TT
CLASS="constant"
><B
>FALSE</B
></TT
> on error.
   </P
><P
>&#13;    <TT
CLASS="parameter"
><I
>agent</I
></TT
> - agent link identifier, received after call 
    to <A
HREF="function.udm-alloc-agent.html"
><B
CLASS="function"
>udm_alloc_agent()</B
></A
>.
   </P
><P
>&#13;    <TT
CLASS="parameter"
><I
>var</I
></TT
> - parameter, indicating the source for ispell 
    data. May have the following values:
   </P
><P
>&#13;    After using this function to free memory allocated for ispell data, please 
    use <A
HREF="function.udm-free-ispell-data.html"
><B
CLASS="function"
>udm_free_ispell_data()</B
></A
>, even if you use UDM_ISPELL_TYPE_SERVER mode.
   </P
><P
>&#13;    The fastest mode is UDM_ISPELL_TYPE_SERVER. UDM_ISPELL_TYPE_TEXT is slower
    and UDM_ISPELL_TYPE_DB is the slowest. The above pattern is <TT
CLASS="constant"
><B
>TRUE</B
></TT
> for 
    mnoGoSearch 3.1.10 - 3.1.11. It is planned to speed up DB mode in future 
    versions and it is going to be faster than TEXT mode.
   </P
><P
></P
><UL
><LI
><P
>&#13;      UDM_ISPELL_TYPE_DB - indicates that ispell data should be loaded from SQL. 
      In this case, parameters <TT
CLASS="parameter"
><I
>val1</I
></TT
> and <TT
CLASS="parameter"
><I
>val2</I
></TT
>
      are ignored and should be left blank. <TT
CLASS="parameter"
><I
>flag</I
></TT
> 
      should be equal to <TT
CLASS="literal"
>1</TT
>.
     </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>
       <TT
CLASS="parameter"
><I
>flag</I
></TT
> indicates that after loading ispell data 
       from defined source it sould be sorted (it is necessary for correct 
       functioning of ispell). In case of loading ispell data from files 
       there may be several calls to <B
CLASS="function"
>udm_load_ispell_data()</B
>, 
       and there is no sense to sort data after every call, but only after 
       the last one. Since in db mode all the data is loaded by one call, 
       this parameter should have the value <TT
CLASS="literal"
>1</TT
>. In this mode 
       in case of error, e.g. if ispell tables are absent, the function will 
       return <TT
CLASS="constant"
><B
>FALSE</B
></TT
> and code and error message will be accessible through 
       <A
HREF="function.udm-error.html"
><B
CLASS="function"
>udm_error()</B
></A
> and <A
HREF="function.udm-errno.html"
><B
CLASS="function"
>udm_errno()</B
></A
>.
      </P
></BLOCKQUOTE
></DIV
><P
>Example:</P
><DIV
CLASS="informalexample"
><A
NAME="AEN56987"
></A
><P
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>if (! udm_load_ispell_data($udm,UDM_ISPELL_TYPE_DB,'','',1)) {
  printf("Error #%d: '%s'\n", udm_errno($udm), udm_error($udm));
  exit;
}</PRE
></TD
></TR
></TABLE
><P
></P
></DIV
></LI
><LI
><P
>&#13;      UDM_ISPELL_TYPE_AFFIX - indicates that ispell data should be loaded from 
      file and initiates loading affixes file. In this case <TT
CLASS="parameter"
><I
>val1</I
></TT
>
      defines double letter language code for which affixes are loaded,
      and <TT
CLASS="parameter"
><I
>val2</I
></TT
> - file path. Please note, that if 
      a relative path entered, the module looks for the file not in UDM_CONF_DIR, 
      but in relation to current path, i.e. to the path where the script is executed.
      In case of error in this mode, e.g. if file is absent, the function will return 
      <TT
CLASS="constant"
><B
>FALSE</B
></TT
>, and an error message will be displayed. Error message text cannot be 
      accessed through <A
HREF="function.udm-error.html"
><B
CLASS="function"
>udm_error()</B
></A
> and <A
HREF="function.udm-errno.html"
><B
CLASS="function"
>udm_errno()</B
></A
>, 
      since those functions can only return messages associated with SQL. Please, 
      see <TT
CLASS="parameter"
><I
>flag</I
></TT
> parameter description in UDM_ISPELL_TYPE_DB.
     </P
><P
>Example:</P
><DIV
CLASS="informalexample"
><A
NAME="AEN56998"
></A
><P
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>if ((! udm_load_ispell_data($udm,UDM_ISPELL_TYPE_AFFIX,'en','/opt/ispell/en.aff',0)) ||
        (! udm_load_ispell_data($udm,UDM_ISPELL_TYPE_AFFIX,'ru','/opt/ispell/ru.aff',0)) ||
        (! udm_load_ispell_data($udm,UDM_ISPELL_TYPE_SPELL,'en','/opt/ispell/en.dict',0)) ||
        (! udm_load_ispell_data($udm,UDM_ISPELL_TYPE_SPELL,'ru','/opt/ispell/ru.dict',1))) {
     exit;
     }</PRE
></TD
></TR
></TABLE
><P
></P
></DIV
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>
       <TT
CLASS="parameter"
><I
>flag</I
></TT
> is equal to <TT
CLASS="literal"
>1</TT
> only in the last call.
      </P
></BLOCKQUOTE
></DIV
></LI
><LI
><P
>&#13;      UDM_ISPELL_TYPE_SPELL - indicates that ispell data should be loaded from 
      file and initiates loading of ispell dictionary file. In this case 
      <TT
CLASS="parameter"
><I
>val1</I
></TT
> defines double letter language code for which 
      affixes are loaded,
      and <TT
CLASS="parameter"
><I
>val2</I
></TT
> - file path. Please note, that if a relative 
      path entered, the module looks for the file not in UDM_CONF_DIR, but in 
      relation to current path, i.e. to the path where the script is executed.
      In case of error in this mode, e.g. if file is absent, the function will 
      return <TT
CLASS="constant"
><B
>FALSE</B
></TT
>, and an error message will be displayed. Error message text 
      cannot be accessed through <A
HREF="function.udm-error.html"
><B
CLASS="function"
>udm_error()</B
></A
> and 
      <A
HREF="function.udm-errno.html"
><B
CLASS="function"
>udm_errno()</B
></A
>, since those functions can only return messages 
      associated with SQL. Please, see <TT
CLASS="parameter"
><I
>flag</I
></TT
> parameter 
      description in UDM_ISPELL_TYPE_DB.
     </P
><DIV
CLASS="informalexample"
><A
NAME="AEN57012"
></A
><P
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>if ((! Udm_Load_Ispell_Data($udm,UDM_ISPELL_TYPE_AFFIX,'en','/opt/ispell/en.aff',0)) ||
        (! Udm_Load_Ispell_Data($udm,UDM_ISPELL_TYPE_AFFIX,'ru','/opt/ispell/ru.aff',0)) ||
        (! Udm_Load_Ispell_Data($udm,UDM_ISPELL_TYPE_SPELL,'en','/opt/ispell/en.dict',0)) ||
        (! Udm_Load_Ispell_Data($udm,UDM_ISPELL_TYPE_SPELL,'ru','/opt/ispell/ru.dict',1))) {
      exit;
      }</PRE
></TD
></TR
></TABLE
><P
></P
></DIV
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>
       <TT
CLASS="parameter"
><I
>flag</I
></TT
> is equal to <TT
CLASS="literal"
>1</TT
> only in the last call.
      </P
></BLOCKQUOTE
></DIV
></LI
><LI
><P
>&#13;      UDM_ISPELL_TYPE_SERVER - enables spell server support. 
      <TT
CLASS="parameter"
><I
>val1</I
></TT
> parameter indicates
      address of the host running spell server. <TT
CLASS="parameter"
><I
>val2</I
></TT
> `
      is not used yet, but in future releases it is going to indicate number 
      of port used by spell server. <TT
CLASS="parameter"
><I
>flag</I
></TT
> parameter in 
      this case is not needed since ispell data is stored
      on spellserver already sorted.
     </P
><P
>&#13;      Spelld server reads spell-data from a separate configuration file
      (/usr/local/mnogosearch/etc/spelld.conf by default), sorts it and stores in
      memory. With clients server communicates in two ways: to indexer all the
      data is transferred (so that indexer starts faster), from search.cgi server
      receives word to normalize and then passes over to client (search.cgi) list
      of normalized word forms. This allows fastest, compared to db and text modes
      processing of search queries (by omitting loading and sorting all the spell data).
     </P
><P
>&#13;      <B
CLASS="function"
>udm_load_ispell_data()</B
> function in UDM_ISPELL_TYPE_SERVER 
      mode does not actually load ispell data, but only defines server address. 
      In fact, server is automatically used by <A
HREF="function.udm-find.html"
><B
CLASS="function"
>udm_find()</B
></A
> 
      function when performing search. In case of errors, e.g. if spellserver
      is not running or invalid host indicated, there are no messages returned 
      and ispell conversion does not work.
     </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>
       This function is available in mnoGoSearch 3.1.12 or later.
      </P
></BLOCKQUOTE
></DIV
><P
>Example:</P
><DIV
CLASS="informalexample"
><A
NAME="AEN57030"
></A
><P
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>if (!udm_load_ispell_data($udm,UDM_ISPELL_TYPE_SERVER,'','',1)) {
    printf("Error loading ispell data from server&#60;br&#62;\n");
    exit;
}</PRE
></TD
></TR
></TABLE
><P
></P
></DIV
></LI
></UL
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.udm-get-res-param.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.udm-open-stored.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>udm_get_res_param</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.mnogo.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>udm_open_stored</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>