public function removeDocument($docId)
{
$terms = $this->getTermsByDocumentId($docId);
$flag = false;
foreach ($terms as $term) {
$flag = true;
$row =& $this->index[$term][self::POSTINGS];
// remove the term altogether
if (count($row) === 1) {
unset($this->index[$term]);
} else {
$idx = array_search($docId, $row);
unset($row[$idx]);
$row = array_values($row);
// re-index the array
}
}
return $flag;
}