Skip to content

Instantly share code, notes, and snippets.

@komapa
Created February 5, 2010 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save komapa/295707 to your computer and use it in GitHub Desktop.
Save komapa/295707 to your computer and use it in GitHub Desktop.
<?php
$keyword = $sphinx->escapeString($keyword);
if (mb_strlen($keyword, 'utf8') >= 3)
{
if (strpos($keyword, ' ') !== false)
{
$words = explode(' ', $keyword);
foreach ($words as $i => $word)
{
if (mb_strlen($word, 'utf8') >= 3)
{
$words[$i] = '*'. $word. '*';
}
}
$keyword = implode(' ', $words);
}
else
{
$keyword = '*'. $keyword .'*';
}
}
$results = $cl->Query($keyword, "classifieds");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment