diff options
| author | Nathan Kinkade <nath@nkinka.de> | 2011-11-19 15:14:18 +0000 | 
|---|---|---|
| committer | Nathan Kinkade <nath@nkinka.de> | 2011-11-19 15:14:18 +0000 | 
| commit | 297241991937160c057ed6f181ef441ebe6aaaaf (patch) | |
| tree | 99de1c34eba0e6f7d87dd3895c0b0388b74497f6 /modules/search/helpers | |
| parent | 7ed7450890bf997a9005051f6bdcd7a6d0112e77 (diff) | |
| parent | 94eef9eaecbdcc98f4b5adb0da939480a324b0ad (diff) | |
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules/search/helpers')
| -rw-r--r-- | modules/search/helpers/search.php | 12 | 
1 files changed, 6 insertions, 6 deletions
| diff --git a/modules/search/helpers/search.php b/modules/search/helpers/search.php index d6d67c29..ab6da802 100644 --- a/modules/search/helpers/search.php +++ b/modules/search/helpers/search.php @@ -112,22 +112,22 @@ class search_Core {    static function get_position($item, $q) {      $page_size = module::get_var("gallery", "page_size", 9); -      $query = self::_build_query_base($q, array("{items}.id = " . $item->id)); -      $db = Database::instance();      // Truncate the score by two decimal places as this resolves the issues      // that arise due to in exact numeric conversions.      $score = $db->query($query)->current()->score; -    $score = substr($score, 0, strlen($score) - 2); +    if (strlen($score) > 7) { +      $score = substr($score, 0, strlen($score) - 2); +    }      $data = $db->query(self::_build_query_base($q) . " HAVING `score` >= " . $score); -      $data->seek($data->count() - 1); -    while ($data->get("id") != $item->id && $data->prev()->valid()); +    while ($data->get("id") != $item->id && $data->prev()->valid()) { +    } -    return  $data->key() + 1; +    return $data->key() + 1;    }  } | 
