| @@ 244-255 (lines=12) @@ | ||
| 241 | /** |
|
| 242 | * Returns score of current hit. |
|
| 243 | */ |
|
| 244 | public function getDocumentScore(): int |
|
| 245 | { |
|
| 246 | if (!$this->valid()) { |
|
| 247 | throw new \LogicException('Document score is available only while iterating over results.'); |
|
| 248 | } |
|
| 249 | ||
| 250 | if (!isset($this->documents[$this->key]['_score'])) { |
|
| 251 | return null; |
|
| 252 | } |
|
| 253 | ||
| 254 | return (int) $this->documents[$this->key]['_score']; |
|
| 255 | } |
|
| 256 | ||
| 257 | /** |
|
| 258 | * Returns sort of current hit. |
|
| @@ 260-271 (lines=12) @@ | ||
| 257 | /** |
|
| 258 | * Returns sort of current hit. |
|
| 259 | */ |
|
| 260 | public function getDocumentSort() |
|
| 261 | { |
|
| 262 | if (!$this->valid()) { |
|
| 263 | throw new \LogicException('Document sort is available only while iterating over results.'); |
|
| 264 | } |
|
| 265 | ||
| 266 | if (!isset($this->documents[$this->key]['sort'])) { |
|
| 267 | return null; |
|
| 268 | } |
|
| 269 | ||
| 270 | return $this->documents[$this->key]['sort'][0]; |
|
| 271 | } |
|
| 272 | ||
| 273 | /** |
|
| 274 | * Convert`s raw array to a document object or a normalized array, depends on the iterator type. |
|