public function getTermsByDocumentId($docId) { $termsFoundIn = []; foreach ($this->index as $term => $row) { if (in_array($docId, $row[self::POSTINGS])) { $termsFoundIn[] = $term; } } return $termsFoundIn; }