Sphinx field_weights
parent
aee6a019a3
commit
f3c4baefe3
|
@ -400,6 +400,7 @@ class DatabaseMysql implements Database
|
||||||
*
|
*
|
||||||
* Sphinx Search extensions:
|
* Sphinx Search extensions:
|
||||||
* 'WITHIN GROUP ORDER BY' => array($orderby_field => 'ASC')
|
* 'WITHIN GROUP ORDER BY' => array($orderby_field => 'ASC')
|
||||||
|
* 'FIELD_WEIGHTS' => array('field' => <weight>, ...)
|
||||||
*/
|
*/
|
||||||
function select_builder($tables, $fields, $where, $options = NULL)
|
function select_builder($tables, $fields, $where, $options = NULL)
|
||||||
{
|
{
|
||||||
|
@ -446,6 +447,16 @@ class DatabaseMysql implements Database
|
||||||
$sql .= " WITHIN GROUP ORDER BY ".$this->order_option($options['WITHIN GROUP ORDER BY']);
|
$sql .= " WITHIN GROUP ORDER BY ".$this->order_option($options['WITHIN GROUP ORDER BY']);
|
||||||
}
|
}
|
||||||
$sql .= $this->limit_option($options);
|
$sql .= $this->limit_option($options);
|
||||||
|
if (!empty($options['FIELD_WEIGHTS']))
|
||||||
|
{
|
||||||
|
// Sphinx Search extension
|
||||||
|
$weights = array();
|
||||||
|
foreach ($options['FIELD_WEIGHTS'] as $f => $w)
|
||||||
|
{
|
||||||
|
$weights[] = "`$f`=$w";
|
||||||
|
}
|
||||||
|
$sql .= " OPTION field_weights=(".implode(', ', $weights).")";
|
||||||
|
}
|
||||||
if (isset($options['FOR UPDATE']))
|
if (isset($options['FOR UPDATE']))
|
||||||
$sql .= ' FOR UPDATE';
|
$sql .= ' FOR UPDATE';
|
||||||
elseif (isset($options['LOCK IN SHARE MODE']))
|
elseif (isset($options['LOCK IN SHARE MODE']))
|
||||||
|
|
Loading…
Reference in New Issue