Документация PHP
| Документация DHTML | Документация Smarty | SVG/VML Графика и JavaScript
| Документация bash |
SwishSearch->execute
(PECL swish:0.1-0.3.0)
SwishSearch->execute — Execute the search and get the results
Описание
object SwishSearch->execute ([ string $query ] )
Внимание
Эта функция является ЭКСПЕРИМЕНТАЛЬНОЙ. Поведение этой функции, ее имя и относящаяся к ней документация могут измениться в последующих версиях PHP без уведомления. Используйте эту функцию на свой страх и риск.
Searches the index file(s) based on the parameters set in the search object.
Список параметров
- query
-
The query string is an optional parameter, it can be also set using Swish->prepare() method. The query string is preserved between executions, so you can set it once, but execute the search multiple times.
Возвращаемые значения
Returns SwishResults object.
Errors/Exceptions
Throws SwishException on error.
Примеры
Пример #1 Basic SwishSearch->execute() example
<?php
try {
$swish = new Swish("index.swish-e");
$search = $swish->prepare();
$results = $search->execute("query");
echo "First query found: ", $results->hits, " hits\n";
$results = $search->execute("new OR query");
echo "Second query found: ", $results->hits, " hits\n";
} catch (SwishException $e) {
echo $e->getMessage(), "\n";
}
?>
Результатом выполнения данного примера будет что-то подобное:
First query found: 2 hits Second query found: 12 hits