@@ -85,7 +85,9 @@ |
||
| 85 | 85 | ]; |
| 86 | 86 | |
| 87 | 87 | // because ES |
| 88 | - if (empty($script['script']['params'])) unset($script['script']['params']); |
|
| 88 | + if (empty($script['script']['params'])) { |
|
| 89 | + unset($script['script']['params']); |
|
| 90 | + } |
|
| 89 | 91 | |
| 90 | 92 | return $script; |
| 91 | 93 | } |
@@ -2,8 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Bardex\Elastic; |
| 4 | 4 | |
| 5 | -use Bardex\Elastic\SearchResult; |
|
| 6 | - |
|
| 7 | 5 | |
| 8 | 6 | /** |
| 9 | 7 | * Fluent interface for ElasticSearch |
@@ -78,8 +78,7 @@ |
||
| 78 | 78 | $time = round((microtime(1) - $start) * 1000); |
| 79 | 79 | $this->triggerSuccess($query, $result, $time); |
| 80 | 80 | return $result; |
| 81 | - } |
|
| 82 | - catch (\Exception $e) { |
|
| 81 | + } catch (\Exception $e) { |
|
| 83 | 82 | $this->triggerError($query, $e); |
| 84 | 83 | throw $e; |
| 85 | 84 | } |
@@ -145,12 +145,26 @@ |
||
| 145 | 145 | |
| 146 | 146 | protected function getTimeRange($time) |
| 147 | 147 | { |
| 148 | - if ($time <= 10) return '0-10 ms'; |
|
| 149 | - if ($time <= 30) return '10-30 ms'; |
|
| 150 | - if ($time <= 50) return '30-50 ms'; |
|
| 151 | - if ($time <= 100) return '50-100 ms'; |
|
| 152 | - if ($time <= 500) return '100-500 ms'; |
|
| 153 | - if ($time <= 1000) return '500-1000 ms'; |
|
| 154 | - if ($time > 1000) return '> 1000 ms'; |
|
| 148 | + if ($time <= 10) { |
|
| 149 | + return '0-10 ms'; |
|
| 150 | + } |
|
| 151 | + if ($time <= 30) { |
|
| 152 | + return '10-30 ms'; |
|
| 153 | + } |
|
| 154 | + if ($time <= 50) { |
|
| 155 | + return '30-50 ms'; |
|
| 156 | + } |
|
| 157 | + if ($time <= 100) { |
|
| 158 | + return '50-100 ms'; |
|
| 159 | + } |
|
| 160 | + if ($time <= 500) { |
|
| 161 | + return '100-500 ms'; |
|
| 162 | + } |
|
| 163 | + if ($time <= 1000) { |
|
| 164 | + return '500-1000 ms'; |
|
| 165 | + } |
|
| 166 | + if ($time > 1000) { |
|
| 167 | + return '> 1000 ms'; |
|
| 168 | + } |
|
| 155 | 169 | } |
| 156 | 170 | } |
| 157 | 171 | \ No newline at end of file |