mirror of
https://github.com/php/doc-ru.git
synced 2026-03-24 07:42:22 +01:00
112 lines
2.8 KiB
XML
112 lines
2.8 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
||
<!-- EN-Revision: 7bade7dc0cb3fdfe81d7db2225f27be1698f470d Maintainer: sergey Status: ready -->
|
||
<!-- Reviewed: no -->
|
||
|
||
<refentry xml:id="solrcollapsefunction.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||
<refnamediv>
|
||
<refname>SolrCollapseFunction::__construct</refname>
|
||
<refpurpose>Конструктор класса</refpurpose>
|
||
</refnamediv>
|
||
|
||
<refsect1 role="description">
|
||
&reftitle.description;
|
||
<constructorsynopsis>
|
||
<modifier>public</modifier> <methodname>SolrCollapseFunction::__construct</methodname>
|
||
<methodparam choice="opt"><type>string</type><parameter>field</parameter></methodparam>
|
||
</constructorsynopsis>
|
||
<para>
|
||
Конструктор класса Collapse Function
|
||
</para>
|
||
|
||
</refsect1>
|
||
|
||
<refsect1 role="parameters">
|
||
&reftitle.parameters;
|
||
<variablelist>
|
||
<varlistentry>
|
||
<term><parameter>field</parameter></term>
|
||
<listitem>
|
||
<para>
|
||
Имя поля для свёртывания.
|
||
</para>
|
||
<para>
|
||
Чтобы свернуть результат. Тип поля должен быть однозначным: строка, целое число или число с плавающей точкой.
|
||
</para>
|
||
</listitem>
|
||
</varlistentry>
|
||
</variablelist>
|
||
</refsect1>
|
||
|
||
<refsect1 role="examples">
|
||
&reftitle.examples;
|
||
<example>
|
||
<title>Пример использования <function>SolrCollapseFunction::__construct</function></title>
|
||
<programlisting role="php">
|
||
<![CDATA[
|
||
<?php
|
||
|
||
include "bootstrap.php";
|
||
|
||
$options = array
|
||
(
|
||
'hostname' => SOLR_SERVER_HOSTNAME,
|
||
'login' => SOLR_SERVER_USERNAME,
|
||
'password' => SOLR_SERVER_PASSWORD,
|
||
'port' => SOLR_SERVER_PORT,
|
||
'path' => SOLR_SERVER_PATH
|
||
);
|
||
|
||
$client = new SolrClient($options);
|
||
|
||
$query = new SolrQuery('*:*');
|
||
|
||
$func = new SolrCollapseFunction('field_name');
|
||
|
||
$func->setMax('sum(cscore(),field(some_other_field))');
|
||
$func->setSize(100);
|
||
$func->setNullPolicy(SolrCollapseFunction::NULLPOLICY_EXPAND);
|
||
|
||
$query->collapse($func);
|
||
|
||
$queryResponse = $client->query($query);
|
||
|
||
$response = $queryResponse->getResponse();
|
||
|
||
print_r($response);
|
||
|
||
?>
|
||
]]>
|
||
</programlisting>
|
||
</example>
|
||
</refsect1>
|
||
|
||
|
||
<refsect1 role="seealso">
|
||
&reftitle.seealso;
|
||
<simplelist>
|
||
<member><methodname>SolrQuery::collapse</methodname></member>
|
||
</simplelist>
|
||
</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:"~/.phpdoc/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
|
||
-->
|