mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-21 03:18:55 +00:00
94 lines
2.1 KiB
XML
94 lines
2.1 KiB
XML
![]() |
<?xml version="1.0" encoding="iso-8859-1"?>
|
||
|
<!-- $Revision: 1.1 $ -->
|
||
|
<refentry id="function.swish-construct">
|
||
|
<refnamediv>
|
||
|
<refname>Swish::__construct</refname>
|
||
|
<refpurpose>Construct a Swish object</refpurpose>
|
||
|
</refnamediv>
|
||
|
<refsect1 role="description">
|
||
|
&reftitle.description;
|
||
|
<methodsynopsis>
|
||
|
<type>void</type><methodname>Swish::__construct</methodname>
|
||
|
<methodparam><type>string</type><parameter>string index_names</parameter></methodparam>
|
||
|
</methodsynopsis>
|
||
|
&warn.experimental.func;
|
||
|
</refsect1>
|
||
|
<refsect1 role="parameters">
|
||
|
&reftitle.parameters;
|
||
|
<para>
|
||
|
<variablelist>
|
||
|
<varlistentry>
|
||
|
<term><parameter>index_names</parameter></term>
|
||
|
<listitem>
|
||
|
<para>
|
||
|
The list of index files separated by spaces.
|
||
|
</para>
|
||
|
</listitem>
|
||
|
</varlistentry>
|
||
|
</variablelist>
|
||
|
</para>
|
||
|
</refsect1>
|
||
|
<refsect1 role="errors">
|
||
|
&reftitle.errors;
|
||
|
<para>
|
||
|
Throws <classname>SwishException</classname> on error.
|
||
|
</para>
|
||
|
</refsect1>
|
||
|
<refsect1 role="examples">
|
||
|
&reftitle.examples;
|
||
|
<para>
|
||
|
<example>
|
||
|
<title>A <function>Swish::__construct</function> example</title>
|
||
|
<programlisting role="php">
|
||
|
<![CDATA[
|
||
|
<?php
|
||
|
|
||
|
try {
|
||
|
$swish = new Swish("index1 index2");
|
||
|
} catch (SwishException $e) {
|
||
|
echo $e->getMessage(), "\n";
|
||
|
}
|
||
|
|
||
|
foreach ($swish->indexes as $index) {
|
||
|
var_dump($index["name"]);
|
||
|
var_dump($index["headers"]["Total Words"]);
|
||
|
}
|
||
|
|
||
|
?>
|
||
|
]]>
|
||
|
</programlisting>
|
||
|
<para>The above example will output something like this:</para>
|
||
|
<screen>
|
||
|
<![CDATA[
|
||
|
string(6) "index1"
|
||
|
int(1888)
|
||
|
string(6) "index2"
|
||
|
int(2429)
|
||
|
]]>
|
||
|
</screen>
|
||
|
</example>
|
||
|
</para>
|
||
|
</refsect1>
|
||
|
</refentry>
|
||
|
|
||
|
<!-- 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
|
||
|
indent-tabs-mode:nil
|
||
|
sgml-parent-document:nil
|
||
|
sgml-default-dtd-file:"../../../../manual.ced"
|
||
|
sgml-exposed-tags:nil
|
||
|
sgml-local-catalogs:nil
|
||
|
sgml-local-ecat-files:nil
|
||
|
End:
|
||
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||
|
vim: et tw=78 syn=sgml
|
||
|
vi: ts=1 sw=1
|
||
|
-->
|