Skip to content

Instantly share code, notes, and snippets.

@tonymet
Created July 8, 2014 19:30
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/c0580c291cf712a43934 to your computer and use it in GitHub Desktop.
Save tonymet/c0580c291cf712a43934 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