Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > a2d29ba77c8fe4d655c72d0b897f51ad > files > 360

mnogosearch-3.3.8-3mdv2010.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Template operators</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="mnoGoSearch 3.3.8 reference manual"
HREF="index.html"><LINK
REL="UP"
TITLE="Searching documents"
HREF="msearch-doingsearch.html"><LINK
REL="PREVIOUS"
TITLE="Designing search.htm"
HREF="msearch-html.html"><LINK
REL="NEXT"
TITLE="Ranking documents
     
  "
HREF="msearch-rel.html"><LINK
REL="STYLESHEET"
TYPE="text/css"
HREF="mnogo.css"><META
NAME="Description"
CONTENT="mnoGoSearch - Full Featured Web site Open Source Search Engine Software over the Internet and Intranet Web Sites Based on SQL Database. It is a Free search software covered by GNU license."><META
NAME="Keywords"
CONTENT="shareware, freeware, download, internet, unix, utilities, search engine, text retrieval, knowledge retrieval, text search, information retrieval, database search, mining, intranet, webserver, index, spider, filesearch, meta, free, open source, full-text, udmsearch, website, find, opensource, search, searching, software, udmsearch, engine, indexing, system, web, ftp, http, cgi, php, SQL, MySQL, database, php3, FreeBSD, Linux, Unix, mnoGoSearch, MacOS X, Mac OS X, Windows, 2000, NT, 95, 98, GNU, GPL, url, grabbing"></HEAD
><BODY
CLASS="sect1"
BGCOLOR="#EEEEEE"
TEXT="#000000"
LINK="#000080"
VLINK="#800080"
ALINK="#FF0000"
><!--#include virtual="body-before.html"--><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
><SPAN
CLASS="application"
>mnoGoSearch</SPAN
> 3.3.8 reference manual: Full-featured search engine software</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="msearch-html.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 10. Searching documents</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="msearch-rel.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="templates-oper"
>Template operators</A
></H1
><P
><SPAN
CLASS="application"
>mnoGoSearch</SPAN
>
  template language provides a set of operators
  making it possible to create templates with some logic.
  </P
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="templates-if"
>Conditional operators</A
></H2
><P
><SPAN
CLASS="application"
>mnoGoSearch</SPAN
>
    supports a number of conditional operators in search templates:
    <TT
CLASS="literal"
>IF</TT
>,
    <TT
CLASS="literal"
>IFCS</TT
>,
    <TT
CLASS="literal"
>IFNOT</TT
>,
    <TT
CLASS="literal"
>IFLIKE</TT
>,
    <TT
CLASS="literal"
>ELSEIF</TT
> (<TT
CLASS="literal"
>ELIF</TT
>),
    <TT
CLASS="literal"
>ELSELIKE</TT
> (<TT
CLASS="literal"
>ELIKE</TT
>),
    <TT
CLASS="literal"
>IFLE</TT
>,
    <TT
CLASS="literal"
>IFLT</TT
>,
    <TT
CLASS="literal"
>IFGE</TT
>,
    <TT
CLASS="literal"
>IFGT</TT
>.
    </P
><P
>&#13;    Comparison is performed case insensitively
    for the operators
    <TT
CLASS="literal"
>IF</TT
>,
    <TT
CLASS="literal"
>IFNOT</TT
>,
    <TT
CLASS="literal"
>IFLIKE</TT
>,
    <TT
CLASS="literal"
>ELSEIF</TT
>,
    <TT
CLASS="literal"
>ELSELIKE</TT
>,
    and case sensitively for
    <TT
CLASS="literal"
>IFCS</TT
>.
    The operators
    <TT
CLASS="literal"
>IFLE</TT
>,
    <TT
CLASS="literal"
>IFLT</TT
>,
    <TT
CLASS="literal"
>IFGE</TT
>,
    <TT
CLASS="literal"
>IFGT</TT
> perform numeric comparison:
    less-or-equal, less, greater-or-equal and greater
    comparison correspondingly.
    </P
><P
>&#13;      <P
><B
>Examples:</B
></P
>
      <PRE
CLASS="programlisting"
>&#13;&#60;!IF   NAME="Content-Type" Content="application/pdf"&#62;
&#60;img src="pdf.png"&#62;
&#60;!ELIF NAME="Content-Type" Content="text/plain"&#62;
&#60;img src="text.png"&#62;
&#60;!ENDIF&#62;

&#60;!IFLIKE NAME="URL" CONTENT="http*"&#62;
This is an HTTP address
&#60;!ELIKE  NAME="URL" CONTENT="ftp*"&#62;
This is an FTP address
&#60;!ELSE&#62;
This is an unknown address type&#62;
&#60;!ENDIF&#62;
</PRE
>
    </P
><P
>It is possible to use nested conditional operators.
    This gives much power for search template construction.
    You can find some examples in the default template <TT
CLASS="filename"
>search.htm-dist</TT
>.
    </P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="templates-oper-set"
>The <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>SET</I
></SPAN
> operator</A
></H2
><P
>This operator is designed to set a variable value
    from a constant, from another variable, or from
    a more complex expression.
    </P
><P
>&#13;      <P
><B
>Examples:</B
></P
>

      <PRE
CLASS="programlisting"
>&#13;&#60;!SET NAME="a" Content="Some string"&#62;
&#60;!SET NAME="b" Content="Another string"&#62;
&#60;!SET NAME="c" Content="$(a)"&#62;
&#60;!SET NAME="d" Content="a is '$(a)', b is '$(b)', c is '$(c)'"&#62;
      </PRE
>
    </P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="templates-oper-copy"
>The <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>COPY</I
></SPAN
> operator</A
></H2
><P
>The <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>COPY</I
></SPAN
> operator calculates the expression
    given in the attribute <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>CONTENT</I
></SPAN
>,
    then treats this value as a name of another variable,
    whose value is then copied into to the variable
    with the name given in the attribute <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>NAME</I
></SPAN
>.
    </P
><P
>&#13;      <P
><B
>Examples:</B
></P
>
<PRE
CLASS="programlisting"
>&#13;&#60;!SET NAME="v1" CONTENT="The first value"&#62;
&#60;!SET NAME="v2" CONTENT="The second value"&#62;
&#60;!SET NAME="v3" CONTENT="The third value"&#62;
&#60;!SET NAME="i"  CONTENT="2"&#62;
&#60;!COPY NAME="value" CONTENT="v$(i)"&#62;
Value="$(value)"
</PRE
>
      The above code will display this text:
<PRE
CLASS="programlisting"
>&#13;Value="The second value"
</PRE
>
    </P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="templates-oper-inc"
>Arithmetic operators</A
></H2
><P
>Arithmetic operators
    <TT
CLASS="literal"
>INC</TT
> and <TT
CLASS="literal"
>DEC</TT
>
    respectively increment and decrement a variable value
    treating it as an <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>integer</I
></SPAN
> number.
    </P
><P
>&#13;      <P
><B
>Examples:</B
></P
>
<PRE
CLASS="programlisting"
>&#13;&#60;!SET NAME="a" Content="10"&#62;a is $(a)
&#60;!INC NAME="a"&#62;After increment, a is $(a)
&#60;!DEC NAME="a"&#62;After decrement, a is $(a)
</PRE
>
    </P
><P
>Arithmetic operators
    <TT
CLASS="literal"
>ADD</TT
>,
    <TT
CLASS="literal"
>SUB</TT
>,
    <TT
CLASS="literal"
>MUL</TT
> perform integer addition,
    subtraction and multiplication of two variables
    specified in the <CODE
CLASS="option"
>NAME</CODE
> and
    <CODE
CLASS="option"
>CONTENT</CODE
> attributes and write
    the result back into the variable
    specified in the <CODE
CLASS="option"
>NAME</CODE
> attribute.
    </P
><P
>&#13;      <P
><B
>Examples:</B
></P
>
<PRE
CLASS="programlisting"
>&#13;&#60;!SET NAME="b" CONTENT="20"&#62;
&#60;!SET NAME="a" CONTENT="10"&#62;
&#60;!MUL NAME="a" CONTENT="$(b)"&#62;a*b=$(a)
&#60;!SET NAME="a" CONTENT="10"&#62;
&#60;!ADD NAME="a" CONTENT="$(b)"&#62;a+b=$(a)
&#60;!SET NAME="a" CONTENT="10"&#62;
&#60;!SUB NAME="a" CONTENT="$(b)"&#62;a-b=$(a)             
</PRE
>
    </P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="templates-oper-loop"
>Loop operators</A
></H2
><P
>Three loop operators
    <TT
CLASS="literal"
>WHILE</TT
>,
    <TT
CLASS="literal"
>WHILENOT</TT
> and
    <TT
CLASS="literal"
>FOR</TT
> are available.
    The <TT
CLASS="literal"
>FOR</TT
> operator was
    introduced in <SPAN
CLASS="application"
>mnoGoSearch</SPAN
>
    <TT
CLASS="literal"
>3.3.0</TT
>.
    </P
><P
>&#13;      <P
><B
>Examples:</B
></P
>
<PRE
CLASS="programlisting"
>&#13;&#60;!SET      NAME="a" Content="10"&#62;
&#60;!WHILENOT NAME="a" Content="0"&#62;
  a is $(a)
&#60;!DEC NAME="a"&#62;
&#60;!ENDWHILE&#62;
</PRE
>

<PRE
CLASS="programlisting"
>&#13;&#60;!FOR NAME="a" FROM="10" TO="20"&#62;a=$(a)&#60;!ENDFOR&#62;

&#60;!SET NAME="from" CONTENT="80"&#62;
&#60;!SET NAME="to" CONTENT="90"&#62;
&#60;!FOR NAME="a" FROM="$(from)" TO="$(to)"&#62;a=$(a)&#60;!ENDFOR&#62;
</PRE
>
    </P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="templates-oper-misc"
>Miscellaneous operators and functions</A
></H2
><P
>&#13;      <P
><B
><CODE
CLASS="function"
>URLDECODE</CODE
> -
      decodes an <ACRONYM
CLASS="acronym"
>URL</ACRONYM
>-encoded string.</B
></P
>
      All instances of the <TT
CLASS="literal"
>%##</TT
> encoding
      in the given string are decoded and the decoded
      string is written into the variable specified in
      the <CODE
CLASS="option"
>NAME</CODE
> attribute.
    </P
><P
>&#13;      <P
><B
>Examples:</B
></P
>
<PRE
CLASS="programlisting"
>&#13;&#60;!URLDECODE NAME="decoded" Content="$(url)"&#62;URL is $(decoded)
      </PRE
>
    </P
><P
>&#13;     <P
><B
><CODE
CLASS="function"
>HTMLENCODE</CODE
> - converts
    special characters to <ACRONYM
CLASS="acronym"
>HTML</ACRONYM
> entities</B
></P
>.
    The conversion rules are:</P
><P
></P
><UL
><LI
><P
><TT
CLASS="literal"
>&#38;</TT
> becomes <TT
CLASS="literal"
>&#38;amp;</TT
></P
></LI
><LI
><P
><TT
CLASS="literal"
>&#60;</TT
> becomes <TT
CLASS="literal"
>&#38;lt;</TT
></P
></LI
><LI
><P
><TT
CLASS="literal"
>&#62;</TT
> becomes <TT
CLASS="literal"
>&#38;gt;</TT
></P
></LI
><LI
><P
><TT
CLASS="literal"
>"</TT
> becomes <TT
CLASS="literal"
>&#38;quot;</TT
></P
></LI
></UL
><P
>&#13;      <P
><B
>Examples:</B
></P
>
      <PRE
CLASS="programlisting"
>&#13;&#60;!HTMLENCODE NAME="encoded" Content="$(url)"&#62;URL is $(encoded)
      </PRE
>
    </P
><P
>&#13;      <P
><B
><CODE
CLASS="function"
>EREG</CODE
> - Replaces a regular expression.</B
></P
>
<PRE
CLASS="programlisting"
>&#13;&#60;!EREG NAME="a" CONTENT="string" MATCH="pattern" RESULT="replacement"&#62;
</PRE
>
    </P
><P
>&#13;    <CODE
CLASS="function"
>EREG</CODE
> scans the string given
    in the <CODE
CLASS="option"
>CONTENT</CODE
> attribute for matches to the
    string given in <CODE
CLASS="option"
>MATCH</CODE
> and stores
    the matched text into variable given in
    <CODE
CLASS="option"
>NAME</CODE
> using the <CODE
CLASS="option"
>RESULT</CODE
>
    value as a replacement pattern. The replacement string can contain
    substrings in the form <CODE
CLASS="varname"
>$N</CODE
>,
    where <CODE
CLASS="varname"
>N</CODE
> is a decimal
    digit <TT
CLASS="literal"
>0</TT
>..<TT
CLASS="literal"
>9</TT
>,
    which is replaced to the text matching
    the <TT
CLASS="literal"
>N-th</TT
> parenthesized substring.
    <CODE
CLASS="varname"
>$0</CODE
> produces the entire
    contents of matching string. The <CODE
CLASS="option"
>CONTENT</CODE
>
    string can have references to other variables.
    </P
><P
>&#13;      <P
><B
>Examples:</B
></P
>
<PRE
CLASS="programlisting"
>&#13;&#60;!SET NAME="str" CONTENT="http://www.host.com/path/file.ext"&#62;
&#60;!EREG NAME="a" CONTENT="$(str)"
MATCH="^([a-z]*)://([^/]*)/(.*)" RESULT="scheme=$1; host=$2
path+file=$3"&#62;$(a)
</PRE
>
    will display:
<PRE
CLASS="programlisting"
>&#13;scheme=http host=www.host.com path=path/file.ext
</PRE
>
    </P
></DIV
></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="msearch-html.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="msearch-rel.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Designing <TT
CLASS="filename"
>search.htm</TT
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="msearch-doingsearch.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Ranking documents
     <A
NAME="AEN5668"
></A
></TD
></TR
></TABLE
></DIV
><!--#include virtual="body-after.html"--></BODY
></HTML
>