(PECL swish >= 0.1.0)
SwishSearch->execute — اجرای جستجو و دریافت نتیجه
This function is EXPERIMENTAL. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk.
جستجو در اندیس فایلها مبتنی بر پارامترهای تعیین شده در شی جستجو.
رشته پرس و جو پارامتر اختیاری است همچنین میتوان آن را با استفاده از متد Swish->prepare() تعیین کرد. رشته پرس و جو در بین اجرا حفظ میشود تا آن را یک بار تعیین کنید و جندین بار اجرا کنید.
بازگرداندن شی SwishResults.
ایجاد SwishException در صورت خطا.
Example #1 مثال اصلی SwishSearch->execute()
<?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";
}
?>
The above example will output something similar to:
First query found: 2 hits Second query found: 12 hits