Delicious Bookmark this on Delicious Share on Facebook SlashdotSlashdot It! Digg! Digg



PHP : Function Reference : Swish Functions : SwishSearch->setPhraseDelimiter

SwishSearch->setPhraseDelimiter

Set the phrase delimiter ()
void SwishSearch->setPhraseDelimiter ( string delimiter )

Example 2519. 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";
}

?>

The above example will output something similar to:

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"
}

Change Language


Follow Navioo On Twitter
Swish::__construct
Swish->getMetaList
Swish->getPropertyList
Swish->prepare
Swish->query
SwishResult->getMetaList
SwishResult->stem
SwishResults->getParsedWords
SwishResults->getRemovedStopwords
SwishResults->nextResult
SwishResults->seekResult
SwishSearch->execute
SwishSearch->resetLimit
SwishSearch->setLimit
SwishSearch->setPhraseDelimiter
SwishSearch->setSort
SwishSearch->setStructure
eXTReMe Tracker