@@ 299-310 (lines=12) @@ | ||
296 | * |
|
297 | * @return int |
|
298 | */ |
|
299 | public function getDocumentScore() |
|
300 | { |
|
301 | if (!$this->valid()) { |
|
302 | throw new \LogicException('Document score is available only while iterating over results.'); |
|
303 | } |
|
304 | ||
305 | if (!isset($this->documents[$this->key]['_score'])) { |
|
306 | return null; |
|
307 | } |
|
308 | ||
309 | return $this->documents[$this->key]['_score']; |
|
310 | } |
|
311 | ||
312 | /** |
|
313 | * Returns sort of current hit. |
|
@@ 317-328 (lines=12) @@ | ||
314 | * |
|
315 | * @return mixed |
|
316 | */ |
|
317 | public function getDocumentSort() |
|
318 | { |
|
319 | if (!$this->valid()) { |
|
320 | throw new \LogicException('Document sort is available only while iterating over results.'); |
|
321 | } |
|
322 | ||
323 | if (!isset($this->documents[$this->key]['sort'])) { |
|
324 | return null; |
|
325 | } |
|
326 | ||
327 | return $this->documents[$this->key]['sort'][0]; |
|
328 | } |
|
329 | ||
330 | /** |
|
331 | * Converts raw array to document object or array, depends on iterator type. |