TextAnalysis\Indexes\InvertedIndex::getTermsByDocumentId PHP Method

getTermsByDocumentId() public method

Returns the key value array with the terms found in the document for the given doc id
public getTermsByDocumentId ( mixed $docId ) : array
$docId mixed
return array
    public function getTermsByDocumentId($docId)
    {
        $termsFoundIn = [];
        foreach ($this->index as $term => $row) {
            if (in_array($docId, $row[self::POSTINGS])) {
                $termsFoundIn[] = $term;
            }
        }
        return $termsFoundIn;
    }