Skip to content

Instantly share code, notes, and snippets.

@tonymet
Last active August 29, 2015 14:03
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 tonymet/1c662dfb30db229fe055 to your computer and use it in GitHub Desktop.
Save tonymet/1c662dfb30db229fe055 to your computer and use it in GitHub Desktop.
$count = $boost = count($matches);
$query .= "(or (phrase boost=" . ($boost+1) . " '" . $keyword . "')";
for($i=0; $i < $count -1; $i++ )
{
$query .="(and (phrase boost={$boost} '" . $matches[$i] . "'))";
$boost-=1;
}
$query .= "(prefix boost={$boost} '" . $matches[$i] . "'))";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment