resetLimit"HREF="function.swishsearch-resetlimit.html"> Manuál PHP Předcházející Další (no version informatio..."/>
Forum und email
SwishSearch->execute

SwishSearch->execute

(no version information, might be only in CVS)

SwishSearch->execute -- Execute the search and get the results

Popis

object SwishSearch->execute ( [string query] )

Varování

Tato funkce je EXPERIMENTÁLNÍ. Chování této funkce, její název a všechno ostatní, co je zde zdokumentováno, se v budoucích verzích PHP může BEZ OHLÁŠENÍ změnit. Berte to v úvahu a používejte tuto funkci na vlastní nebezpečí.

Searches the index file(s) based on the parameters set in the search object.

Seznam parametrů

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.

Návratové hodnoty

Returns SwishResults object.

Errors/Exceptions

Throws SwishException on error.

Příklady

Příklad 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";
}

?>

Výše uvedený příklad vypíše něco jako:

First query found: 2 hits
Second query found: 12 hits