public function totalMatchingDocuments($keyword, $isLastWord = false) { $occurance = $this->getWordlistByKeyword($keyword, $isLastWord); if (isset($occurance[0])) { return $occurance[0]['num_docs']; } return 0; }