SwishSearch::setPhraseDelimiter

(PECL swish >= 0.1.0)

SwishSearch::setPhraseDelimiterSet the phrase delimiter

Opis

SwishSearch::setPhraseDelimiter ( string $delimiter ) : void
Ostrzeżenie

Ta funkcja jest w stadium EKSPERYMENTALNYM. Oznacza to, że zachowanie funkcji, jej nazwa, w zasadzie wszystko udokumentowane tutaj może zostać zmienione w przyszłych wersjach PHP bez wcześniejszego uprzedzenia. Używaj tej funkcji na własne ryzyko.

Parametry

delimiter

Phrase delimiter character. The default delimiter is double-quotes.

Zwracane wartości

Nie jest zwracana żadna wartość.

Przykłady

Przykład #1 Basic SwishSearch::setPhraseDelimiter() example

<?php

try {

    
$swish = new Swish("index.swish-e");
    
$search $swish->prepare();

    
$results $search->execute('"every time"'); //looking for "every time"
    
echo "First query found: "$results->hits" hits\n";

    
$search->setPhraseDelimiter("'");
    
$results $search->execute("'every time'"); //the same query, but using different delimiter
    
echo "Second query found: "$results->hits" hits\n";

    
$search->setPhraseDelimiter('"');
    
$results $search->execute("'every time'"); //looking for "every" and "time"
    
echo "Third query found: "$results->hits" hits\n";

    
//let's look at parsed words
    
var_dump($results->getParsedWords("index.swish-e"));

} catch (
SwishException $e) {
    echo 
$e->getMessage(), "\n";
}

?>

Powyższy przykład wyświetli coś podobnego do:

First query found: 1 hits
Second query found: 1 hits
Third query found: 2 hits
array(2) {
  [0]=>
  string(5) "every"
  [1]=>
  string(4) "time"
}

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top