@@ 329-340 (lines=12) @@ | ||
326 | * |
|
327 | * @return int |
|
328 | */ |
|
329 | public function getDocumentScore() |
|
330 | { |
|
331 | if (!$this->valid()) { |
|
332 | throw new \LogicException('Document score is available only while iterating over results.'); |
|
333 | } |
|
334 | ||
335 | if (!isset($this->documents[$this->key]['_score'])) { |
|
336 | return null; |
|
337 | } |
|
338 | ||
339 | return $this->documents[$this->key]['_score']; |
|
340 | } |
|
341 | ||
342 | /** |
|
343 | * Returns sort of current hit. |
|
@@ 347-358 (lines=12) @@ | ||
344 | * |
|
345 | * @return mixed |
|
346 | */ |
|
347 | public function getDocumentSort() |
|
348 | { |
|
349 | if (!$this->valid()) { |
|
350 | throw new \LogicException('Document sort is available only while iterating over results.'); |
|
351 | } |
|
352 | ||
353 | if (!isset($this->documents[$this->key]['sort'])) { |
|
354 | return null; |
|
355 | } |
|
356 | ||
357 | return $this->documents[$this->key]['sort'][0]; |
|
358 | } |
|
359 | ||
360 | /** |
|
361 | * Converts raw array to document object or array, depends on iterator type. |